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