CTRE Phoenix 6 C++ 26.70.0-alpha-2
Loading...
Searching...
No Matches
DifferentialMechanism.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) Cross The Road Electronics.  All rights reserved.
3 * License information can be found in CTRE_LICENSE.txt
4 * For support and suggestions contact support@ctr-electronics.com or file
5 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
6 */
7#pragma once
8
12#include <atomic>
13#include <optional>
14
15namespace ctre {
16namespace phoenix6 {
17
18namespace hardware {
19 class CANcoder;
20 class CANdi;
21 class Pigeon2;
22}
23
24namespace mechanisms {
25
26/**
27 * \brief Manages control of a two-axis differential mechanism.
28 *
29 * This mechanism requires the devices to be Pro licensed and
30 * connected to a CAN FD bus. Unlicensed users and users on a
31 * CAN 2.0 bus can use the \c SimpleDifferentialMechanism instead
32 * with limited functionality.
33 *
34 * \details A differential mechanism has two axes of motion, where
35 * the position along each axis is determined by two motors in
36 * separate gearboxes:
37 *
38 * - Driving both motors in a common direction causes the mechanism
39 * to move forward/reverse, up/down, etc.
40 *
41 * - This is the Average axis: position is determined by the
42 * average of the two motors' positions.
43 *
44 * - Driving the motors in opposing directions causes the mechanism
45 * to twist or rotate left/right.
46 *
47 * - This is the Difference axis: rotation is determined by half
48 * the difference of the two motors' positions.
49 *
50 * \tparam MotorT Type of the motor controllers
51 */
52template <std::derived_from<hardware::traits::CommonTalon> MotorT>
54public:
55 /**
56 * \brief Possible reasons for the mechanism to disable.
57 */
59 /**
60 * \brief No reason given.
61 */
63 /**
64 * \brief A remote sensor is not present on CAN Bus.
65 */
67 /**
68 * \brief The remote Talon FX used for differential
69 * control is not present on CAN Bus.
70 */
72 /**
73 * \brief A remote sensor position has overflowed. Because of the
74 * nature of remote sensors, it is possible for a remote sensor
75 * position to overflow beyond what is supported by the status signal
76 * frame. However, this is rare and cannot occur over the course of an
77 * FRC match under normal use.
78 */
80 /**
81 * \brief A device or remote sensor has reset.
82 */
84 };
85
86 /**
87 * \brief Possible reasons for the mechanism to require
88 * user action to resume control.
89 */
91 /**
92 * \brief No reason given.
93 */
95 /**
96 * \brief A remote sensor position has overflowed. Because of the
97 * nature of remote sensors, it is possible for a remote sensor
98 * position to overflow beyond what is supported by the status signal
99 * frame. However, this is rare and cannot occur over the course of an
100 * FRC match under normal use.
101 */
103 /**
104 * \brief A device or remote sensor has reset.
105 */
107 };
108
109private:
110 /** \brief Number of times to attempt config applies. */
111 static constexpr int kNumConfigAttempts = 2;
112
113 std::unique_ptr<MotorT> _diffLeaderFX;
114 std::unique_ptr<MotorT> _diffFollowerFX;
115
116 wpi::units::scalar_t _sensorToDiffRatio;
117
118 std::function<bool()> _diffLeaderFXResetChecker;
119 std::function<bool()> _diffFollowerFXResetChecker;
120 std::optional<std::function<bool()>> _diffSensorResetChecker{};
121
123
124 controls::NeutralOut _neutral{};
125 controls::CoastOut _coast{};
126 controls::StaticBrake _brake{};
127
128 std::atomic<bool> _mechanismDisabled{false};
129 std::atomic<bool> _requiresUserAction{false};
130
133
134 void ApplyConfigs(
135 DifferentialMotorConstants<typename MotorT::Configuration> const &constants,
136 signals::DifferentialSensorSourceValue diffSensorSource,
137 std::optional<int> diffSensorID
138 );
139 ctre::phoenix::StatusCode BeforeControl();
140
141public:
142 /**
143 * \brief Creates a new differential mechanism using two hardware#traits#CommonTalon devices.
144 * The mechanism will use the average of the two Talon FX sensors on the primary axis,
145 * and half of the difference between the two Talon FX sensors on the differential axis.
146 *
147 * This mechanism requires the devices to be Pro licensed and connected to a CAN FD bus.
148 * Unlicensed users and users on a CAN 2.0 bus can use the \c SimpleDifferentialMechanism
149 * instead with limited functionality.
150 *
151 * \param constants Constants used to construct the mechanism
152 */
154
155 /**
156 * \brief Creates a new differential mechanism using two hardware#traits#CommonTalon devices and
157 * a hardware#Pigeon2. The mechanism will use the average of the two Talon FX sensors on the primary
158 * axis, and the selected Pigeon 2 sensor source on the differential axis.
159 *
160 * This mechanism requires the devices to be Pro licensed and connected to a CAN FD bus.
161 * Unlicensed users and users on a CAN 2.0 bus can use the \c SimpleDifferentialMechanism
162 * instead with limited functionality.
163 *
164 * \param constants Constants used to construct the mechanism
165 * \param pigeon2 The Pigeon 2 to use for the differential axis
166 * \param pigeonSource The sensor source to use for the Pigeon 2 (Yaw, Pitch, or Roll)
167 */
169
170 /**
171 * \brief Creates a new differential mechanism using two hardware#traits#CommonTalon devices and
172 * a hardware#CANcoder. The mechanism will use the average of the two Talon FX sensors on the primary
173 * axis, and the CANcoder position/velocity on the differential axis.
174 *
175 * This mechanism requires the devices to be Pro licensed and connected to a CAN FD bus.
176 * Unlicensed users and users on a CAN 2.0 bus can use the \c SimpleDifferentialMechanism
177 * instead with limited functionality.
178 *
179 * \param constants Constants used to construct the mechanism
180 * \param cancoder The CANcoder to use for the differential axis
181 */
183
184 /**
185 * \brief Creates a new differential mechanism using two hardware#traits#CommonTalon devices and
186 * a hardware#CANdi. The mechanism will use the average of the two Talon FX sensors on the primary
187 * axis, and the selected CTR Electronics' CANdi™ branded sensor source on the differential axis.
188 *
189 * This mechanism requires the devices to be Pro licensed and connected to a CAN FD bus.
190 * Unlicensed users and users on a CAN 2.0 bus can use the \c SimpleDifferentialMechanism
191 * instead with limited functionality.
192 *
193 * \param constants Constants used to construct the mechanism
194 * \param candi The CTR Electronics' CANdi™ branded device to use for the differential axis
195 * \param candiSource The sensor source to use for the CTR Electronics' CANdi™ branded device
196 */
198
199 /**
200 * \brief Configures the neutral mode to use for both motors in the mechanism.
201 *
202 * \param neutralMode The state of the motor controller bridge when output is neutral or disabled
203 * \param timeoutSeconds Maximum amount of time to wait when performing each configuration
204 * \returns Status code of the first failed config call, or OK if all succeeded
205 */
206 ctre::phoenix::StatusCode ConfigNeutralMode(signals::NeutralModeValue neutralMode, wpi::units::second_t timeoutSeconds = 100_ms);
207
208 /**
209 * \brief Call this method periodically to automatically protect against
210 * dangerous fault conditions and keep #GetMechanismState() updated.
211 */
212 void Periodic();
213
214 /**
215 * \brief Get whether the mechanism is currently disabled due to an issue.
216 *
217 * \returns true if the mechanism is temporarily disabled
218 */
219 bool IsDisabled() const
220 {
221 return _mechanismDisabled.load(std::memory_order_acquire);
222 }
223
224 /**
225 * \brief Get whether the mechanism is currently disabled and requires
226 * user action to re-enable mechanism control.
227 *
228 * \returns true if the mechanism is disabled and the user must manually
229 * perform an action
230 */
232 {
233 return _requiresUserAction.load(std::memory_order_acquire);
234 }
235
236 /**
237 * \brief Gets the state of the mechanism.
238 *
239 * \returns MechanismState representing the state of the mechanism
240 */
242 {
243 if (RequiresUserAction()) {
245 } else if (IsDisabled()) {
247 } else {
248 return MechanismState::OK;
249 }
250 }
251
252 /**
253 * \brief Indicate to the mechanism that the user has performed the required
254 * action to resume mechanism control.
255 */
257
258 /**
259 * \returns The reason for the mechanism being disabled
260 */
262 {
263 return _disabledReason;
264 }
265 /**
266 * \returns The reason for the mechanism requiring user
267 * action to resume control
268 */
270 {
271 return _requiresUserReason;
272 }
273
274 /**
275 * \brief Average component of the mechanism position.
276 *
277 * - Minimum Value: -16384.0
278 * - Maximum Value: 16383.999755859375
279 * - Default Value: 0
280 * - Units: rotations
281 *
282 * This refreshes and returns a cached StatusSignal object.
283 *
284 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
285 * \returns DifferentialAveragePosition Status Signal Object
286 */
288 {
289 return _diffLeaderFX->GetDifferentialAveragePosition(refresh);
290 }
291
292 /**
293 * \brief Average component of the mechanism velocity.
294 *
295 * - Minimum Value: -512.0
296 * - Maximum Value: 511.998046875
297 * - Default Value: 0
298 * - Units: rotations per second
299 *
300 * This refreshes and returns a cached StatusSignal object.
301 *
302 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
303 * \returns DifferentialAverageVelocity Status Signal Object
304 */
306 {
307 return _diffLeaderFX->GetDifferentialAverageVelocity(refresh);
308 }
309
310 /**
311 * \brief Differential component of the mechanism position.
312 *
313 * - Minimum Value: -16384.0
314 * - Maximum Value: 16383.999755859375
315 * - Default Value: 0
316 * - Units: rotations
317 *
318 * This refreshes and returns a cached StatusSignal object.
319 *
320 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
321 * \returns DifferentialDifferencePosition Status Signal Object
322 */
324 {
325 return _diffLeaderFX->GetDifferentialDifferencePosition(refresh);
326 }
327
328 /**
329 * \brief Differential component of the mechanism velocity.
330 *
331 * - Minimum Value: -512.0
332 * - Maximum Value: 511.998046875
333 * - Default Value: 0
334 * - Units: rotations per second
335 *
336 * This refreshes and returns a cached StatusSignal object.
337 *
338 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
339 * \returns DifferentialDifferenceVelocity Status Signal Object
340 */
342 {
343 return _diffLeaderFX->GetDifferentialDifferenceVelocity(refresh);
344 }
345
346 /**
347 * \brief Value that the average closed loop is targeting.
348 *
349 * \details This is the value that the closed loop PID controller
350 * targets.
351 *
352 * This refreshes and returns a cached StatusSignal object.
353 *
354 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
355 * \returns ClosedLoopReference Status Signal object
356 */
358 {
359 return _diffLeaderFX->GetClosedLoopReference(refresh);
360 }
361
362 /**
363 * \brief Derivative of the target that the average closed loop is targeting.
364 *
365 * \details This is the change in the closed loop reference. This may
366 * be used in the feed-forward calculation, the derivative-error, or
367 * in application of the signage for kS. Typically, this represents
368 * the target velocity during Motion Magic®.
369 *
370 * This refreshes and returns a cached StatusSignal object.
371 *
372 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
373 * \returns ClosedLoopReferenceSlope Status Signal object
374 */
376 {
377 return _diffLeaderFX->GetClosedLoopReferenceSlope(refresh);
378 }
379
380 /**
381 * \brief The difference between target average reference and current
382 * measurement.
383 *
384 * \details This is the value that is treated as the error in the PID
385 * loop.
386 *
387 * This refreshes and returns a cached StatusSignal object.
388 *
389 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
390 * \returns ClosedLoopError Status Signal object
391 */
393 {
394 return _diffLeaderFX->GetClosedLoopError(refresh);
395 }
396
397 /**
398 * \brief Value that the differential closed loop is targeting.
399 *
400 * \details This is the value that the differential closed loop PID
401 * controller targets (on the difference axis).
402 *
403 * This refreshes and returns a cached StatusSignal object.
404 *
405 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
406 * \returns DifferentialClosedLoopReference Status Signal object
407 */
409 {
410 return _diffLeaderFX->GetDifferentialClosedLoopReference(refresh);
411 }
412
413 /**
414 * \brief Derivative of the target that the differential closed loop
415 * is targeting.
416 *
417 * \details This is the change in the closed loop reference (on the
418 * difference axis). This may be used in the feed-forward calculation,
419 * the derivative-error, or in application of the signage for kS.
420 * Typically, this represents the target velocity during Motion
421 * Magic®.
422 *
423 * This refreshes and returns a cached StatusSignal object.
424 *
425 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
426 * \returns DifferentialClosedLoopReferenceSlope Status Signal object
427 */
429 {
430 return _diffLeaderFX->GetDifferentialClosedLoopReferenceSlope(refresh);
431 }
432
433 /**
434 * \brief The difference between target differential reference and
435 * current measurement.
436 *
437 * \details This is the value that is treated as the error in the
438 * differential PID loop (on the difference axis).
439 *
440 * This refreshes and returns a cached StatusSignal object.
441 *
442 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
443 * \returns DifferentialClosedLoopError Status Signal object
444 */
446 {
447 return _diffLeaderFX->GetDifferentialClosedLoopError(refresh);
448 }
449
450 /**
451 * \brief Sets the position of the mechanism in rotations.
452 *
453 * \param avgPosition The average position of the mechanism, in rotations
454 * \param diffPosition The differential position of the mechanism, in rotations
455 * \param timeoutSeconds Maximum time to wait up to in seconds
456 * \returns StatusCode of the set command
457 */
458 ctre::phoenix::StatusCode SetPosition(wpi::units::turn_t avgPosition, wpi::units::turn_t diffPosition = 0_tr, wpi::units::second_t timeoutSeconds = 0.100_s)
459 {
461
462 auto response = _diffLeaderFX->SetPosition(avgPosition + diffPosition * _sensorToDiffRatio, timeoutSeconds);
463 if (retval.IsOK()) retval = response;
464 response = _diffFollowerFX->SetPosition(avgPosition - diffPosition * _sensorToDiffRatio, timeoutSeconds);
465 if (retval.IsOK()) retval = response;
466
467 return retval;
468 }
469
470 /**
471 * \brief Get the Talon FX that is differential leader. The differential
472 * leader calculates the output for the differential follower. The differential
473 * leader is also used for fault detection, and it reports status signals for
474 * the differential controller.
475 *
476 * \returns Differential leader Talon FX
477 */
478 MotorT &GetLeader()
479 {
480 return *_diffLeaderFX;
481 }
482 /**
483 * \brief Get the Talon FX that is differential leader. The differential
484 * leader calculates the output for the differential follower. The differential
485 * leader is also useful for fault detection, and it reports status signals for
486 * the differential controller.
487 *
488 * \returns Differential leader Talon FX
489 */
490 MotorT const &GetLeader() const
491 {
492 return *_diffLeaderFX;
493 }
494
495 /**
496 * \brief Get the Talon FX that is differential follower. The differential
497 * follower's position and velocity are used by the differential leader
498 * for the differential controller.
499 *
500 * \returns Differential follower Talon FX
501 */
502 MotorT &GetFollower()
503 {
504 return *_diffFollowerFX;
505 }
506 /**
507 * \brief Get the Talon FX that is differential follower. The differential
508 * follower's position and velocity are used by the differential leader
509 * for the differential controller.
510 *
511 * \returns Differential follower Talon FX
512 */
513 MotorT const &GetFollower() const
514 {
515 return *_diffFollowerFX;
516 }
517
518 /**
519 * \brief Request neutral output of mechanism. The applied brake type
520 * is determined by the NeutralMode configuration of each device.
521 *
522 * \details Since the NeutralMode configuration of devices may not align, users
523 * may prefer to use the \c SetCoastOut() or \c SetStaticBrake() method.
524 *
525 * \returns Status Code of the request.
526 */
528
529 /**
530 * \brief Request coast neutral output of mechanism. The bridge is
531 * disabled and the rotor is allowed to coast.
532 *
533 * \returns Status Code of the request.
534 */
536
537 /**
538 * \brief Applies full neutral-brake on the mechanism by shorting
539 * motor leads together.
540 *
541 * \returns Status Code of the request.
542 */
544
545 /**
546 * \brief Sets the control request for this mechanism.
547 *
548 * \param AverageRequest Average DutyCycleOut request of the mechanism.
549 * \param DifferentialRequest Differential PositionDutyCycle request of the
550 * mechanism. Note: The UpdateFreqHz parameter for
551 * this control request will be ignored by the
552 * control frame.
553 * \returns Status code of the request
554 */
556 /**
557 * \brief Sets the control request for this mechanism.
558 *
559 * \param AverageRequest Average PositionDutyCycle request of the mechanism.
560 * \param DifferentialRequest Differential PositionDutyCycle request of the
561 * mechanism. Note: The UpdateFreqHz parameter for
562 * this control request will be ignored by the
563 * control frame.
564 * \returns Status code of the request
565 */
567 /**
568 * \brief Sets the control request for this mechanism.
569 *
570 * \param AverageRequest Average VelocityDutyCYcle request of the mechanism.
571 * \param DifferentialRequest Differential PositionDutyCycle request of the
572 * mechanism. Note: The UpdateFreqHz parameter for
573 * this control request will be ignored by the
574 * control frame.
575 * \returns Status code of the request
576 */
578 /**
579 * \brief Sets the control request for this mechanism.
580 *
581 * \param AverageRequest Average MotionMagicDutyCycle request of the mechanism.
582 * \param DifferentialRequest Differential PositionDutyCycle request of the
583 * mechanism. Note: The UpdateFreqHz parameter for
584 * this control request will be ignored by the
585 * control frame.
586 * \returns Status code of the request
587 */
589 /**
590 * \brief Sets the control request for this mechanism.
591 *
592 * \param AverageRequest Average MotionMagicExpoDutyCycle request of the
593 * mechanism.
594 * \param DifferentialRequest Differential PositionDutyCycle request of the
595 * mechanism. Note: The UpdateFreqHz parameter for
596 * this control request will be ignored by the
597 * control frame.
598 * \returns Status code of the request
599 */
601 /**
602 * \brief Sets the control request for this mechanism.
603 *
604 * \param AverageRequest Average MotionMagicVelocityDutyCycle request of the
605 * mechanism.
606 * \param DifferentialRequest Differential PositionDutyCycle request of the
607 * mechanism. Note: The UpdateFreqHz parameter for
608 * this control request will be ignored by the
609 * control frame.
610 * \returns Status code of the request
611 */
613 /**
614 * \brief Sets the control request for this mechanism.
615 *
616 * \param AverageRequest Average DutyCycleOut request of the mechanism.
617 * \param DifferentialRequest Differential VelocityDutyCycle request of the
618 * mechanism. Note: The UpdateFreqHz parameter for
619 * this control request will be ignored by the
620 * control frame.
621 * \returns Status code of the request
622 */
624 /**
625 * \brief Sets the control request for this mechanism.
626 *
627 * \param AverageRequest Average PositionDutyCycle request of the mechanism.
628 * \param DifferentialRequest Differential VelocityDutyCycle request of the
629 * mechanism. Note: The UpdateFreqHz parameter for
630 * this control request will be ignored by the
631 * control frame.
632 * \returns Status code of the request
633 */
635 /**
636 * \brief Sets the control request for this mechanism.
637 *
638 * \param AverageRequest Average VelocityDutyCycle request of the mechanism.
639 * \param DifferentialRequest Differential VelocityDutyCycle request of the
640 * mechanism. Note: The UpdateFreqHz parameter for
641 * this control request will be ignored by the
642 * control frame.
643 * \returns Status code of the request
644 */
646 /**
647 * \brief Sets the control request for this mechanism.
648 *
649 * \param AverageRequest Average MotionMagicDutyCycle request of the mechanism.
650 * \param DifferentialRequest Differential VelocityDutyCycle request of the
651 * mechanism. Note: The UpdateFreqHz parameter for
652 * this control request will be ignored by the
653 * control frame.
654 * \returns Status code of the request
655 */
657 /**
658 * \brief Sets the control request for this mechanism.
659 *
660 * \param AverageRequest Average MotionMagicExpoDutyCycle request of the
661 * mechanism.
662 * \param DifferentialRequest Differential VelocityDutyCycle request of the
663 * mechanism. Note: The UpdateFreqHz parameter for
664 * this control request will be ignored by the
665 * control frame.
666 * \returns Status code of the request
667 */
669 /**
670 * \brief Sets the control request for this mechanism.
671 *
672 * \param AverageRequest Average MotionMagicVelocityDutyCycle request of the
673 * mechanism.
674 * \param DifferentialRequest Differential VelocityDutyCycle request of the
675 * mechanism. Note: The UpdateFreqHz parameter for
676 * this control request will be ignored by the
677 * control frame.
678 * \returns Status code of the request
679 */
681 /**
682 * \brief Sets the control request for this mechanism.
683 *
684 * \param AverageRequest Average DutyCycleOut request of the mechanism.
685 * \param DifferentialRequest Differential DutyCycleOut request of the
686 * mechanism. Note: The UpdateFreqHz parameter for
687 * this control request will be ignored by the
688 * control frame.
689 * \returns Status code of the request
690 */
692 /**
693 * \brief Sets the control request for this mechanism.
694 *
695 * \param AverageRequest Average PositionDutyCycle request of the mechanism.
696 * \param DifferentialRequest Differential DutyCycleOut request of the
697 * mechanism. Note: The UpdateFreqHz parameter for
698 * this control request will be ignored by the
699 * control frame.
700 * \returns Status code of the request
701 */
703 /**
704 * \brief Sets the control request for this mechanism.
705 *
706 * \param AverageRequest Average VelocityDutyCYcle request of the mechanism.
707 * \param DifferentialRequest Differential DutyCycleOut request of the
708 * mechanism. Note: The UpdateFreqHz parameter for
709 * this control request will be ignored by the
710 * control frame.
711 * \returns Status code of the request
712 */
714 /**
715 * \brief Sets the control request for this mechanism.
716 *
717 * \param AverageRequest Average MotionMagicDutyCycle request of the mechanism.
718 * \param DifferentialRequest Differential DutyCycleOut request of the
719 * mechanism. Note: The UpdateFreqHz parameter for
720 * this control request will be ignored by the
721 * control frame.
722 * \returns Status code of the request
723 */
725 /**
726 * \brief Sets the control request for this mechanism.
727 *
728 * \param AverageRequest Average MotionMagicExpoDutyCycle request of the
729 * mechanism.
730 * \param DifferentialRequest Differential DutyCycleOut request of the
731 * mechanism. Note: The UpdateFreqHz parameter for
732 * this control request will be ignored by the
733 * control frame.
734 * \returns Status code of the request
735 */
737 /**
738 * \brief Sets the control request for this mechanism.
739 *
740 * \param AverageRequest Average MotionMagicVelocityDutyCycle request of the
741 * mechanism.
742 * \param DifferentialRequest Differential DutyCycleOut request of the
743 * mechanism. Note: The UpdateFreqHz parameter for
744 * this control request will be ignored by the
745 * control frame.
746 * \returns Status code of the request
747 */
749 /**
750 * \brief Sets the control request for this mechanism.
751 *
752 * \param AverageRequest Average VoltageOut request of the mechanism.
753 * \param DifferentialRequest Differential PositionVoltage request of the
754 * mechanism. Note: The UpdateFreqHz parameter for
755 * this control request will be ignored by the
756 * control frame.
757 * \returns Status code of the request
758 */
760 /**
761 * \brief Sets the control request for this mechanism.
762 *
763 * \param AverageRequest Average PositionVoltage request of the mechanism.
764 * \param DifferentialRequest Differential PositionVoltage request of the
765 * mechanism. Note: The UpdateFreqHz parameter for
766 * this control request will be ignored by the
767 * control frame.
768 * \returns Status code of the request
769 */
771 /**
772 * \brief Sets the control request for this mechanism.
773 *
774 * \param AverageRequest Average VelocityVoltage request of the mechanism.
775 * \param DifferentialRequest Differential PositionVoltage request of the
776 * mechanism. Note: The UpdateFreqHz parameter for
777 * this control request will be ignored by the
778 * control frame.
779 * \returns Status code of the request
780 */
782 /**
783 * \brief Sets the control request for this mechanism.
784 *
785 * \param AverageRequest Average MotionMagicVoltage request of the mechanism.
786 * \param DifferentialRequest Differential PositionVoltage request of the
787 * mechanism. Note: The UpdateFreqHz parameter for
788 * this control request will be ignored by the
789 * control frame.
790 * \returns Status code of the request
791 */
793 /**
794 * \brief Sets the control request for this mechanism.
795 *
796 * \param AverageRequest Average MotionMagicExpoVoltage request of the
797 * mechanism.
798 * \param DifferentialRequest Differential PositionVoltage request of the
799 * mechanism. Note: The UpdateFreqHz parameter for
800 * this control request will be ignored by the
801 * control frame.
802 * \returns Status code of the request
803 */
805 /**
806 * \brief Sets the control request for this mechanism.
807 *
808 * \param AverageRequest Average MotionMagicVelocityVoltage request of the
809 * mechanism.
810 * \param DifferentialRequest Differential PositionVoltage request of the
811 * mechanism. Note: The UpdateFreqHz parameter for
812 * this control request will be ignored by the
813 * control frame.
814 * \returns Status code of the request
815 */
817 /**
818 * \brief Sets the control request for this mechanism.
819 *
820 * \param AverageRequest Average VoltageOut request of the mechanism.
821 * \param DifferentialRequest Differential VelocityVoltage request of the
822 * mechanism. Note: The UpdateFreqHz parameter for
823 * this control request will be ignored by the
824 * control frame.
825 * \returns Status code of the request
826 */
828 /**
829 * \brief Sets the control request for this mechanism.
830 *
831 * \param AverageRequest Average PositionVoltage request of the mechanism.
832 * \param DifferentialRequest Differential VelocityVoltage request of the
833 * mechanism. Note: The UpdateFreqHz parameter for
834 * this control request will be ignored by the
835 * control frame.
836 * \returns Status code of the request
837 */
839 /**
840 * \brief Sets the control request for this mechanism.
841 *
842 * \param AverageRequest Average VelocityVoltage request of the mechanism.
843 * \param DifferentialRequest Differential VelocityVoltage request of the
844 * mechanism. Note: The UpdateFreqHz parameter for
845 * this control request will be ignored by the
846 * control frame.
847 * \returns Status code of the request
848 */
850 /**
851 * \brief Sets the control request for this mechanism.
852 *
853 * \param AverageRequest Average MotionMagicVoltage request of the mechanism.
854 * \param DifferentialRequest Differential VelocityVoltage request of the
855 * mechanism. Note: The UpdateFreqHz parameter for
856 * this control request will be ignored by the
857 * control frame.
858 * \returns Status code of the request
859 */
861 /**
862 * \brief Sets the control request for this mechanism.
863 *
864 * \param AverageRequest Average MotionMagicExpoVoltage request of the
865 * mechanism.
866 * \param DifferentialRequest Differential VelocityVoltage request of the
867 * mechanism. Note: The UpdateFreqHz parameter for
868 * this control request will be ignored by the
869 * control frame.
870 * \returns Status code of the request
871 */
873 /**
874 * \brief Sets the control request for this mechanism.
875 *
876 * \param AverageRequest Average MotionMagicVelocityVoltage request of the
877 * mechanism.
878 * \param DifferentialRequest Differential VelocityVoltage request of the
879 * mechanism. Note: The UpdateFreqHz parameter for
880 * this control request will be ignored by the
881 * control frame.
882 * \returns Status code of the request
883 */
885 /**
886 * \brief Sets the control request for this mechanism.
887 *
888 * \param AverageRequest Average VoltageOut request of the mechanism.
889 * \param DifferentialRequest Differential VoltageOut request of the mechanism.
890 * Note: The UpdateFreqHz parameter for this control
891 * request will be ignored by the control frame.
892 * \returns Status code of the request
893 */
895 /**
896 * \brief Sets the control request for this mechanism.
897 *
898 * \param AverageRequest Average PositionVoltage request of the mechanism.
899 * \param DifferentialRequest Differential VoltageOut request of the mechanism.
900 * Note: The UpdateFreqHz parameter for this control
901 * request will be ignored by the control frame.
902 * \returns Status code of the request
903 */
905 /**
906 * \brief Sets the control request for this mechanism.
907 *
908 * \param AverageRequest Average VelocityVoltage request of the mechanism.
909 * \param DifferentialRequest Differential VoltageOut request of the mechanism.
910 * Note: The UpdateFreqHz parameter for this control
911 * request will be ignored by the control frame.
912 * \returns Status code of the request
913 */
915 /**
916 * \brief Sets the control request for this mechanism.
917 *
918 * \param AverageRequest Average MotionMagicVoltage request of the mechanism.
919 * \param DifferentialRequest Differential VoltageOut request of the mechanism.
920 * Note: The UpdateFreqHz parameter for this control
921 * request will be ignored by the control frame.
922 * \returns Status code of the request
923 */
925 /**
926 * \brief Sets the control request for this mechanism.
927 *
928 * \param AverageRequest Average MotionMagicExpoVoltage request of the
929 * mechanism.
930 * \param DifferentialRequest Differential VoltageOut request of the mechanism.
931 * Note: The UpdateFreqHz parameter for this control
932 * request will be ignored by the control frame.
933 * \returns Status code of the request
934 */
936 /**
937 * \brief Sets the control request for this mechanism.
938 *
939 * \param AverageRequest Average MotionMagicVelocityVoltage request of the
940 * mechanism.
941 * \param DifferentialRequest Differential VoltageOut request of the mechanism.
942 * Note: The UpdateFreqHz parameter for this control
943 * request will be ignored by the control frame.
944 * \returns Status code of the request
945 */
947 /**
948 * \brief Sets the control request for this mechanism.
949 *
950 * \param AverageRequest Average TorqueCurrentFOC request of the mechanism.
951 * \param DifferentialRequest Differential PositionTorqueCurrentFOC request of
952 * the mechanism. Note: The UpdateFreqHz parameter
953 * for this control request will be ignored by the
954 * control frame.
955 * \returns Status code of the request
956 */
958 /**
959 * \brief Sets the control request for this mechanism.
960 *
961 * \param AverageRequest Average PositionTorqueCurrentFOC request of the
962 * mechanism.
963 * \param DifferentialRequest Differential PositionTorqueCurrentFOC request of
964 * the mechanism. Note: The UpdateFreqHz parameter
965 * for this control request will be ignored by the
966 * control frame.
967 * \returns Status code of the request
968 */
970 /**
971 * \brief Sets the control request for this mechanism.
972 *
973 * \param AverageRequest Average VelocityTorqueCurrentFOC request of the
974 * mechanism.
975 * \param DifferentialRequest Differential PositionTorqueCurrentFOC request of
976 * the mechanism. Note: The UpdateFreqHz parameter
977 * for this control request will be ignored by the
978 * control frame.
979 * \returns Status code of the request
980 */
982 /**
983 * \brief Sets the control request for this mechanism.
984 *
985 * \param AverageRequest Average MotionMagicTorqueCurrentFOC request of the
986 * mechanism.
987 * \param DifferentialRequest Differential PositionTorqueCurrentFOC request of
988 * the mechanism. Note: The UpdateFreqHz parameter
989 * for this control request will be ignored by the
990 * control frame.
991 * \returns Status code of the request
992 */
994 /**
995 * \brief Sets the control request for this mechanism.
996 *
997 * \param AverageRequest Average MotionMagicExpoTorqueCurrentFOC request of the
998 * mechanism.
999 * \param DifferentialRequest Differential PositionTorqueCurrentFOC request of
1000 * the mechanism. Note: The UpdateFreqHz parameter
1001 * for this control request will be ignored by the
1002 * control frame.
1003 * \returns Status code of the request
1004 */
1006 /**
1007 * \brief Sets the control request for this mechanism.
1008 *
1009 * \param AverageRequest Average MotionMagicVelocityTorqueCurrentFOC request of
1010 * the mechanism.
1011 * \param DifferentialRequest Differential PositionTorqueCurrentFOC request of
1012 * the mechanism. Note: The UpdateFreqHz parameter
1013 * for this control request will be ignored by the
1014 * control frame.
1015 * \returns Status code of the request
1016 */
1018 /**
1019 * \brief Sets the control request for this mechanism.
1020 *
1021 * \param AverageRequest Average TorqueCurrentFOC request of the mechanism.
1022 * \param DifferentialRequest Differential VelocityTorqueCurrentFOC request of
1023 * the mechanism. Note: The UpdateFreqHz parameter
1024 * for this control request will be ignored by the
1025 * control frame.
1026 * \returns Status code of the request
1027 */
1029 /**
1030 * \brief Sets the control request for this mechanism.
1031 *
1032 * \param AverageRequest Average PositionTorqueCurrentFOC request of the
1033 * mechanism.
1034 * \param DifferentialRequest Differential VelocityTorqueCurrentFOC request of
1035 * the mechanism. Note: The UpdateFreqHz parameter
1036 * for this control request will be ignored by the
1037 * control frame.
1038 * \returns Status code of the request
1039 */
1041 /**
1042 * \brief Sets the control request for this mechanism.
1043 *
1044 * \param AverageRequest Average VelocityTorqueCurrentFOC request of the
1045 * mechanism.
1046 * \param DifferentialRequest Differential VelocityTorqueCurrentFOC request of
1047 * the mechanism. Note: The UpdateFreqHz parameter
1048 * for this control request will be ignored by the
1049 * control frame.
1050 * \returns Status code of the request
1051 */
1053 /**
1054 * \brief Sets the control request for this mechanism.
1055 *
1056 * \param AverageRequest Average MotionMagicTorqueCurrentFOC request of the
1057 * mechanism.
1058 * \param DifferentialRequest Differential VelocityTorqueCurrentFOC request of
1059 * the mechanism. Note: The UpdateFreqHz parameter
1060 * for this control request will be ignored by the
1061 * control frame.
1062 * \returns Status code of the request
1063 */
1065 /**
1066 * \brief Sets the control request for this mechanism.
1067 *
1068 * \param AverageRequest Average MotionMagicExpoTorqueCurrentFOC request of the
1069 * mechanism.
1070 * \param DifferentialRequest Differential VelocityTorqueCurrentFOC request of
1071 * the mechanism. Note: The UpdateFreqHz parameter
1072 * for this control request will be ignored by the
1073 * control frame.
1074 * \returns Status code of the request
1075 */
1077 /**
1078 * \brief Sets the control request for this mechanism.
1079 *
1080 * \param AverageRequest Average MotionMagicVelocityTorqueCurrentFOC request of
1081 * the mechanism.
1082 * \param DifferentialRequest Differential VelocityTorqueCurrentFOC request of
1083 * the mechanism. Note: The UpdateFreqHz parameter
1084 * for this control request will be ignored by the
1085 * control frame.
1086 * \returns Status code of the request
1087 */
1089 /**
1090 * \brief Sets the control request for this mechanism.
1091 *
1092 * \param AverageRequest Average TorqueCurrentFOC request of the mechanism.
1093 * \param DifferentialRequest Differential TorqueCurrentFOC request of the
1094 * mechanism. Note: The UpdateFreqHz parameter for
1095 * this control request will be ignored by the
1096 * control frame.
1097 * \returns Status code of the request
1098 */
1100 /**
1101 * \brief Sets the control request for this mechanism.
1102 *
1103 * \param AverageRequest Average PositionTorqueCurrentFOC request of the
1104 * mechanism.
1105 * \param DifferentialRequest Differential TorqueCurrentFOC request of the
1106 * mechanism. Note: The UpdateFreqHz parameter for
1107 * this control request will be ignored by the
1108 * control frame.
1109 * \returns Status code of the request
1110 */
1112 /**
1113 * \brief Sets the control request for this mechanism.
1114 *
1115 * \param AverageRequest Average VelocityTorqueCurrentFOC request of the
1116 * mechanism.
1117 * \param DifferentialRequest Differential TorqueCurrentFOC request of the
1118 * mechanism. Note: The UpdateFreqHz parameter for
1119 * this control request will be ignored by the
1120 * control frame.
1121 * \returns Status code of the request
1122 */
1124 /**
1125 * \brief Sets the control request for this mechanism.
1126 *
1127 * \param AverageRequest Average MotionMagicTorqueCurrentFOC request of the
1128 * mechanism.
1129 * \param DifferentialRequest Differential TorqueCurrentFOC request of the
1130 * mechanism. Note: The UpdateFreqHz parameter for
1131 * this control request will be ignored by the
1132 * control frame.
1133 * \returns Status code of the request
1134 */
1136 /**
1137 * \brief Sets the control request for this mechanism.
1138 *
1139 * \param AverageRequest Average MotionMagicExpoTorqueCurrentFOC request of the
1140 * mechanism.
1141 * \param DifferentialRequest Differential TorqueCurrentFOC request of the
1142 * mechanism. Note: The UpdateFreqHz parameter for
1143 * this control request will be ignored by the
1144 * control frame.
1145 * \returns Status code of the request
1146 */
1148 /**
1149 * \brief Sets the control request for this mechanism.
1150 *
1151 * \param AverageRequest Average MotionMagicVelocityTorqueCurrentFOC request of
1152 * the mechanism.
1153 * \param DifferentialRequest Differential TorqueCurrentFOC request of the
1154 * mechanism. Note: The UpdateFreqHz parameter for
1155 * this control request will be ignored by the
1156 * control frame.
1157 * \returns Status code of the request
1158 */
1160};
1161
1162}
1163}
1164}
Represents a status signal with data of type T, and operations available to retrieve information abou...
Definition StatusSignal.hpp:523
Follow the differential motor output of another Talon.
Definition DifferentialFollower.hpp:29
Request a specified motor duty cycle.
Definition DutyCycleOut.hpp:23
Requests Motion Magic® to target a final position using a motion profile.
Definition MotionMagicDutyCycle.hpp:31
Requests Motion Magic® to target a final position using an exponential motion profile.
Definition MotionMagicExpoDutyCycle.hpp:34
Requires Phoenix Pro; Requests Motion Magic® to target a final position using an exponential motion p...
Definition MotionMagicExpoTorqueCurrentFOC.hpp:34
Requests Motion Magic® to target a final position using an exponential motion profile.
Definition MotionMagicExpoVoltage.hpp:33
Requires Phoenix Pro; Requests Motion Magic® to target a final position using a motion profile.
Definition MotionMagicTorqueCurrentFOC.hpp:31
Requests Motion Magic® to target a final velocity using a motion profile.
Definition MotionMagicVelocityDutyCycle.hpp:38
Requests Motion Magic® to target a final velocity using a motion profile.
Definition MotionMagicVelocityTorqueCurrentFOC.hpp:38
Requests Motion Magic® to target a final velocity using a motion profile.
Definition MotionMagicVelocityVoltage.hpp:37
Requests Motion Magic® to target a final position using a motion profile.
Definition MotionMagicVoltage.hpp:30
Request neutral output of actuator.
Definition NeutralOut.hpp:21
Request PID to target position with duty cycle feedforward.
Definition PositionDutyCycle.hpp:26
Requires Phoenix Pro; Request PID to target position with torque current feedforward.
Definition PositionTorqueCurrentFOC.hpp:27
Request PID to target position with voltage feedforward.
Definition PositionVoltage.hpp:26
Requires Phoenix Pro; Request a specified motor current (field oriented control).
Definition TorqueCurrentFOC.hpp:27
Request PID to target velocity with duty cycle feedforward.
Definition VelocityDutyCycle.hpp:26
Requires Phoenix Pro; Request PID to target velocity with torque current feedforward.
Definition VelocityTorqueCurrentFOC.hpp:27
Request PID to target velocity with voltage feedforward.
Definition VelocityVoltage.hpp:26
Request a specified voltage.
Definition VoltageOut.hpp:24
Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along w...
Definition CANcoder.hpp:27
Class for CTR Electronics' CANdi™ branded device, a device that integrates digital signals into the e...
Definition CANdi.hpp:26
Class description for the Pigeon 2 IMU sensor that measures orientation.
Definition Pigeon2.hpp:28
ctre::phoenix::StatusCode SetControl(controls::PositionVoltage AverageRequest, controls::PositionVoltage DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::PositionTorqueCurrentFOC AverageRequest, controls::PositionTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::VelocityVoltage AverageRequest, controls::VoltageOut DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::PositionVoltage AverageRequest, controls::VoltageOut DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::DutyCycleOut AverageRequest, controls::DutyCycleOut DifferentialRequest)
Sets the control request for this mechanism.
StatusSignal< wpi::units::turns_per_second_t > & GetDifferentialVelocity(bool refresh=true)
Differential component of the mechanism velocity.
Definition DifferentialMechanism.hpp:341
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVelocityVoltage AverageRequest, controls::VoltageOut DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVoltage AverageRequest, controls::VelocityVoltage DifferentialRequest)
Sets the control request for this mechanism.
StatusSignal< double > & GetDifferentialClosedLoopReference(bool refresh=true)
Value that the differential closed loop is targeting.
Definition DifferentialMechanism.hpp:408
ctre::phoenix::StatusCode SetPosition(wpi::units::turn_t avgPosition, wpi::units::turn_t diffPosition=0_tr, wpi::units::second_t timeoutSeconds=0.100_s)
Sets the position of the mechanism in rotations.
Definition DifferentialMechanism.hpp:458
DisabledReasonValue
Possible reasons for the mechanism to disable.
Definition DifferentialMechanism.hpp:58
@ RemoteSensorPosOverflow
A remote sensor position has overflowed.
Definition DifferentialMechanism.hpp:79
@ None
No reason given.
Definition DifferentialMechanism.hpp:62
@ MissingDifferentialFX
The remote Talon FX used for differential control is not present on CAN Bus.
Definition DifferentialMechanism.hpp:71
@ DeviceHasReset
A device or remote sensor has reset.
Definition DifferentialMechanism.hpp:83
@ MissingRemoteSensor
A remote sensor is not present on CAN Bus.
Definition DifferentialMechanism.hpp:66
DifferentialMechanism(DifferentialMotorConstants< typename MotorT::Configuration > const &constants)
Creates a new differential mechanism using two hardware::traits::CommonTalon devices.
ctre::phoenix::StatusCode SetControl(controls::DutyCycleOut AverageRequest, controls::VelocityDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
RequiresUserReasonValue GetRequiresUserReason() const
Definition DifferentialMechanism.hpp:269
ctre::phoenix::StatusCode SetControl(controls::VoltageOut AverageRequest, controls::PositionVoltage DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicExpoVoltage AverageRequest, controls::PositionVoltage DifferentialRequest)
Sets the control request for this mechanism.
void ClearUserRequirement()
Indicate to the mechanism that the user has performed the required action to resume mechanism control...
ctre::phoenix::StatusCode SetControl(controls::VoltageOut AverageRequest, controls::VelocityVoltage DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicTorqueCurrentFOC AverageRequest, controls::PositionTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicExpoVoltage AverageRequest, controls::VoltageOut DifferentialRequest)
Sets the control request for this mechanism.
StatusSignal< wpi::units::turn_t > & GetAveragePosition(bool refresh=true)
Average component of the mechanism position.
Definition DifferentialMechanism.hpp:287
ctre::phoenix::StatusCode SetControl(controls::MotionMagicExpoTorqueCurrentFOC AverageRequest, controls::PositionTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::TorqueCurrentFOC AverageRequest, controls::PositionTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVelocityDutyCycle AverageRequest, controls::VelocityDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
bool IsDisabled() const
Get whether the mechanism is currently disabled due to an issue.
Definition DifferentialMechanism.hpp:219
ctre::phoenix::StatusCode SetControl(controls::TorqueCurrentFOC AverageRequest, controls::TorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
StatusSignal< wpi::units::turn_t > & GetDifferentialPosition(bool refresh=true)
Differential component of the mechanism position.
Definition DifferentialMechanism.hpp:323
ctre::phoenix::StatusCode SetControl(controls::PositionTorqueCurrentFOC AverageRequest, controls::TorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicDutyCycle AverageRequest, controls::PositionDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicTorqueCurrentFOC AverageRequest, controls::VelocityTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
DisabledReasonValue GetDisabledReason() const
Definition DifferentialMechanism.hpp:261
MotorT const & GetFollower() const
Get the Talon FX that is differential follower.
Definition DifferentialMechanism.hpp:513
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVelocityDutyCycle AverageRequest, controls::DutyCycleOut DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicExpoTorqueCurrentFOC AverageRequest, controls::TorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetNeutralOut()
Request neutral output of mechanism.
ctre::phoenix::StatusCode SetControl(controls::PositionTorqueCurrentFOC AverageRequest, controls::VelocityTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVelocityDutyCycle AverageRequest, controls::PositionDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::TorqueCurrentFOC AverageRequest, controls::VelocityTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
StatusSignal< double > & GetDifferentialClosedLoopReferenceSlope(bool refresh=true)
Derivative of the target that the differential closed loop is targeting.
Definition DifferentialMechanism.hpp:428
ctre::phoenix::StatusCode SetControl(controls::VelocityTorqueCurrentFOC AverageRequest, controls::TorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::VelocityVoltage AverageRequest, controls::PositionVoltage DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVelocityTorqueCurrentFOC AverageRequest, controls::PositionTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVoltage AverageRequest, controls::PositionVoltage DifferentialRequest)
Sets the control request for this mechanism.
MechanismState GetMechanismState() const
Gets the state of the mechanism.
Definition DifferentialMechanism.hpp:241
ctre::phoenix::StatusCode SetControl(controls::PositionDutyCycle AverageRequest, controls::PositionDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode ConfigNeutralMode(signals::NeutralModeValue neutralMode, wpi::units::second_t timeoutSeconds=100_ms)
Configures the neutral mode to use for both motors in the mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVelocityVoltage AverageRequest, controls::VelocityVoltage DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVelocityVoltage AverageRequest, controls::PositionVoltage DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVelocityTorqueCurrentFOC AverageRequest, controls::VelocityTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVoltage AverageRequest, controls::VoltageOut DifferentialRequest)
Sets the control request for this mechanism.
void Periodic()
Call this method periodically to automatically protect against dangerous fault conditions and keep Ge...
ctre::phoenix::StatusCode SetControl(controls::PositionDutyCycle AverageRequest, controls::VelocityDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::PositionVoltage AverageRequest, controls::VelocityVoltage DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::VelocityDutyCycle AverageRequest, controls::DutyCycleOut DifferentialRequest)
Sets the control request for this mechanism.
StatusSignal< double > & GetAverageClosedLoopReference(bool refresh=true)
Value that the average closed loop is targeting.
Definition DifferentialMechanism.hpp:357
RequiresUserReasonValue
Possible reasons for the mechanism to require user action to resume control.
Definition DifferentialMechanism.hpp:90
@ None
No reason given.
Definition DifferentialMechanism.hpp:94
ctre::phoenix::StatusCode SetControl(controls::MotionMagicExpoDutyCycle AverageRequest, controls::VelocityDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::DutyCycleOut AverageRequest, controls::PositionDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicTorqueCurrentFOC AverageRequest, controls::TorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
MotorT & GetFollower()
Get the Talon FX that is differential follower.
Definition DifferentialMechanism.hpp:502
ctre::phoenix::StatusCode SetCoastOut()
Request coast neutral output of mechanism.
ctre::phoenix::StatusCode SetControl(controls::VelocityVoltage AverageRequest, controls::VelocityVoltage DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::PositionDutyCycle AverageRequest, controls::DutyCycleOut DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetStaticBrake()
Applies full neutral-brake on the mechanism by shorting motor leads together.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicExpoDutyCycle AverageRequest, controls::PositionDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
DifferentialMechanism(DifferentialMotorConstants< typename MotorT::Configuration > const &constants, hardware::CANcoder &cancoder)
Creates a new differential mechanism using two hardware::traits::CommonTalon devices and a hardware::...
bool RequiresUserAction() const
Get whether the mechanism is currently disabled and requires user action to re-enable mechanism contr...
Definition DifferentialMechanism.hpp:231
ctre::phoenix::StatusCode SetControl(controls::VelocityTorqueCurrentFOC AverageRequest, controls::VelocityTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::VelocityDutyCycle AverageRequest, controls::PositionDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
DifferentialMechanism(DifferentialMotorConstants< typename MotorT::Configuration > const &constants, hardware::Pigeon2 &pigeon2, DifferentialPigeon2Source pigeonSource)
Creates a new differential mechanism using two hardware::traits::CommonTalon devices and a hardware::...
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVelocityTorqueCurrentFOC AverageRequest, controls::TorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::VelocityTorqueCurrentFOC AverageRequest, controls::PositionTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
DifferentialMechanism(DifferentialMotorConstants< typename MotorT::Configuration > const &constants, hardware::CANdi &candi, DifferentialCANdiSource candiSource)
Creates a new differential mechanism using two hardware::traits::CommonTalon devices and a hardware::...
MotorT & GetLeader()
Get the Talon FX that is differential leader.
Definition DifferentialMechanism.hpp:478
MotorT const & GetLeader() const
Get the Talon FX that is differential leader.
Definition DifferentialMechanism.hpp:490
ctre::phoenix::StatusCode SetControl(controls::MotionMagicDutyCycle AverageRequest, controls::VelocityDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicExpoTorqueCurrentFOC AverageRequest, controls::VelocityTorqueCurrentFOC DifferentialRequest)
Sets the control request for this mechanism.
StatusSignal< double > & GetAverageClosedLoopReferenceSlope(bool refresh=true)
Derivative of the target that the average closed loop is targeting.
Definition DifferentialMechanism.hpp:375
ctre::phoenix::StatusCode SetControl(controls::VelocityDutyCycle AverageRequest, controls::VelocityDutyCycle DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicExpoDutyCycle AverageRequest, controls::DutyCycleOut DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicExpoVoltage AverageRequest, controls::VelocityVoltage DifferentialRequest)
Sets the control request for this mechanism.
StatusSignal< double > & GetDifferentialClosedLoopError(bool refresh=true)
The difference between target differential reference and current measurement.
Definition DifferentialMechanism.hpp:445
StatusSignal< double > & GetAverageClosedLoopError(bool refresh=true)
The difference between target average reference and current measurement.
Definition DifferentialMechanism.hpp:392
StatusSignal< wpi::units::turns_per_second_t > & GetAverageVelocity(bool refresh=true)
Average component of the mechanism velocity.
Definition DifferentialMechanism.hpp:305
ctre::phoenix::StatusCode SetControl(controls::MotionMagicDutyCycle AverageRequest, controls::DutyCycleOut DifferentialRequest)
Sets the control request for this mechanism.
ctre::phoenix::StatusCode SetControl(controls::VoltageOut AverageRequest, controls::VoltageOut DifferentialRequest)
Sets the control request for this mechanism.
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
static constexpr int OK
No Error.
Definition StatusCodes.h:35
constexpr bool IsOK() const
Definition StatusCodes.h:860
Definition ExternalFeedbackConfigs.hpp:17
Definition SimpleDifferentialMechanism.hpp:24
DifferentialPigeon2Source
Sensor sources for a differential Pigeon 2.
Definition DifferentialConstants.hpp:20
DifferentialCANdiSource
Sensor sources for a differential CTR Electronics' CANdi™ branded device.
Definition DifferentialConstants.hpp:39
Definition ExternalFeedbackConfigs.hpp:16
MechanismState
Possible states of a mechanism.
Definition MechanismState.hpp:15
@ RequiresUserAction
The mechanism is disabled and requires user action.
Definition MechanismState.hpp:27
@ Disabled
The mechanism is temporarily disabled due to an issue.
Definition MechanismState.hpp:23
@ OK
The mechanism is running normally.
Definition MechanismState.hpp:19
Definition motor_constants.h:14
All constants for setting up the motors of a differential mechanism.
Definition DifferentialConstants.hpp:58
The state of the motor controller bridge when output is neutral or disabled.
Definition SpnEnums.hpp:1499