CTRE Phoenix 6 C++ 26.50.0-alpha-1
Loading...
Searching...
No Matches
ExternalFeedbackConfigs.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
11#include <wpi/units/angle.hpp>
12#include <wpi/units/dimensionless.hpp>
13#include <wpi/units/time.hpp>
14
15namespace ctre {
16namespace phoenix6 {
17namespace hardware::core { class CoreCANcoder; }
18namespace hardware::core { class CoreCANdi; }
19namespace hardware::core { class CorePigeon2; }
20
21namespace configs {
22
23/**
24 * \brief Configs that affect the external feedback sensor of this
25 * motor controller.
26 *
27 * \details Includes feedback sensor source, offsets and sensor phase
28 * for the feedback sensor, and various ratios to describe
29 * the relationship between the sensor and the mechanism for
30 * closed looping.
31 */
33public:
34 constexpr ExternalFeedbackConfigs() = default;
35
36 /**
37 * \brief The ratio of sensor rotations to the mechanism's output,
38 * where a ratio greater than 1 is a reduction.
39 *
40 * This is equivalent to the mechanism's gear ratio if the sensor is
41 * located on the input of a gearbox. If sensor is on the output of a
42 * gearbox, then this is typically set to 1.
43 *
44 * We recommend against using this config to perform onboard unit
45 * conversions. Instead, unit conversions should be performed in
46 * robot code using the units library.
47 *
48 * If this is set to zero, the device will reset back to one.
49 *
50 * - Minimum Value: -1000
51 * - Maximum Value: 1000
52 * - Default Value: 1.0
53 * - Units: scalar
54 */
55 wpi::units::scalar_t SensorToMechanismRatio = 1.0;
56 /**
57 * \brief The ratio of motor rotor rotations to remote sensor
58 * rotations, where a ratio greater than 1 is a reduction.
59 *
60 * The Talon FX is capable of fusing a remote CANcoder with its rotor
61 * sensor to produce a high-bandwidth sensor source. This feature
62 * requires specifying the ratio between the motor rotor and the
63 * remote sensor.
64 *
65 * If this is set to zero, the device will reset back to one.
66 *
67 * - Minimum Value: -1000
68 * - Maximum Value: 1000
69 * - Default Value: 1.0
70 * - Units: scalar
71 */
72 wpi::units::scalar_t RotorToSensorRatio = 1.0;
73 /**
74 * \brief Device ID of which remote device to use. This is not used
75 * if the Sensor Source is the internal rotor sensor.
76 *
77 * - Minimum Value: 0
78 * - Maximum Value: 62
79 * - Default Value: 0
80 * - Units:
81 */
83 /**
84 * \brief The configurable time constant of the Kalman velocity
85 * filter. The velocity Kalman filter will adjust to act as a low-pass
86 * with this value as its time constant.
87 *
88 * \details If the user is aiming for an expected cutoff frequency,
89 * the frequency is calculated as 1 / (2 * π * τ) with τ being the
90 * time constant.
91 *
92 * - Minimum Value: 0
93 * - Maximum Value: 1
94 * - Default Value: 0
95 * - Units: seconds
96 */
97 wpi::units::second_t VelocityFilterTimeConstant = 0_s;
98 /**
99 * \brief The offset added to any absolute sensor connected to the
100 * Talon data port. This is only supported when using the PulseWidth
101 * sensor source.
102 *
103 * This can be used to zero the sensor position in applications where
104 * the sensor is 1:1 with the mechanism.
105 *
106 * - Minimum Value: -1
107 * - Maximum Value: 1
108 * - Default Value: 0.0
109 * - Units: rotations
110 */
111 wpi::units::turn_t AbsoluteSensorOffset = 0.0_tr;
112 /**
113 * \brief Choose what sensor source is reported via API and used by
114 * closed-loop and limit features. The default is Commutation, which
115 * uses the external sensor used for motor commutation.
116 *
117 * Choose Remote* to use another sensor on the same CAN bus (this also
118 * requires setting FeedbackRemoteSensorID). Talon will update its
119 * position and velocity whenever the remote sensor publishes its
120 * information on CAN bus, and the Talon commutation sensor will not
121 * be used.
122 *
123 * Choose Fused* (requires Phoenix Pro) and Talon will fuse another
124 * sensor's information with the commutation sensor, which provides
125 * the best possible position and velocity for accuracy and bandwidth
126 * (this also requires setting FeedbackRemoteSensorID). This was
127 * developed for applications such as swerve-azimuth.
128 *
129 * Choose Sync* (requires Phoenix Pro) and Talon will synchronize its
130 * commutation sensor position against another sensor, then continue
131 * to use the rotor sensor for closed loop control (this also requires
132 * setting FeedbackRemoteSensorID). The Talon will report if its
133 * internal position differs significantly from the reported remote
134 * sensor position. This was developed for mechanisms where there is
135 * a risk of the sensor failing in such a way that it reports a
136 * position that does not match the mechanism, such as the sensor
137 * mounting assembly breaking off.
138 *
139 * Choose RemotePigeon2Yaw, RemotePigeon2Pitch, and RemotePigeon2Roll
140 * to use another Pigeon2 on the same CAN bus (this also requires
141 * setting FeedbackRemoteSensorID). Talon will update its position to
142 * match the selected value whenever Pigeon2 publishes its information
143 * on CAN bus. Note that the Talon position will be in rotations and
144 * not degrees.
145 *
146 * Choose Quadrature to use a quadrature encoder directly attached to
147 * the Talon data port. This provides velocity and relative position
148 * measurements.
149 *
150 * Choose PulseWidth to use a pulse-width encoder directly attached to
151 * the Talon data port. This provides velocity and absolute position
152 * measurements.
153 *
154 * \details Note: When the feedback source is changed to Fused* or
155 * Sync*, the Talon needs a period of time to fuse before sensor-based
156 * (soft-limit, closed loop, etc.) features are used. This period of
157 * time is determined by the update frequency of the remote sensor's
158 * Position signal.
159 *
160 * - Default Value: signals#ExternalFeedbackSensorSourceValue#Commutation
161 */
163 /**
164 * \brief The relationship between the motor controlled by a Talon and
165 * the external sensor connected to the data port. This does not
166 * affect the commutation sensor or remote sensors.
167 *
168 * To determine the sensor phase, set this config to Aligned and drive
169 * the motor with positive output. If the reported sensor velocity is
170 * positive, then the phase is Aligned. If the reported sensor
171 * velocity is negative, then the phase is Opposed.
172 *
173 * The sensor direction is automatically inverted along with motor
174 * invert, so the sensor phase does not need to be changed when motor
175 * invert changes.
176 *
177 * - Default Value: signals#SensorPhaseValue#Aligned
178 */
180 /**
181 * \brief The number of quadrature edges in one rotation for the
182 * quadrature sensor connected to the Talon data port.
183 *
184 * This is the total number of transitions from high-to-low or
185 * low-to-high across both channels per rotation of the sensor. This
186 * is also equivalent to the Counts Per Revolution when using 4x
187 * decoding.
188 *
189 * For example, the SRX Mag Encoder has 4096 edges per rotation, and a
190 * US Digital 1024 CPR (Cycles Per Revolution) quadrature encoder has
191 * 4096 edges per rotation.
192 *
193 * \details On the Talon FXS, this can be at most 2,000,000,000 / Peak
194 * RPM.
195 *
196 * - Minimum Value: 1
197 * - Maximum Value: 1000000
198 * - Default Value: 4096
199 * - Units:
200 */
202 /**
203 * \brief The positive discontinuity point of the absolute sensor in
204 * rotations. This determines the point at which the absolute sensor
205 * wraps around, keeping the absolute position (after offset) in the
206 * range [x-1, x).
207 *
208 * - Setting this to 1 makes the absolute position unsigned [0, 1)
209 * - Setting this to 0.5 makes the absolute position signed [-0.5,
210 * 0.5)
211 * - Setting this to 0 makes the absolute position always negative
212 * [-1, 0)
213 *
214 * Many rotational mechanisms such as arms have a region of motion
215 * that is unreachable. This should be set to the center of that
216 * region of motion, in non-negative rotations. This affects the
217 * position of the device at bootup.
218 *
219 * \details For example, consider an arm which can travel from -0.2 to
220 * 0.6 rotations with a little leeway, where 0 is horizontally
221 * forward. Since -0.2 rotations has the same absolute position as 0.8
222 * rotations, we can say that the arm typically does not travel in the
223 * range (0.6, 0.8) rotations. As a result, the discontinuity point
224 * would be the center of that range, which is 0.7 rotations. This
225 * results in an absolute sensor range of [-0.3, 0.7) rotations.
226 *
227 * Given a total range of motion less than 1 rotation, users can
228 * calculate the discontinuity point using mean(lowerLimit,
229 * upperLimit) + 0.5. If that results in a value outside the range [0,
230 * 1], either cap the value to [0, 1], or add/subtract 1.0 rotation
231 * from your lower and upper limits of motion.
232 *
233 * On a Talon motor controller, this is only supported when using the
234 * PulseWidth sensor source.
235 *
236 * - Minimum Value: 0.0
237 * - Maximum Value: 1.0
238 * - Default Value: 0.5
239 * - Units: rotations
240 */
241 wpi::units::turn_t AbsoluteSensorDiscontinuityPoint = 0.5_tr;
242
243 /**
244 * \brief Modifies this configuration's SensorToMechanismRatio parameter and returns itself for
245 * method-chaining and easier to use config API.
246 *
247 * The ratio of sensor rotations to the mechanism's output, where a
248 * ratio greater than 1 is a reduction.
249 *
250 * This is equivalent to the mechanism's gear ratio if the sensor is
251 * located on the input of a gearbox. If sensor is on the output of a
252 * gearbox, then this is typically set to 1.
253 *
254 * We recommend against using this config to perform onboard unit
255 * conversions. Instead, unit conversions should be performed in
256 * robot code using the units library.
257 *
258 * If this is set to zero, the device will reset back to one.
259 *
260 * - Minimum Value: -1000
261 * - Maximum Value: 1000
262 * - Default Value: 1.0
263 * - Units: scalar
264 *
265 * \param newSensorToMechanismRatio Parameter to modify
266 * \returns Itself
267 */
268 constexpr ExternalFeedbackConfigs &WithSensorToMechanismRatio(wpi::units::scalar_t newSensorToMechanismRatio)
269 {
270 SensorToMechanismRatio = std::move(newSensorToMechanismRatio);
271 return *this;
272 }
273
274 /**
275 * \brief Modifies this configuration's RotorToSensorRatio parameter and returns itself for
276 * method-chaining and easier to use config API.
277 *
278 * The ratio of motor rotor rotations to remote sensor rotations,
279 * where a ratio greater than 1 is a reduction.
280 *
281 * The Talon FX is capable of fusing a remote CANcoder with its rotor
282 * sensor to produce a high-bandwidth sensor source. This feature
283 * requires specifying the ratio between the motor rotor and the
284 * remote sensor.
285 *
286 * If this is set to zero, the device will reset back to one.
287 *
288 * - Minimum Value: -1000
289 * - Maximum Value: 1000
290 * - Default Value: 1.0
291 * - Units: scalar
292 *
293 * \param newRotorToSensorRatio Parameter to modify
294 * \returns Itself
295 */
296 constexpr ExternalFeedbackConfigs &WithRotorToSensorRatio(wpi::units::scalar_t newRotorToSensorRatio)
297 {
298 RotorToSensorRatio = std::move(newRotorToSensorRatio);
299 return *this;
300 }
301
302 /**
303 * \brief Modifies this configuration's FeedbackRemoteSensorID parameter and returns itself for
304 * method-chaining and easier to use config API.
305 *
306 * Device ID of which remote device to use. This is not used if the
307 * Sensor Source is the internal rotor sensor.
308 *
309 * - Minimum Value: 0
310 * - Maximum Value: 62
311 * - Default Value: 0
312 * - Units:
313 *
314 * \param newFeedbackRemoteSensorID Parameter to modify
315 * \returns Itself
316 */
317 constexpr ExternalFeedbackConfigs &WithFeedbackRemoteSensorID(int newFeedbackRemoteSensorID)
318 {
319 FeedbackRemoteSensorID = std::move(newFeedbackRemoteSensorID);
320 return *this;
321 }
322
323 /**
324 * \brief Modifies this configuration's VelocityFilterTimeConstant parameter and returns itself for
325 * method-chaining and easier to use config API.
326 *
327 * The configurable time constant of the Kalman velocity filter. The
328 * velocity Kalman filter will adjust to act as a low-pass with this
329 * value as its time constant.
330 *
331 * \details If the user is aiming for an expected cutoff frequency,
332 * the frequency is calculated as 1 / (2 * π * τ) with τ being the
333 * time constant.
334 *
335 * - Minimum Value: 0
336 * - Maximum Value: 1
337 * - Default Value: 0
338 * - Units: seconds
339 *
340 * \param newVelocityFilterTimeConstant Parameter to modify
341 * \returns Itself
342 */
343 constexpr ExternalFeedbackConfigs &WithVelocityFilterTimeConstant(wpi::units::second_t newVelocityFilterTimeConstant)
344 {
345 VelocityFilterTimeConstant = std::move(newVelocityFilterTimeConstant);
346 return *this;
347 }
348
349 /**
350 * \brief Modifies this configuration's AbsoluteSensorOffset parameter and returns itself for
351 * method-chaining and easier to use config API.
352 *
353 * The offset added to any absolute sensor connected to the Talon data
354 * port. This is only supported when using the PulseWidth sensor
355 * source.
356 *
357 * This can be used to zero the sensor position in applications where
358 * the sensor is 1:1 with the mechanism.
359 *
360 * - Minimum Value: -1
361 * - Maximum Value: 1
362 * - Default Value: 0.0
363 * - Units: rotations
364 *
365 * \param newAbsoluteSensorOffset Parameter to modify
366 * \returns Itself
367 */
368 constexpr ExternalFeedbackConfigs &WithAbsoluteSensorOffset(wpi::units::turn_t newAbsoluteSensorOffset)
369 {
370 AbsoluteSensorOffset = std::move(newAbsoluteSensorOffset);
371 return *this;
372 }
373
374 /**
375 * \brief Modifies this configuration's ExternalFeedbackSensorSource parameter and returns itself for
376 * method-chaining and easier to use config API.
377 *
378 * Choose what sensor source is reported via API and used by
379 * closed-loop and limit features. The default is Commutation, which
380 * uses the external sensor used for motor commutation.
381 *
382 * Choose Remote* to use another sensor on the same CAN bus (this also
383 * requires setting FeedbackRemoteSensorID). Talon will update its
384 * position and velocity whenever the remote sensor publishes its
385 * information on CAN bus, and the Talon commutation sensor will not
386 * be used.
387 *
388 * Choose Fused* (requires Phoenix Pro) and Talon will fuse another
389 * sensor's information with the commutation sensor, which provides
390 * the best possible position and velocity for accuracy and bandwidth
391 * (this also requires setting FeedbackRemoteSensorID). This was
392 * developed for applications such as swerve-azimuth.
393 *
394 * Choose Sync* (requires Phoenix Pro) and Talon will synchronize its
395 * commutation sensor position against another sensor, then continue
396 * to use the rotor sensor for closed loop control (this also requires
397 * setting FeedbackRemoteSensorID). The Talon will report if its
398 * internal position differs significantly from the reported remote
399 * sensor position. This was developed for mechanisms where there is
400 * a risk of the sensor failing in such a way that it reports a
401 * position that does not match the mechanism, such as the sensor
402 * mounting assembly breaking off.
403 *
404 * Choose RemotePigeon2Yaw, RemotePigeon2Pitch, and RemotePigeon2Roll
405 * to use another Pigeon2 on the same CAN bus (this also requires
406 * setting FeedbackRemoteSensorID). Talon will update its position to
407 * match the selected value whenever Pigeon2 publishes its information
408 * on CAN bus. Note that the Talon position will be in rotations and
409 * not degrees.
410 *
411 * Choose Quadrature to use a quadrature encoder directly attached to
412 * the Talon data port. This provides velocity and relative position
413 * measurements.
414 *
415 * Choose PulseWidth to use a pulse-width encoder directly attached to
416 * the Talon data port. This provides velocity and absolute position
417 * measurements.
418 *
419 * \details Note: When the feedback source is changed to Fused* or
420 * Sync*, the Talon needs a period of time to fuse before sensor-based
421 * (soft-limit, closed loop, etc.) features are used. This period of
422 * time is determined by the update frequency of the remote sensor's
423 * Position signal.
424 *
425 * - Default Value: signals#ExternalFeedbackSensorSourceValue#Commutation
426 *
427 * \param newExternalFeedbackSensorSource Parameter to modify
428 * \returns Itself
429 */
431 {
432 ExternalFeedbackSensorSource = std::move(newExternalFeedbackSensorSource);
433 return *this;
434 }
435
436 /**
437 * \brief Modifies this configuration's SensorPhase parameter and returns itself for
438 * method-chaining and easier to use config API.
439 *
440 * The relationship between the motor controlled by a Talon and the
441 * external sensor connected to the data port. This does not affect
442 * the commutation sensor or remote sensors.
443 *
444 * To determine the sensor phase, set this config to Aligned and drive
445 * the motor with positive output. If the reported sensor velocity is
446 * positive, then the phase is Aligned. If the reported sensor
447 * velocity is negative, then the phase is Opposed.
448 *
449 * The sensor direction is automatically inverted along with motor
450 * invert, so the sensor phase does not need to be changed when motor
451 * invert changes.
452 *
453 * - Default Value: signals#SensorPhaseValue#Aligned
454 *
455 * \param newSensorPhase Parameter to modify
456 * \returns Itself
457 */
459 {
460 SensorPhase = std::move(newSensorPhase);
461 return *this;
462 }
463
464 /**
465 * \brief Modifies this configuration's QuadratureEdgesPerRotation parameter and returns itself for
466 * method-chaining and easier to use config API.
467 *
468 * The number of quadrature edges in one rotation for the quadrature
469 * sensor connected to the Talon data port.
470 *
471 * This is the total number of transitions from high-to-low or
472 * low-to-high across both channels per rotation of the sensor. This
473 * is also equivalent to the Counts Per Revolution when using 4x
474 * decoding.
475 *
476 * For example, the SRX Mag Encoder has 4096 edges per rotation, and a
477 * US Digital 1024 CPR (Cycles Per Revolution) quadrature encoder has
478 * 4096 edges per rotation.
479 *
480 * \details On the Talon FXS, this can be at most 2,000,000,000 / Peak
481 * RPM.
482 *
483 * - Minimum Value: 1
484 * - Maximum Value: 1000000
485 * - Default Value: 4096
486 * - Units:
487 *
488 * \param newQuadratureEdgesPerRotation Parameter to modify
489 * \returns Itself
490 */
491 constexpr ExternalFeedbackConfigs &WithQuadratureEdgesPerRotation(int newQuadratureEdgesPerRotation)
492 {
493 QuadratureEdgesPerRotation = std::move(newQuadratureEdgesPerRotation);
494 return *this;
495 }
496
497 /**
498 * \brief Modifies this configuration's AbsoluteSensorDiscontinuityPoint parameter and returns itself for
499 * method-chaining and easier to use config API.
500 *
501 * The positive discontinuity point of the absolute sensor in
502 * rotations. This determines the point at which the absolute sensor
503 * wraps around, keeping the absolute position (after offset) in the
504 * range [x-1, x).
505 *
506 * - Setting this to 1 makes the absolute position unsigned [0, 1)
507 * - Setting this to 0.5 makes the absolute position signed [-0.5,
508 * 0.5)
509 * - Setting this to 0 makes the absolute position always negative
510 * [-1, 0)
511 *
512 * Many rotational mechanisms such as arms have a region of motion
513 * that is unreachable. This should be set to the center of that
514 * region of motion, in non-negative rotations. This affects the
515 * position of the device at bootup.
516 *
517 * \details For example, consider an arm which can travel from -0.2 to
518 * 0.6 rotations with a little leeway, where 0 is horizontally
519 * forward. Since -0.2 rotations has the same absolute position as 0.8
520 * rotations, we can say that the arm typically does not travel in the
521 * range (0.6, 0.8) rotations. As a result, the discontinuity point
522 * would be the center of that range, which is 0.7 rotations. This
523 * results in an absolute sensor range of [-0.3, 0.7) rotations.
524 *
525 * Given a total range of motion less than 1 rotation, users can
526 * calculate the discontinuity point using mean(lowerLimit,
527 * upperLimit) + 0.5. If that results in a value outside the range [0,
528 * 1], either cap the value to [0, 1], or add/subtract 1.0 rotation
529 * from your lower and upper limits of motion.
530 *
531 * On a Talon motor controller, this is only supported when using the
532 * PulseWidth sensor source.
533 *
534 * - Minimum Value: 0.0
535 * - Maximum Value: 1.0
536 * - Default Value: 0.5
537 * - Units: rotations
538 *
539 * \param newAbsoluteSensorDiscontinuityPoint Parameter to modify
540 * \returns Itself
541 */
542 constexpr ExternalFeedbackConfigs &WithAbsoluteSensorDiscontinuityPoint(wpi::units::turn_t newAbsoluteSensorDiscontinuityPoint)
543 {
544 AbsoluteSensorDiscontinuityPoint = std::move(newAbsoluteSensorDiscontinuityPoint);
545 return *this;
546 }
547
548 /**
549 * \brief Helper method to configure this feedback group to use
550 * RemoteCANcoder by passing in the CANcoder object.
551 *
552 * When using RemoteCANcoder, the Talon will use another
553 * CANcoder on the same CAN bus. The Talon will update its
554 * position and velocity whenever CANcoder publishes its
555 * information on CAN bus, and the Talon commutation sensor
556 * will not be used.
557 *
558 * \param device CANcoder reference to use for RemoteCANcoder
559 * \returns Itself
560 */
562
563 /**
564 * \brief Helper method to configure this feedback group to use
565 * FusedCANcoder by passing in the CANcoder object.
566 *
567 * When using FusedCANcoder (requires Phoenix Pro), the Talon
568 * will fuse another CANcoder's information with the
569 * commutation sensor, which provides the best possible
570 * position and velocity for accuracy and bandwidth.
571 * FusedCANcoder was developed for applications such as
572 * swerve-azimuth.
573 *
574 * \param device CANcoder reference to use for FusedCANcoder
575 * \returns Itself
576 */
578
579 /**
580 * \brief Helper method to configure this feedback group to use
581 * SyncCANcoder by passing in the CANcoder object.
582 *
583 * When using SyncCANcoder (requires Phoenix Pro), the Talon
584 * will synchronize its commutation sensor position against
585 * another CANcoder, then continue to use the rotor sensor for
586 * closed loop control. The Talon will report if its internal
587 * position differs significantly from the reported CANcoder
588 * position. SyncCANcoder was developed for mechanisms where
589 * there is a risk of the CANcoder failing in such a way that
590 * it reports a position that does not match the mechanism,
591 * such as the sensor mounting assembly breaking off.
592 *
593 * \param device CANcoder reference to use for SyncCANcoder
594 * \returns Itself
595 */
597
598 /**
599 * \brief Helper method to configure this feedback group to use
600 * RemotePigeon2Yaw by passing in the Pigeon2 object.
601 *
602 * When using RemotePigeon2Yaw, the Talon will use another
603 * Pigeon2 on the same CAN bus. The Talon will update its
604 * position to match the Pigeon2 yaw whenever Pigeon2 publishes
605 * its information on CAN bus. Note that the Talon position
606 * will be in rotations and not degrees.
607 *
608 * \param device Pigeon2 reference to use for RemotePigeon2Yaw
609 * \returns Itself
610 */
612
613 /**
614 * \brief Helper method to configure this feedback group to use
615 * RemotePigeon2Pitch by passing in the Pigeon2 object.
616 *
617 * When using RemotePigeon2Pitch, the Talon will use another
618 * Pigeon2 on the same CAN bus. The Talon will update its
619 * position to match the Pigeon2 pitch whenever Pigeon2
620 * publishes its information on CAN bus. Note that the Talon
621 * position will be in rotations and not degrees.
622 *
623 * \param device Pigeon2 reference to use for RemotePigeon2Pitch
624 * \returns Itself
625 */
627
628 /**
629 * \brief Helper method to configure this feedback group to use
630 * RemotePigeon2Roll by passing in the Pigeon2 object.
631 *
632 * When using RemotePigeon2Roll, the Talon will use another
633 * Pigeon2 on the same CAN bus. The Talon will update its
634 * position to match the Pigeon2 roll whenever Pigeon2
635 * publishes its information on CAN bus. Note that the Talon
636 * position will be in rotations and not degrees.
637 *
638 * \param device Pigeon2 reference to use for RemotePigeon2Roll
639 * \returns Itself
640 */
642
643 /**
644 * \brief Helper method to configure this feedback group to use
645 * RemoteCANdi PWM 1 by passing in the CANdi object.
646 *
647 * When using RemoteCANdi, the Talon will use another CTR
648 * Electronics' CANdi™ on the same CAN bus. The Talon will
649 * update its position and velocity whenever the CTR
650 * Electronics' CANdi™ publishes its information on CAN bus,
651 * and the Talon commutation sensor will not be used.
652 *
653 * \param device CANdi reference to use for RemoteCANdi
654 * \returns Itself
655 */
657
658 /**
659 * \brief Helper method to configure this feedback group to use
660 * RemoteCANdi PWM 2 by passing in the CANdi object.
661 *
662 * When using RemoteCANdi, the Talon will use another CTR
663 * Electronics' CANdi™ on the same CAN bus. The Talon will
664 * update its position and velocity whenever the CTR
665 * Electronics' CANdi™ publishes its information on CAN bus,
666 * and the Talon commutation sensor will not be used.
667 *
668 * \param device CANdi reference to use for RemoteCANdi
669 * \returns Itself
670 */
672
673 /**
674 * \brief Helper method to configure this feedback group to use
675 * RemoteCANdi Quadrature by passing in the CANdi object.
676 *
677 * When using RemoteCANdi, the Talon will use another CTR
678 * Electronics' CANdi™ on the same CAN bus. The Talon will
679 * update its position and velocity whenever the CTR
680 * Electronics' CANdi™ publishes its information on CAN bus,
681 * and the Talon commutation sensor will not be used.
682 *
683 * \param device CANdi reference to use for RemoteCANdi
684 * \returns Itself
685 */
687
688 /**
689 * \brief Helper method to configure this feedback group to use
690 * FusedCANdi PWM 1 by passing in the CANdi object.
691 *
692 * When using FusedCANdi (requires Phoenix Pro), the Talon will
693 * fuse another CANdi™ branded device's information with the
694 * internal rotor, which provides the best possible position
695 * and velocity for accuracy and bandwidth.
696 *
697 * \param device CANdi reference to use for FusedCANdi
698 * \returns Itself
699 */
701
702 /**
703 * \brief Helper method to configure this feedback group to use
704 * FusedCANdi PWM 2 by passing in the CANdi object.
705 *
706 * When using FusedCANdi (requires Phoenix Pro), the Talon will
707 * fuse another CANdi™ branded device's information with the
708 * internal rotor, which provides the best possible position
709 * and velocity for accuracy and bandwidth.
710 *
711 * \param device CANdi reference to use for FusedCANdi
712 * \returns Itself
713 */
715
716 /**
717 * \brief Helper method to configure this feedback group to use
718 * FusedCANdi Quadrature by passing in the CANdi object.
719 *
720 * When using FusedCANdi (requires Phoenix Pro), the Talon will
721 * fuse another CANdi™ branded device's information with the
722 * internal rotor, which provides the best possible position
723 * and velocity for accuracy and bandwidth.
724 *
725 * \param device CANdi reference to use for FusedCANdi
726 * \returns Itself
727 */
729
730 /**
731 * \brief Helper method to configure this feedback group to use
732 * SyncCANdi PWM 1 by passing in the CANdi object.
733 *
734 * When using SyncCANdi (requires Phoenix Pro), the Talon will
735 * synchronize its internal rotor position against another
736 * CANdi™ branded device, then continue to use the rotor sensor
737 * for closed loop control. The Talon will report if its
738 * internal position differs significantly from the reported
739 * CANdi™ branded device's position. SyncCANdi was developed
740 * for mechanisms where there is a risk of the CANdi™ branded
741 * device failing in such a way that it reports a position that
742 * does not match the mechanism, such as the sensor mounting
743 * assembly breaking off.
744 *
745 * \param device CANdi reference to use for SyncCANdi
746 * \returns Itself
747 */
749
750 /**
751 * \brief Helper method to configure this feedback group to use
752 * SyncCANdi PWM 2 by passing in the CANdi object.
753 *
754 * When using SyncCANdi (requires Phoenix Pro), the Talon will
755 * synchronize its internal rotor position against another
756 * CANdi™ branded device, then continue to use the rotor sensor
757 * for closed loop control. The Talon will report if its
758 * internal position differs significantly from the reported
759 * CANdi™ branded device's position. SyncCANdi was developed
760 * for mechanisms where there is a risk of the CANdi™ branded
761 * device failing in such a way that it reports a position that
762 * does not match the mechanism, such as the sensor mounting
763 * assembly breaking off.
764 *
765 * \param device CANdi reference to use for SyncCANdi
766 * \returns Itself
767 */
769
770
771
772 std::string ToString() const override;
773
774 std::string Serialize() const final;
775 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
776};
777
778}
779}
780}
constexpr ExternalFeedbackConfigs & WithSensorPhase(signals::SensorPhaseValue newSensorPhase)
Modifies this configuration's SensorPhase parameter and returns itself for method-chaining and easier...
Definition ExternalFeedbackConfigs.hpp:458
ExternalFeedbackConfigs & WithFusedCANdiPWM2(const hardware::core::CoreCANdi &device)
Helper method to configure this feedback group to use FusedCANdi PWM 2 by passing in the CANdi object...
ExternalFeedbackConfigs & WithFusedCANdiPWM1(const hardware::core::CoreCANdi &device)
Helper method to configure this feedback group to use FusedCANdi PWM 1 by passing in the CANdi object...
ExternalFeedbackConfigs & WithSyncCANdiPWM1(const hardware::core::CoreCANdi &device)
Helper method to configure this feedback group to use SyncCANdi PWM 1 by passing in the CANdi object.
constexpr ExternalFeedbackConfigs & WithSensorToMechanismRatio(wpi::units::scalar_t newSensorToMechanismRatio)
Modifies this configuration's SensorToMechanismRatio parameter and returns itself for method-chaining...
Definition ExternalFeedbackConfigs.hpp:268
ExternalFeedbackConfigs & WithRemotePigeon2Roll(const hardware::core::CorePigeon2 &device)
Helper method to configure this feedback group to use RemotePigeon2Roll by passing in the Pigeon2 obj...
wpi::units::scalar_t RotorToSensorRatio
The ratio of motor rotor rotations to remote sensor rotations, where a ratio greater than 1 is a redu...
Definition ExternalFeedbackConfigs.hpp:72
ExternalFeedbackConfigs & WithSyncCANcoder(const hardware::core::CoreCANcoder &device)
Helper method to configure this feedback group to use SyncCANcoder by passing in the CANcoder object.
signals::ExternalFeedbackSensorSourceValue ExternalFeedbackSensorSource
Choose what sensor source is reported via API and used by closed-loop and limit features.
Definition ExternalFeedbackConfigs.hpp:162
wpi::units::turn_t AbsoluteSensorDiscontinuityPoint
The positive discontinuity point of the absolute sensor in rotations.
Definition ExternalFeedbackConfigs.hpp:241
constexpr ExternalFeedbackConfigs & WithQuadratureEdgesPerRotation(int newQuadratureEdgesPerRotation)
Modifies this configuration's QuadratureEdgesPerRotation parameter and returns itself for method-chai...
Definition ExternalFeedbackConfigs.hpp:491
wpi::units::turn_t AbsoluteSensorOffset
The offset added to any absolute sensor connected to the Talon data port.
Definition ExternalFeedbackConfigs.hpp:111
constexpr ExternalFeedbackConfigs & WithVelocityFilterTimeConstant(wpi::units::second_t newVelocityFilterTimeConstant)
Modifies this configuration's VelocityFilterTimeConstant parameter and returns itself for method-chai...
Definition ExternalFeedbackConfigs.hpp:343
constexpr ExternalFeedbackConfigs & WithFeedbackRemoteSensorID(int newFeedbackRemoteSensorID)
Modifies this configuration's FeedbackRemoteSensorID parameter and returns itself for method-chaining...
Definition ExternalFeedbackConfigs.hpp:317
ExternalFeedbackConfigs & WithRemoteCANdiPWM2(const hardware::core::CoreCANdi &device)
Helper method to configure this feedback group to use RemoteCANdi PWM 2 by passing in the CANdi objec...
ExternalFeedbackConfigs & WithFusedCANdiQuadrature(const hardware::core::CoreCANdi &device)
Helper method to configure this feedback group to use FusedCANdi Quadrature by passing in the CANdi o...
ExternalFeedbackConfigs & WithRemotePigeon2Pitch(const hardware::core::CorePigeon2 &device)
Helper method to configure this feedback group to use RemotePigeon2Pitch by passing in the Pigeon2 ob...
ExternalFeedbackConfigs & WithRemoteCANcoder(const hardware::core::CoreCANcoder &device)
Helper method to configure this feedback group to use RemoteCANcoder by passing in the CANcoder objec...
constexpr ExternalFeedbackConfigs & WithAbsoluteSensorDiscontinuityPoint(wpi::units::turn_t newAbsoluteSensorDiscontinuityPoint)
Modifies this configuration's AbsoluteSensorDiscontinuityPoint parameter and returns itself for metho...
Definition ExternalFeedbackConfigs.hpp:542
constexpr ExternalFeedbackConfigs & WithExternalFeedbackSensorSource(signals::ExternalFeedbackSensorSourceValue newExternalFeedbackSensorSource)
Modifies this configuration's ExternalFeedbackSensorSource parameter and returns itself for method-ch...
Definition ExternalFeedbackConfigs.hpp:430
constexpr ExternalFeedbackConfigs & WithRotorToSensorRatio(wpi::units::scalar_t newRotorToSensorRatio)
Modifies this configuration's RotorToSensorRatio parameter and returns itself for method-chaining and...
Definition ExternalFeedbackConfigs.hpp:296
wpi::units::second_t VelocityFilterTimeConstant
The configurable time constant of the Kalman velocity filter.
Definition ExternalFeedbackConfigs.hpp:97
ExternalFeedbackConfigs & WithRemoteCANdiPWM1(const hardware::core::CoreCANdi &device)
Helper method to configure this feedback group to use RemoteCANdi PWM 1 by passing in the CANdi objec...
constexpr ExternalFeedbackConfigs & WithAbsoluteSensorOffset(wpi::units::turn_t newAbsoluteSensorOffset)
Modifies this configuration's AbsoluteSensorOffset parameter and returns itself for method-chaining a...
Definition ExternalFeedbackConfigs.hpp:368
wpi::units::scalar_t SensorToMechanismRatio
The ratio of sensor rotations to the mechanism's output, where a ratio greater than 1 is a reduction.
Definition ExternalFeedbackConfigs.hpp:55
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
ExternalFeedbackConfigs & WithRemotePigeon2Yaw(const hardware::core::CorePigeon2 &device)
Helper method to configure this feedback group to use RemotePigeon2Yaw by passing in the Pigeon2 obje...
signals::SensorPhaseValue SensorPhase
The relationship between the motor controlled by a Talon and the external sensor connected to the dat...
Definition ExternalFeedbackConfigs.hpp:179
ExternalFeedbackConfigs & WithFusedCANcoder(const hardware::core::CoreCANcoder &device)
Helper method to configure this feedback group to use FusedCANcoder by passing in the CANcoder object...
ExternalFeedbackConfigs & WithRemoteCANdiQuadrature(const hardware::core::CoreCANdi &device)
Helper method to configure this feedback group to use RemoteCANdi Quadrature by passing in the CANdi ...
int FeedbackRemoteSensorID
Device ID of which remote device to use.
Definition ExternalFeedbackConfigs.hpp:82
ExternalFeedbackConfigs & WithSyncCANdiPWM2(const hardware::core::CoreCANdi &device)
Helper method to configure this feedback group to use SyncCANdi PWM 2 by passing in the CANdi object.
int QuadratureEdgesPerRotation
The number of quadrature edges in one rotation for the quadrature sensor connected to the Talon data ...
Definition ExternalFeedbackConfigs.hpp:201
Definition Configuration.hpp:17
Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along w...
Definition CoreCANcoder.hpp:601
Class for CTR Electronics' CANdi™ branded device, a device that integrates digital signals into the e...
Definition CoreCANdi.hpp:924
Class description for the Pigeon 2 IMU sensor that measures orientation.
Definition CorePigeon2.hpp:1062
Definition ExternalFeedbackConfigs.hpp:21
Definition ExternalFeedbackConfigs.hpp:17
Definition ExternalFeedbackConfigs.hpp:16
Definition FrcUsageReport.hpp:12
Definition motor_constants.h:14
Choose what sensor source is reported via API and used by closed-loop and limit features.
Definition SpnEnums.hpp:3271
static constexpr int Commutation
Use the external sensor used for motor commutation.
Definition SpnEnums.hpp:3277
The relationship between the motor controlled by a Talon and the external sensor connected to the dat...
Definition SpnEnums.hpp:3475
static constexpr int Aligned
The sensor direction is normally aligned with the motor.
Definition SpnEnums.hpp:3481