CTRE Phoenix 6 C++ 24.2.0
Configs.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
14#include <sstream>
15#include <map>
16#include <string>
17
18namespace ctre {
19namespace phoenix6 {
20
21namespace hardware { namespace core { class CoreCANcoder; } }
22namespace configs { class SlotConfigs; }
23
24namespace configs {
25
27{
28public:
29 virtual std::string ToString() const = 0;
30 friend std::ostream &operator<<(std::ostream &str, const ParentConfiguration &v)
31 {
32 str << v.ToString();
33 return str;
34 }
35 virtual ctre::phoenix::StatusCode Deserialize(const std::string &string) = 0;
36};
37
38
39/**
40 * \brief Configs that affect the magnet sensor and how to interpret
41 * it.
42 *
43 * \details Includes sensor range and other configs related to sensor.
44 */
46{
47public:
48 /**
49 * \brief Direction of the sensor to determine positive facing the LED
50 * side of the CANcoder.
51 *
52 */
54 /**
55 * \brief This offset is added to the reported position, allowing the
56 * application to trim the zero position. When set to the default
57 * value of zero, position reports zero when magnet north pole aligns
58 * with the LED.
59 *
60 * Minimum Value: -1
61 * Maximum Value: 1
62 * Default Value: 0
63 * Units: rotations
64 */
65 double MagnetOffset = 0;
66 /**
67 * \brief The range of the absolute sensor, either [-0.5, 0.5) or [0,
68 * 1).
69 *
70 */
72
73 /**
74 * \brief Modifies this configuration's SensorDirection parameter and returns itself for
75 * method-chaining and easier to use config API.
76 * \param newSensorDirection Parameter to modify
77 * \returns Itself
78 */
80 {
81 SensorDirection = std::move(newSensorDirection);
82 return *this;
83 }
84 /**
85 * \brief Modifies this configuration's MagnetOffset parameter and returns itself for
86 * method-chaining and easier to use config API.
87 * \param newMagnetOffset Parameter to modify
88 * \returns Itself
89 */
90 MagnetSensorConfigs& WithMagnetOffset(double newMagnetOffset)
91 {
92 MagnetOffset = std::move(newMagnetOffset);
93 return *this;
94 }
95 /**
96 * \brief Modifies this configuration's AbsoluteSensorRange parameter and returns itself for
97 * method-chaining and easier to use config API.
98 * \param newAbsoluteSensorRange Parameter to modify
99 * \returns Itself
100 */
102 {
103 AbsoluteSensorRange = std::move(newAbsoluteSensorRange);
104 return *this;
105 }
106
107
108
109 std::string ToString() const override
110 {
111 std::stringstream ss;
112 ss << "{" << std::endl;
113 ss << "Config Group: MagnetSensor" << std::endl;
114 ss << "Name: \"SensorDirection\" Value: \"" << SensorDirection << "\"" << std::endl;
115 ss << "Name: \"MagnetOffset\" Value: \"" << MagnetOffset << "rotations\"" << std::endl;
116 ss << "Name: \"AbsoluteSensorRange\" Value: \"" << AbsoluteSensorRange << "\"" << std::endl;
117 ss << "}" << std::endl;
118 return ss.str();
119 }
120
121 std::string Serialize() const override
122 {
123 std::stringstream ss;
124 char *ref;
125 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::CANcoder_SensorDirection, SensorDirection.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
126 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::CANCoder_MagnetOffset, MagnetOffset, &ref); if (ref != nullptr) { ss << ref; free(ref); }
127 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::CANcoder_AbsoluteSensorRange, AbsoluteSensorRange.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
128 return ss.str();
129 }
130
131 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
132 {
133 const char *string_c_str = to_deserialize.c_str();
134 size_t string_length = to_deserialize.length();
135 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::CANcoder_SensorDirection, string_c_str, string_length, &SensorDirection.value);
136 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::CANCoder_MagnetOffset, string_c_str, string_length, &MagnetOffset);
137 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::CANcoder_AbsoluteSensorRange, string_c_str, string_length, &AbsoluteSensorRange.value);
138 return 0;
139 }
140};
141
142
143/**
144 * \brief Configs for Pigeon 2's Mount Pose configuration.
145 *
146 * \details These configs allow the Pigeon2 to be mounted in whatever
147 * orientation that's desired and ensure the reported
148 * Yaw/Pitch/Roll is from the robot's reference.
149 */
151{
152public:
153 /**
154 * \brief The mounting calibration yaw-component
155 *
156 * Minimum Value: -360
157 * Maximum Value: 360
158 * Default Value: 0
159 * Units: deg
160 */
161 double MountPoseYaw = 0;
162 /**
163 * \brief The mounting calibration pitch-component
164 *
165 * Minimum Value: -360
166 * Maximum Value: 360
167 * Default Value: 0
168 * Units: deg
169 */
170 double MountPosePitch = 0;
171 /**
172 * \brief The mounting calibration roll-component
173 *
174 * Minimum Value: -360
175 * Maximum Value: 360
176 * Default Value: 0
177 * Units: deg
178 */
179 double MountPoseRoll = 0;
180
181 /**
182 * \brief Modifies this configuration's MountPoseYaw parameter and returns itself for
183 * method-chaining and easier to use config API.
184 * \param newMountPoseYaw Parameter to modify
185 * \returns Itself
186 */
187 MountPoseConfigs& WithMountPoseYaw(double newMountPoseYaw)
188 {
189 MountPoseYaw = std::move(newMountPoseYaw);
190 return *this;
191 }
192 /**
193 * \brief Modifies this configuration's MountPosePitch parameter and returns itself for
194 * method-chaining and easier to use config API.
195 * \param newMountPosePitch Parameter to modify
196 * \returns Itself
197 */
198 MountPoseConfigs& WithMountPosePitch(double newMountPosePitch)
199 {
200 MountPosePitch = std::move(newMountPosePitch);
201 return *this;
202 }
203 /**
204 * \brief Modifies this configuration's MountPoseRoll parameter and returns itself for
205 * method-chaining and easier to use config API.
206 * \param newMountPoseRoll Parameter to modify
207 * \returns Itself
208 */
209 MountPoseConfigs& WithMountPoseRoll(double newMountPoseRoll)
210 {
211 MountPoseRoll = std::move(newMountPoseRoll);
212 return *this;
213 }
214
215
216
217 std::string ToString() const override
218 {
219 std::stringstream ss;
220 ss << "{" << std::endl;
221 ss << "Config Group: MountPose" << std::endl;
222 ss << "Name: \"MountPoseYaw\" Value: \"" << MountPoseYaw << "deg\"" << std::endl;
223 ss << "Name: \"MountPosePitch\" Value: \"" << MountPosePitch << "deg\"" << std::endl;
224 ss << "Name: \"MountPoseRoll\" Value: \"" << MountPoseRoll << "deg\"" << std::endl;
225 ss << "}" << std::endl;
226 return ss.str();
227 }
228
229 std::string Serialize() const override
230 {
231 std::stringstream ss;
232 char *ref;
233 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2MountPoseYaw, MountPoseYaw, &ref); if (ref != nullptr) { ss << ref; free(ref); }
234 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2MountPosePitch, MountPosePitch, &ref); if (ref != nullptr) { ss << ref; free(ref); }
235 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2MountPoseRoll, MountPoseRoll, &ref); if (ref != nullptr) { ss << ref; free(ref); }
236 return ss.str();
237 }
238
239 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
240 {
241 const char *string_c_str = to_deserialize.c_str();
242 size_t string_length = to_deserialize.length();
243 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2MountPoseYaw, string_c_str, string_length, &MountPoseYaw);
244 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2MountPosePitch, string_c_str, string_length, &MountPosePitch);
245 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2MountPoseRoll, string_c_str, string_length, &MountPoseRoll);
246 return 0;
247 }
248};
249
250
251/**
252 * \brief Configs to trim the Pigeon2's gyroscope.
253 *
254 * \details Pigeon2 allows the user to trim the gyroscope's
255 * sensitivity. While this isn't necessary for the Pigeon2,
256 * as it comes calibrated out-of-the-box, users can make use
257 * of this to make the Pigeon2 even more accurate for their
258 * application.
259 */
261{
262public:
263 /**
264 * \brief The gyro scalar component for the X axis
265 *
266 * Minimum Value: -180
267 * Maximum Value: 180
268 * Default Value: 0
269 * Units: deg per rotation
270 */
271 double GyroScalarX = 0;
272 /**
273 * \brief The gyro scalar component for the Y axis
274 *
275 * Minimum Value: -180
276 * Maximum Value: 180
277 * Default Value: 0
278 * Units: deg per rotation
279 */
280 double GyroScalarY = 0;
281 /**
282 * \brief The gyro scalar component for the Z axis
283 *
284 * Minimum Value: -180
285 * Maximum Value: 180
286 * Default Value: 0
287 * Units: deg per rotation
288 */
289 double GyroScalarZ = 0;
290
291 /**
292 * \brief Modifies this configuration's GyroScalarX parameter and returns itself for
293 * method-chaining and easier to use config API.
294 * \param newGyroScalarX Parameter to modify
295 * \returns Itself
296 */
297 GyroTrimConfigs& WithGyroScalarX(double newGyroScalarX)
298 {
299 GyroScalarX = std::move(newGyroScalarX);
300 return *this;
301 }
302 /**
303 * \brief Modifies this configuration's GyroScalarY parameter and returns itself for
304 * method-chaining and easier to use config API.
305 * \param newGyroScalarY Parameter to modify
306 * \returns Itself
307 */
308 GyroTrimConfigs& WithGyroScalarY(double newGyroScalarY)
309 {
310 GyroScalarY = std::move(newGyroScalarY);
311 return *this;
312 }
313 /**
314 * \brief Modifies this configuration's GyroScalarZ parameter and returns itself for
315 * method-chaining and easier to use config API.
316 * \param newGyroScalarZ Parameter to modify
317 * \returns Itself
318 */
319 GyroTrimConfigs& WithGyroScalarZ(double newGyroScalarZ)
320 {
321 GyroScalarZ = std::move(newGyroScalarZ);
322 return *this;
323 }
324
325
326
327 std::string ToString() const override
328 {
329 std::stringstream ss;
330 ss << "{" << std::endl;
331 ss << "Config Group: GyroTrim" << std::endl;
332 ss << "Name: \"GyroScalarX\" Value: \"" << GyroScalarX << "deg per rotation\"" << std::endl;
333 ss << "Name: \"GyroScalarY\" Value: \"" << GyroScalarY << "deg per rotation\"" << std::endl;
334 ss << "Name: \"GyroScalarZ\" Value: \"" << GyroScalarZ << "deg per rotation\"" << std::endl;
335 ss << "}" << std::endl;
336 return ss.str();
337 }
338
339 std::string Serialize() const override
340 {
341 std::stringstream ss;
342 char *ref;
343 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2GyroScalarX, GyroScalarX, &ref); if (ref != nullptr) { ss << ref; free(ref); }
344 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2GyroScalarY, GyroScalarY, &ref); if (ref != nullptr) { ss << ref; free(ref); }
345 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2GyroScalarZ, GyroScalarZ, &ref); if (ref != nullptr) { ss << ref; free(ref); }
346 return ss.str();
347 }
348
349 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
350 {
351 const char *string_c_str = to_deserialize.c_str();
352 size_t string_length = to_deserialize.length();
353 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2GyroScalarX, string_c_str, string_length, &GyroScalarX);
354 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2GyroScalarY, string_c_str, string_length, &GyroScalarY);
355 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Pigeon2GyroScalarZ, string_c_str, string_length, &GyroScalarZ);
356 return 0;
357 }
358};
359
360
361/**
362 * \brief Configs to enable/disable various features of the Pigeon2.
363 *
364 * \details These configs allow the user to enable or disable various
365 * aspects of the Pigeon2.
366 */
368{
369public:
370 /**
371 * \brief Turns on or off the magnetometer fusing for 9-axis. FRC
372 * users are not recommended to turn this on, as the magnetic
373 * influence of the robot will likely negatively affect the
374 * performance of the Pigeon2.
375 *
376 * Default Value: False
377 */
378 bool EnableCompass = false;
379 /**
380 * \brief Disables using the temperature compensation feature
381 *
382 * Default Value: False
383 */
385 /**
386 * \brief Disables using the no-motion calibration feature
387 *
388 * Default Value: False
389 */
391
392 /**
393 * \brief Modifies this configuration's EnableCompass parameter and returns itself for
394 * method-chaining and easier to use config API.
395 * \param newEnableCompass Parameter to modify
396 * \returns Itself
397 */
399 {
400 EnableCompass = std::move(newEnableCompass);
401 return *this;
402 }
403 /**
404 * \brief Modifies this configuration's DisableTemperatureCompensation parameter and returns itself for
405 * method-chaining and easier to use config API.
406 * \param newDisableTemperatureCompensation Parameter to modify
407 * \returns Itself
408 */
409 Pigeon2FeaturesConfigs& WithDisableTemperatureCompensation(bool newDisableTemperatureCompensation)
410 {
411 DisableTemperatureCompensation = std::move(newDisableTemperatureCompensation);
412 return *this;
413 }
414 /**
415 * \brief Modifies this configuration's DisableNoMotionCalibration parameter and returns itself for
416 * method-chaining and easier to use config API.
417 * \param newDisableNoMotionCalibration Parameter to modify
418 * \returns Itself
419 */
420 Pigeon2FeaturesConfigs& WithDisableNoMotionCalibration(bool newDisableNoMotionCalibration)
421 {
422 DisableNoMotionCalibration = std::move(newDisableNoMotionCalibration);
423 return *this;
424 }
425
426
427
428 std::string ToString() const override
429 {
430 std::stringstream ss;
431 ss << "{" << std::endl;
432 ss << "Config Group: Pigeon2Features" << std::endl;
433 ss << "Name: \"EnableCompass\" Value: \"" << EnableCompass << "\"" << std::endl;
434 ss << "Name: \"DisableTemperatureCompensation\" Value: \"" << DisableTemperatureCompensation << "\"" << std::endl;
435 ss << "Name: \"DisableNoMotionCalibration\" Value: \"" << DisableNoMotionCalibration << "\"" << std::endl;
436 ss << "}" << std::endl;
437 return ss.str();
438 }
439
440 std::string Serialize() const override
441 {
442 std::stringstream ss;
443 char *ref;
444 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Pigeon2UseCompass, EnableCompass, &ref); if (ref != nullptr) { ss << ref; free(ref); }
445 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Pigeon2DisableTemperatureCompensation, DisableTemperatureCompensation, &ref); if (ref != nullptr) { ss << ref; free(ref); }
446 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Pigeon2DisableNoMotionCalibration, DisableNoMotionCalibration, &ref); if (ref != nullptr) { ss << ref; free(ref); }
447 return ss.str();
448 }
449
450 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
451 {
452 const char *string_c_str = to_deserialize.c_str();
453 size_t string_length = to_deserialize.length();
454 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Pigeon2UseCompass, string_c_str, string_length, &EnableCompass);
455 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Pigeon2DisableTemperatureCompensation, string_c_str, string_length, &DisableTemperatureCompensation);
456 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Pigeon2DisableNoMotionCalibration, string_c_str, string_length, &DisableNoMotionCalibration);
457 return 0;
458 }
459};
460
461
462/**
463 * \brief Configs that directly affect motor-output.
464 *
465 * \details Includes Motor Invert and various limit features.
466 */
468{
469public:
470 /**
471 * \brief Invert state of the device
472 *
473 */
475 /**
476 * \brief The state of the motor controller bridge when output is
477 * neutral or disabled.
478 *
479 */
481 /**
482 * \brief Configures the output deadband percentage.
483 *
484 * Minimum Value: 0.0
485 * Maximum Value: 0.25
486 * Default Value: 0
487 * Units: fractional
488 */
490 /**
491 * \brief Maximum (forward) output during duty cycle based control
492 * modes.
493 *
494 * Minimum Value: -1.0
495 * Maximum Value: 1.0
496 * Default Value: 1
497 * Units: fractional
498 */
500 /**
501 * \brief Minimum (reverse) output during duty cycle based control
502 * modes.
503 *
504 * Minimum Value: -1.0
505 * Maximum Value: 1.0
506 * Default Value: -1
507 * Units: fractional
508 */
510
511 /**
512 * \brief Modifies this configuration's Inverted parameter and returns itself for
513 * method-chaining and easier to use config API.
514 * \param newInverted Parameter to modify
515 * \returns Itself
516 */
518 {
519 Inverted = std::move(newInverted);
520 return *this;
521 }
522 /**
523 * \brief Modifies this configuration's NeutralMode parameter and returns itself for
524 * method-chaining and easier to use config API.
525 * \param newNeutralMode Parameter to modify
526 * \returns Itself
527 */
529 {
530 NeutralMode = std::move(newNeutralMode);
531 return *this;
532 }
533 /**
534 * \brief Modifies this configuration's DutyCycleNeutralDeadband parameter and returns itself for
535 * method-chaining and easier to use config API.
536 * \param newDutyCycleNeutralDeadband Parameter to modify
537 * \returns Itself
538 */
539 MotorOutputConfigs& WithDutyCycleNeutralDeadband(double newDutyCycleNeutralDeadband)
540 {
541 DutyCycleNeutralDeadband = std::move(newDutyCycleNeutralDeadband);
542 return *this;
543 }
544 /**
545 * \brief Modifies this configuration's PeakForwardDutyCycle parameter and returns itself for
546 * method-chaining and easier to use config API.
547 * \param newPeakForwardDutyCycle Parameter to modify
548 * \returns Itself
549 */
550 MotorOutputConfigs& WithPeakForwardDutyCycle(double newPeakForwardDutyCycle)
551 {
552 PeakForwardDutyCycle = std::move(newPeakForwardDutyCycle);
553 return *this;
554 }
555 /**
556 * \brief Modifies this configuration's PeakReverseDutyCycle parameter and returns itself for
557 * method-chaining and easier to use config API.
558 * \param newPeakReverseDutyCycle Parameter to modify
559 * \returns Itself
560 */
561 MotorOutputConfigs& WithPeakReverseDutyCycle(double newPeakReverseDutyCycle)
562 {
563 PeakReverseDutyCycle = std::move(newPeakReverseDutyCycle);
564 return *this;
565 }
566
567
568
569 std::string ToString() const override
570 {
571 std::stringstream ss;
572 ss << "{" << std::endl;
573 ss << "Config Group: MotorOutput" << std::endl;
574 ss << "Name: \"Inverted\" Value: \"" << Inverted << "\"" << std::endl;
575 ss << "Name: \"NeutralMode\" Value: \"" << NeutralMode << "\"" << std::endl;
576 ss << "Name: \"DutyCycleNeutralDeadband\" Value: \"" << DutyCycleNeutralDeadband << "fractional\"" << std::endl;
577 ss << "Name: \"PeakForwardDutyCycle\" Value: \"" << PeakForwardDutyCycle << "fractional\"" << std::endl;
578 ss << "Name: \"PeakReverseDutyCycle\" Value: \"" << PeakReverseDutyCycle << "fractional\"" << std::endl;
579 ss << "}" << std::endl;
580 return ss.str();
581 }
582
583 std::string Serialize() const override
584 {
585 std::stringstream ss;
586 char *ref;
587 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_Inverted, Inverted.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
588 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_NeutralMode, NeutralMode.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
589 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_DutyCycleNeutralDB, DutyCycleNeutralDeadband, &ref); if (ref != nullptr) { ss << ref; free(ref); }
590 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakForwardDC, PeakForwardDutyCycle, &ref); if (ref != nullptr) { ss << ref; free(ref); }
591 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakReverseDC, PeakReverseDutyCycle, &ref); if (ref != nullptr) { ss << ref; free(ref); }
592 return ss.str();
593 }
594
595 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
596 {
597 const char *string_c_str = to_deserialize.c_str();
598 size_t string_length = to_deserialize.length();
599 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_Inverted, string_c_str, string_length, &Inverted.value);
600 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_NeutralMode, string_c_str, string_length, &NeutralMode.value);
601 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_DutyCycleNeutralDB, string_c_str, string_length, &DutyCycleNeutralDeadband);
602 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakForwardDC, string_c_str, string_length, &PeakForwardDutyCycle);
603 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakReverseDC, string_c_str, string_length, &PeakReverseDutyCycle);
604 return 0;
605 }
606};
607
608
609/**
610 * \brief Configs that directly affect current limiting features.
611 *
612 * \details Contains the supply/stator current limit thresholds and
613 * whether to enable them or not.
614 */
616{
617public:
618 /**
619 * \brief The amount of current allowed in the motor (motoring and
620 * regen current). This is only applicable for non-torque current
621 * control modes. Note this requires the corresponding enable to be
622 * true.
623 *
624 * Minimum Value: 0.0
625 * Maximum Value: 800.0
626 * Default Value: 0
627 * Units: A
628 */
630 /**
631 * \brief Enable motor stator current limiting.
632 *
633 * Default Value: False
634 */
636 /**
637 * \brief The amount of supply current allowed. This is only
638 * applicable for non-torque current control modes. Note this
639 * requires the corresponding enable to be true. Use
640 * SupplyCurrentThreshold and SupplyTimeThreshold to allow brief
641 * periods of high-current before limiting occurs.
642 *
643 * Minimum Value: 0.0
644 * Maximum Value: 800.0
645 * Default Value: 0
646 * Units: A
647 */
649 /**
650 * \brief Enable motor supply current limiting.
651 *
652 * Default Value: False
653 */
655 /**
656 * \brief Delay supply current limiting until current exceeds this
657 * threshold for longer than SupplyTimeThreshold. This allows current
658 * draws above SupplyCurrentLimit for a fixed period of time. This
659 * has no effect if SupplyCurrentLimit is greater than this value.
660 *
661 * Minimum Value: 0.0
662 * Maximum Value: 511
663 * Default Value: 0
664 * Units: A
665 */
667 /**
668 * \brief Allows unlimited current for a period of time before current
669 * limiting occurs. Current threshold is the maximum of
670 * SupplyCurrentThreshold and SupplyCurrentLimit.
671 *
672 * Minimum Value: 0.0
673 * Maximum Value: 1.275
674 * Default Value: 0
675 * Units: sec
676 */
678
679 /**
680 * \brief Modifies this configuration's StatorCurrentLimit parameter and returns itself for
681 * method-chaining and easier to use config API.
682 * \param newStatorCurrentLimit Parameter to modify
683 * \returns Itself
684 */
685 CurrentLimitsConfigs& WithStatorCurrentLimit(double newStatorCurrentLimit)
686 {
687 StatorCurrentLimit = std::move(newStatorCurrentLimit);
688 return *this;
689 }
690 /**
691 * \brief Modifies this configuration's StatorCurrentLimitEnable parameter and returns itself for
692 * method-chaining and easier to use config API.
693 * \param newStatorCurrentLimitEnable Parameter to modify
694 * \returns Itself
695 */
696 CurrentLimitsConfigs& WithStatorCurrentLimitEnable(bool newStatorCurrentLimitEnable)
697 {
698 StatorCurrentLimitEnable = std::move(newStatorCurrentLimitEnable);
699 return *this;
700 }
701 /**
702 * \brief Modifies this configuration's SupplyCurrentLimit parameter and returns itself for
703 * method-chaining and easier to use config API.
704 * \param newSupplyCurrentLimit Parameter to modify
705 * \returns Itself
706 */
707 CurrentLimitsConfigs& WithSupplyCurrentLimit(double newSupplyCurrentLimit)
708 {
709 SupplyCurrentLimit = std::move(newSupplyCurrentLimit);
710 return *this;
711 }
712 /**
713 * \brief Modifies this configuration's SupplyCurrentLimitEnable parameter and returns itself for
714 * method-chaining and easier to use config API.
715 * \param newSupplyCurrentLimitEnable Parameter to modify
716 * \returns Itself
717 */
718 CurrentLimitsConfigs& WithSupplyCurrentLimitEnable(bool newSupplyCurrentLimitEnable)
719 {
720 SupplyCurrentLimitEnable = std::move(newSupplyCurrentLimitEnable);
721 return *this;
722 }
723 /**
724 * \brief Modifies this configuration's SupplyCurrentThreshold parameter and returns itself for
725 * method-chaining and easier to use config API.
726 * \param newSupplyCurrentThreshold Parameter to modify
727 * \returns Itself
728 */
729 CurrentLimitsConfigs& WithSupplyCurrentThreshold(double newSupplyCurrentThreshold)
730 {
731 SupplyCurrentThreshold = std::move(newSupplyCurrentThreshold);
732 return *this;
733 }
734 /**
735 * \brief Modifies this configuration's SupplyTimeThreshold parameter and returns itself for
736 * method-chaining and easier to use config API.
737 * \param newSupplyTimeThreshold Parameter to modify
738 * \returns Itself
739 */
740 CurrentLimitsConfigs& WithSupplyTimeThreshold(double newSupplyTimeThreshold)
741 {
742 SupplyTimeThreshold = std::move(newSupplyTimeThreshold);
743 return *this;
744 }
745
746
747
748 std::string ToString() const override
749 {
750 std::stringstream ss;
751 ss << "{" << std::endl;
752 ss << "Config Group: CurrentLimits" << std::endl;
753 ss << "Name: \"StatorCurrentLimit\" Value: \"" << StatorCurrentLimit << "A\"" << std::endl;
754 ss << "Name: \"StatorCurrentLimitEnable\" Value: \"" << StatorCurrentLimitEnable << "\"" << std::endl;
755 ss << "Name: \"SupplyCurrentLimit\" Value: \"" << SupplyCurrentLimit << "A\"" << std::endl;
756 ss << "Name: \"SupplyCurrentLimitEnable\" Value: \"" << SupplyCurrentLimitEnable << "\"" << std::endl;
757 ss << "Name: \"SupplyCurrentThreshold\" Value: \"" << SupplyCurrentThreshold << "A\"" << std::endl;
758 ss << "Name: \"SupplyTimeThreshold\" Value: \"" << SupplyTimeThreshold << "sec\"" << std::endl;
759 ss << "}" << std::endl;
760 return ss.str();
761 }
762
763 std::string Serialize() const override
764 {
765 std::stringstream ss;
766 char *ref;
767 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_StatorCurrentLimit, StatorCurrentLimit, &ref); if (ref != nullptr) { ss << ref; free(ref); }
768 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_StatorCurrLimitEn, StatorCurrentLimitEnable, &ref); if (ref != nullptr) { ss << ref; free(ref); }
769 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_SupplyCurrentLimit, SupplyCurrentLimit, &ref); if (ref != nullptr) { ss << ref; free(ref); }
770 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_SupplyCurrLimitEn, SupplyCurrentLimitEnable, &ref); if (ref != nullptr) { ss << ref; free(ref); }
771 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_SupplyCurrThres, SupplyCurrentThreshold, &ref); if (ref != nullptr) { ss << ref; free(ref); }
772 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_SupplyTimeThres, SupplyTimeThreshold, &ref); if (ref != nullptr) { ss << ref; free(ref); }
773 return ss.str();
774 }
775
776 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
777 {
778 const char *string_c_str = to_deserialize.c_str();
779 size_t string_length = to_deserialize.length();
780 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_StatorCurrentLimit, string_c_str, string_length, &StatorCurrentLimit);
781 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_StatorCurrLimitEn, string_c_str, string_length, &StatorCurrentLimitEnable);
782 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_SupplyCurrentLimit, string_c_str, string_length, &SupplyCurrentLimit);
783 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_SupplyCurrLimitEn, string_c_str, string_length, &SupplyCurrentLimitEnable);
784 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_SupplyCurrThres, string_c_str, string_length, &SupplyCurrentThreshold);
785 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_SupplyTimeThres, string_c_str, string_length, &SupplyTimeThreshold);
786 return 0;
787 }
788};
789
790
791/**
792 * \brief Voltage-specific configs
793 *
794 * \details Voltage-specific configs
795 */
797{
798public:
799 /**
800 * \brief The time constant (in seconds) of the low-pass filter for
801 * the supply voltage.
802 *
803 * \details This impacts the filtering for the reported supply
804 * voltage, and any control strategies that use the supply voltage
805 * (such as voltage control on a motor controller).
806 *
807 * Minimum Value: 0.0
808 * Maximum Value: 0.1
809 * Default Value: 0
810 * Units: sec
811 */
813 /**
814 * \brief Maximum (forward) output during voltage based control modes.
815 *
816 * Minimum Value: -16
817 * Maximum Value: 16
818 * Default Value: 16
819 * Units: V
820 */
822 /**
823 * \brief Minimum (reverse) output during voltage based control modes.
824 *
825 * Minimum Value: -16
826 * Maximum Value: 16
827 * Default Value: -16
828 * Units: V
829 */
830 double PeakReverseVoltage = -16;
831
832 /**
833 * \brief Modifies this configuration's SupplyVoltageTimeConstant parameter and returns itself for
834 * method-chaining and easier to use config API.
835 * \param newSupplyVoltageTimeConstant Parameter to modify
836 * \returns Itself
837 */
838 VoltageConfigs& WithSupplyVoltageTimeConstant(double newSupplyVoltageTimeConstant)
839 {
840 SupplyVoltageTimeConstant = std::move(newSupplyVoltageTimeConstant);
841 return *this;
842 }
843 /**
844 * \brief Modifies this configuration's PeakForwardVoltage parameter and returns itself for
845 * method-chaining and easier to use config API.
846 * \param newPeakForwardVoltage Parameter to modify
847 * \returns Itself
848 */
849 VoltageConfigs& WithPeakForwardVoltage(double newPeakForwardVoltage)
850 {
851 PeakForwardVoltage = std::move(newPeakForwardVoltage);
852 return *this;
853 }
854 /**
855 * \brief Modifies this configuration's PeakReverseVoltage parameter and returns itself for
856 * method-chaining and easier to use config API.
857 * \param newPeakReverseVoltage Parameter to modify
858 * \returns Itself
859 */
860 VoltageConfigs& WithPeakReverseVoltage(double newPeakReverseVoltage)
861 {
862 PeakReverseVoltage = std::move(newPeakReverseVoltage);
863 return *this;
864 }
865
866
867
868 std::string ToString() const override
869 {
870 std::stringstream ss;
871 ss << "{" << std::endl;
872 ss << "Config Group: Voltage" << std::endl;
873 ss << "Name: \"SupplyVoltageTimeConstant\" Value: \"" << SupplyVoltageTimeConstant << "sec\"" << std::endl;
874 ss << "Name: \"PeakForwardVoltage\" Value: \"" << PeakForwardVoltage << "V\"" << std::endl;
875 ss << "Name: \"PeakReverseVoltage\" Value: \"" << PeakReverseVoltage << "V\"" << std::endl;
876 ss << "}" << std::endl;
877 return ss.str();
878 }
879
880 std::string Serialize() const override
881 {
882 std::stringstream ss;
883 char *ref;
884 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_SupplyVLowpassTau, SupplyVoltageTimeConstant, &ref); if (ref != nullptr) { ss << ref; free(ref); }
885 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakForwardV, PeakForwardVoltage, &ref); if (ref != nullptr) { ss << ref; free(ref); }
886 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakReverseV, PeakReverseVoltage, &ref); if (ref != nullptr) { ss << ref; free(ref); }
887 return ss.str();
888 }
889
890 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
891 {
892 const char *string_c_str = to_deserialize.c_str();
893 size_t string_length = to_deserialize.length();
894 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_SupplyVLowpassTau, string_c_str, string_length, &SupplyVoltageTimeConstant);
895 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakForwardV, string_c_str, string_length, &PeakForwardVoltage);
896 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakReverseV, string_c_str, string_length, &PeakReverseVoltage);
897 return 0;
898 }
899};
900
901
902/**
903 * \brief Configs to control the maximum and minimum applied torque
904 * when using Torque Current control types.
905 *
906 * \details Similar to peak output, but for the TorqueCurrentFOC
907 * control type requests.
908 */
910{
911public:
912 /**
913 * \brief Maximum (forward) output during torque current based control
914 * modes.
915 *
916 * Minimum Value: -800
917 * Maximum Value: 800
918 * Default Value: 800
919 * Units: A
920 */
922 /**
923 * \brief Minimum (reverse) output during torque current based control
924 * modes.
925 *
926 * Minimum Value: -800
927 * Maximum Value: 800
928 * Default Value: -800
929 * Units: A
930 */
932 /**
933 * \brief Configures the output deadband during torque current based
934 * control modes.
935 *
936 * Minimum Value: 0
937 * Maximum Value: 25
938 * Default Value: 0.0
939 * Units: A
940 */
942
943 /**
944 * \brief Modifies this configuration's PeakForwardTorqueCurrent parameter and returns itself for
945 * method-chaining and easier to use config API.
946 * \param newPeakForwardTorqueCurrent Parameter to modify
947 * \returns Itself
948 */
949 TorqueCurrentConfigs& WithPeakForwardTorqueCurrent(double newPeakForwardTorqueCurrent)
950 {
951 PeakForwardTorqueCurrent = std::move(newPeakForwardTorqueCurrent);
952 return *this;
953 }
954 /**
955 * \brief Modifies this configuration's PeakReverseTorqueCurrent parameter and returns itself for
956 * method-chaining and easier to use config API.
957 * \param newPeakReverseTorqueCurrent Parameter to modify
958 * \returns Itself
959 */
960 TorqueCurrentConfigs& WithPeakReverseTorqueCurrent(double newPeakReverseTorqueCurrent)
961 {
962 PeakReverseTorqueCurrent = std::move(newPeakReverseTorqueCurrent);
963 return *this;
964 }
965 /**
966 * \brief Modifies this configuration's TorqueNeutralDeadband parameter and returns itself for
967 * method-chaining and easier to use config API.
968 * \param newTorqueNeutralDeadband Parameter to modify
969 * \returns Itself
970 */
971 TorqueCurrentConfigs& WithTorqueNeutralDeadband(double newTorqueNeutralDeadband)
972 {
973 TorqueNeutralDeadband = std::move(newTorqueNeutralDeadband);
974 return *this;
975 }
976
977
978
979 std::string ToString() const override
980 {
981 std::stringstream ss;
982 ss << "{" << std::endl;
983 ss << "Config Group: TorqueCurrent" << std::endl;
984 ss << "Name: \"PeakForwardTorqueCurrent\" Value: \"" << PeakForwardTorqueCurrent << "A\"" << std::endl;
985 ss << "Name: \"PeakReverseTorqueCurrent\" Value: \"" << PeakReverseTorqueCurrent << "A\"" << std::endl;
986 ss << "Name: \"TorqueNeutralDeadband\" Value: \"" << TorqueNeutralDeadband << "A\"" << std::endl;
987 ss << "}" << std::endl;
988 return ss.str();
989 }
990
991 std::string Serialize() const override
992 {
993 std::stringstream ss;
994 char *ref;
995 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakForTorqCurr, PeakForwardTorqueCurrent, &ref); if (ref != nullptr) { ss << ref; free(ref); }
996 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakRevTorqCurr, PeakReverseTorqueCurrent, &ref); if (ref != nullptr) { ss << ref; free(ref); }
997 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_TorqueNeutralDB, TorqueNeutralDeadband, &ref); if (ref != nullptr) { ss << ref; free(ref); }
998 return ss.str();
999 }
1000
1001 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
1002 {
1003 const char *string_c_str = to_deserialize.c_str();
1004 size_t string_length = to_deserialize.length();
1005 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakForTorqCurr, string_c_str, string_length, &PeakForwardTorqueCurrent);
1006 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakRevTorqCurr, string_c_str, string_length, &PeakReverseTorqueCurrent);
1007 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_TorqueNeutralDB, string_c_str, string_length, &TorqueNeutralDeadband);
1008 return 0;
1009 }
1010};
1011
1012
1013/**
1014 * \brief Configs that affect the feedback of this motor controller.
1015 *
1016 * \details Includes feedback sensor source, any offsets for the
1017 * feedback sensor, and various ratios to describe the
1018 * relationship between the sensor and the mechanism for
1019 * closed looping.
1020 */
1022{
1023public:
1024 /**
1025 * \brief This offset is applied to the absolute integrated rotor
1026 * sensor. This can be used to zero the rotor in applications that
1027 * are within one rotor rotation.
1028 *
1029 * Minimum Value: -1
1030 * Maximum Value: 1
1031 * Default Value: 0.0
1032 * Units: rotations
1033 */
1035 /**
1036 * \brief This is the ratio of sensor rotations to the mechanism's
1037 * output. This is equivalent to the mechanism's gear ratio if the
1038 * sensor is located on the input of a gearbox. If sensor is on the
1039 * output of a gearbox, then this is typically set to 1. Note if this
1040 * is set to zero, device will reset back to one.
1041 *
1042 * Minimum Value: -1000
1043 * Maximum Value: 1000
1044 * Default Value: 1.0
1045 * Units: scalar
1046 */
1048 /**
1049 * \brief Talon FX is capable of fusing a remote CANcoder with its
1050 * rotor sensor to produce a high-bandwidth sensor source. This
1051 * feature requires specifying the ratio between the remote sensor and
1052 * the motor rotor. Note if this is set to zero, device will reset
1053 * back to one.
1054 *
1055 * Minimum Value: -1000
1056 * Maximum Value: 1000
1057 * Default Value: 1.0
1058 * Units: scalar
1059 */
1061 /**
1062 * \brief Choose what sensor source is reported via API and used by
1063 * closed-loop and limit features. The default is RotorSensor, which
1064 * uses the internal rotor sensor in the Talon FX. Choose
1065 * RemoteCANcoder to use another CANcoder on the same CAN bus (this
1066 * also requires setting FeedbackRemoteSensorID). Talon FX will
1067 * update its position and velocity whenever CANcoder publishes its
1068 * information on CAN bus. Choose FusedCANcoder (requires Phoenix
1069 * Pro) and Talon FX will fuse another CANcoder's information with the
1070 * internal rotor, which provides the best possible position and
1071 * velocity for accuracy and bandwidth (note this requires setting
1072 * FeedbackRemoteSensorID). FusedCANcoder was developed for
1073 * applications such as swerve-azimuth. Choose SyncCANcoder (requires
1074 * Phoenix Pro) and Talon FX will synchronize its internal rotor
1075 * position against another CANcoder, then continue to use the rotor
1076 * sensor for closed loop control (note this requires setting
1077 * FeedbackRemoteSensorID). The TalonFX will report if its internal
1078 * position differs significantly from the reported CANcoder position.
1079 * SyncCANcoder was developed for mechanisms where there is a risk of
1080 * the CANcoder failing in such a way that it reports a position that
1081 * does not match the mechanism, such as the sensor mounting assembly
1082 * breaking off. Choose RemotePigeon2_Yaw, RemotePigeon2_Pitch, and
1083 * RemotePigeon2_Roll to use another Pigeon2 on the same CAN bus (this
1084 * also requires setting FeedbackRemoteSensorID). Talon FX will
1085 * update its position to match the selected value whenever Pigeon2
1086 * publishes its information on CAN bus. Note that the Talon FX
1087 * position will be in rotations and not degrees.
1088 *
1089 * \details Note: When the Talon Source is changed to FusedCANcoder,
1090 * the Talon needs a period of time to fuse before sensor-based
1091 * (soft-limit, closed loop, etc.) features are used. This period of
1092 * time is determined by the update frequency of the CANcoder's
1093 * Position signal.
1094 *
1095 */
1097 /**
1098 * \brief Device ID of which remote device to use. This is not used
1099 * if the Sensor Source is the internal rotor sensor.
1100 *
1101 * Minimum Value: 0
1102 * Maximum Value: 62
1103 * Default Value: 0
1104 * Units:
1105 */
1107
1108 /**
1109 * \brief Modifies this configuration's FeedbackRotorOffset parameter and returns itself for
1110 * method-chaining and easier to use config API.
1111 * \param newFeedbackRotorOffset Parameter to modify
1112 * \returns Itself
1113 */
1114 FeedbackConfigs& WithFeedbackRotorOffset(double newFeedbackRotorOffset)
1115 {
1116 FeedbackRotorOffset = std::move(newFeedbackRotorOffset);
1117 return *this;
1118 }
1119 /**
1120 * \brief Modifies this configuration's SensorToMechanismRatio parameter and returns itself for
1121 * method-chaining and easier to use config API.
1122 * \param newSensorToMechanismRatio Parameter to modify
1123 * \returns Itself
1124 */
1125 FeedbackConfigs& WithSensorToMechanismRatio(double newSensorToMechanismRatio)
1126 {
1127 SensorToMechanismRatio = std::move(newSensorToMechanismRatio);
1128 return *this;
1129 }
1130 /**
1131 * \brief Modifies this configuration's RotorToSensorRatio parameter and returns itself for
1132 * method-chaining and easier to use config API.
1133 * \param newRotorToSensorRatio Parameter to modify
1134 * \returns Itself
1135 */
1136 FeedbackConfigs& WithRotorToSensorRatio(double newRotorToSensorRatio)
1137 {
1138 RotorToSensorRatio = std::move(newRotorToSensorRatio);
1139 return *this;
1140 }
1141 /**
1142 * \brief Modifies this configuration's FeedbackSensorSource parameter and returns itself for
1143 * method-chaining and easier to use config API.
1144 * \param newFeedbackSensorSource Parameter to modify
1145 * \returns Itself
1146 */
1148 {
1149 FeedbackSensorSource = std::move(newFeedbackSensorSource);
1150 return *this;
1151 }
1152 /**
1153 * \brief Modifies this configuration's FeedbackRemoteSensorID parameter and returns itself for
1154 * method-chaining and easier to use config API.
1155 * \param newFeedbackRemoteSensorID Parameter to modify
1156 * \returns Itself
1157 */
1158 FeedbackConfigs& WithFeedbackRemoteSensorID(int newFeedbackRemoteSensorID)
1159 {
1160 FeedbackRemoteSensorID = std::move(newFeedbackRemoteSensorID);
1161 return *this;
1162 }
1163
1164 /**
1165 * \brief Helper method to configure this feedback group to use Fused
1166 * CANcoder by passing in the CANcoder object
1167 *
1168 * \param device CANcoder reference to use for FusedCANcoder
1169 */
1171
1172 /**
1173 * \brief Helper method to configure this feedback group to use Remote
1174 * CANcoder by passing in the CANcoder object
1175 *
1176 * \param device CANcoder reference to use for FusedCANcoder
1177 */
1179
1180
1181
1182 std::string ToString() const override
1183 {
1184 std::stringstream ss;
1185 ss << "{" << std::endl;
1186 ss << "Config Group: Feedback" << std::endl;
1187 ss << "Name: \"FeedbackRotorOffset\" Value: \"" << FeedbackRotorOffset << "rotations\"" << std::endl;
1188 ss << "Name: \"SensorToMechanismRatio\" Value: \"" << SensorToMechanismRatio << "scalar\"" << std::endl;
1189 ss << "Name: \"RotorToSensorRatio\" Value: \"" << RotorToSensorRatio << "scalar\"" << std::endl;
1190 ss << "Name: \"FeedbackSensorSource\" Value: \"" << FeedbackSensorSource << "\"" << std::endl;
1191 ss << "Name: \"FeedbackRemoteSensorID\" Value: \"" << FeedbackRemoteSensorID << "\"" << std::endl;
1192 ss << "}" << std::endl;
1193 return ss.str();
1194 }
1195
1196 std::string Serialize() const override
1197 {
1198 std::stringstream ss;
1199 char *ref;
1200 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_FeedbackRotorOffset, FeedbackRotorOffset, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1201 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_SensorToMechanismRatio, SensorToMechanismRatio, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1202 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_RotorToSensorRatio, RotorToSensorRatio, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1203 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_FeedbackSensorSource, FeedbackSensorSource.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1204 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_FeedbackRemoteSensorID, FeedbackRemoteSensorID, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1205 return ss.str();
1206 }
1207
1208 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
1209 {
1210 const char *string_c_str = to_deserialize.c_str();
1211 size_t string_length = to_deserialize.length();
1212 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_FeedbackRotorOffset, string_c_str, string_length, &FeedbackRotorOffset);
1213 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_SensorToMechanismRatio, string_c_str, string_length, &SensorToMechanismRatio);
1214 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_RotorToSensorRatio, string_c_str, string_length, &RotorToSensorRatio);
1215 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_FeedbackSensorSource, string_c_str, string_length, &FeedbackSensorSource.value);
1216 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_FeedbackRemoteSensorID, string_c_str, string_length, &FeedbackRemoteSensorID);
1217 return 0;
1218 }
1219};
1220
1221
1222/**
1223 * \brief Configs related to sensors used for differential control of
1224 * a mechanism.
1225 *
1226 * \details Includes the differential sensor sources and IDs.
1227 */
1229{
1230public:
1231 /**
1232 * \brief Choose what sensor source is used for differential control
1233 * of a mechanism. The default is Disabled. All other options
1234 * require setting the DifferentialTalonFXSensorID, as the average of
1235 * this Talon FX's sensor and the remote TalonFX's sensor is used for
1236 * the differential controller's primary targets. Choose
1237 * RemoteTalonFX_Diff to use another TalonFX on the same CAN bus.
1238 * Talon FX will update its differential position and velocity
1239 * whenever the remote TalonFX publishes its information on CAN bus.
1240 * The differential controller will use the difference between this
1241 * TalonFX's sensor and the remote Talon FX's sensor for the
1242 * differential component of the output. Choose RemotePigeon2_Yaw,
1243 * RemotePigeon2_Pitch, and RemotePigeon2_Roll to use another Pigeon2
1244 * on the same CAN bus (this also requires setting
1245 * DifferentialRemoteSensorID). Talon FX will update its differential
1246 * position to match the selected value whenever Pigeon2 publishes its
1247 * information on CAN bus. Note that the Talon FX differential
1248 * position will be in rotations and not degrees. Choose
1249 * RemoteCANcoder to use another CANcoder on the same CAN bus (this
1250 * also requires setting DifferentialRemoteSensorID). Talon FX will
1251 * update its differential position and velocity to match the CANcoder
1252 * whenever CANcoder publishes its information on CAN bus.
1253 *
1254 */
1256 /**
1257 * \brief Device ID of which remote Talon FX to use. This is used
1258 * when the Differential Sensor Source is not disabled.
1259 *
1260 * Minimum Value: 0
1261 * Maximum Value: 62
1262 * Default Value: 0
1263 * Units:
1264 */
1266 /**
1267 * \brief Device ID of which remote sensor to use on the differential
1268 * axis. This is used when the Differential Sensor Source is not
1269 * RemoteTalonFX_Diff.
1270 *
1271 * Minimum Value: 0
1272 * Maximum Value: 62
1273 * Default Value: 0
1274 * Units:
1275 */
1277
1278 /**
1279 * \brief Modifies this configuration's DifferentialSensorSource parameter and returns itself for
1280 * method-chaining and easier to use config API.
1281 * \param newDifferentialSensorSource Parameter to modify
1282 * \returns Itself
1283 */
1285 {
1286 DifferentialSensorSource = std::move(newDifferentialSensorSource);
1287 return *this;
1288 }
1289 /**
1290 * \brief Modifies this configuration's DifferentialTalonFXSensorID parameter and returns itself for
1291 * method-chaining and easier to use config API.
1292 * \param newDifferentialTalonFXSensorID Parameter to modify
1293 * \returns Itself
1294 */
1296 {
1297 DifferentialTalonFXSensorID = std::move(newDifferentialTalonFXSensorID);
1298 return *this;
1299 }
1300 /**
1301 * \brief Modifies this configuration's DifferentialRemoteSensorID parameter and returns itself for
1302 * method-chaining and easier to use config API.
1303 * \param newDifferentialRemoteSensorID Parameter to modify
1304 * \returns Itself
1305 */
1307 {
1308 DifferentialRemoteSensorID = std::move(newDifferentialRemoteSensorID);
1309 return *this;
1310 }
1311
1312
1313
1314 std::string ToString() const override
1315 {
1316 std::stringstream ss;
1317 ss << "{" << std::endl;
1318 ss << "Config Group: DifferentialSensors" << std::endl;
1319 ss << "Name: \"DifferentialSensorSource\" Value: \"" << DifferentialSensorSource << "\"" << std::endl;
1320 ss << "Name: \"DifferentialTalonFXSensorID\" Value: \"" << DifferentialTalonFXSensorID << "\"" << std::endl;
1321 ss << "Name: \"DifferentialRemoteSensorID\" Value: \"" << DifferentialRemoteSensorID << "\"" << std::endl;
1322 ss << "}" << std::endl;
1323 return ss.str();
1324 }
1325
1326 std::string Serialize() const override
1327 {
1328 std::stringstream ss;
1329 char *ref;
1330 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_DifferentialSensorSource, DifferentialSensorSource.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1331 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_DifferentialTalonFXSensorID, DifferentialTalonFXSensorID, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1332 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_DifferentialRemoteSensorID, DifferentialRemoteSensorID, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1333 return ss.str();
1334 }
1335
1336 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
1337 {
1338 const char *string_c_str = to_deserialize.c_str();
1339 size_t string_length = to_deserialize.length();
1340 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_DifferentialSensorSource, string_c_str, string_length, &DifferentialSensorSource.value);
1341 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_DifferentialTalonFXSensorID, string_c_str, string_length, &DifferentialTalonFXSensorID);
1342 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_DifferentialRemoteSensorID, string_c_str, string_length, &DifferentialRemoteSensorID);
1343 return 0;
1344 }
1345};
1346
1347
1348/**
1349 * \brief Configs related to constants used for differential control
1350 * of a mechanism.
1351 *
1352 * \details Includes the differential peak outputs.
1353 */
1355{
1356public:
1357 /**
1358 * \brief Maximum differential output during duty cycle based
1359 * differential control modes.
1360 *
1361 * Minimum Value: 0.0
1362 * Maximum Value: 2.0
1363 * Default Value: 2
1364 * Units: fractional
1365 */
1367 /**
1368 * \brief Maximum differential output during voltage based
1369 * differential control modes.
1370 *
1371 * Minimum Value: 0.0
1372 * Maximum Value: 32
1373 * Default Value: 32
1374 * Units: V
1375 */
1377 /**
1378 * \brief Maximum differential output during torque current based
1379 * differential control modes.
1380 *
1381 * Minimum Value: 0.0
1382 * Maximum Value: 1600
1383 * Default Value: 1600
1384 * Units: A
1385 */
1387
1388 /**
1389 * \brief Modifies this configuration's PeakDifferentialDutyCycle parameter and returns itself for
1390 * method-chaining and easier to use config API.
1391 * \param newPeakDifferentialDutyCycle Parameter to modify
1392 * \returns Itself
1393 */
1395 {
1396 PeakDifferentialDutyCycle = std::move(newPeakDifferentialDutyCycle);
1397 return *this;
1398 }
1399 /**
1400 * \brief Modifies this configuration's PeakDifferentialVoltage parameter and returns itself for
1401 * method-chaining and easier to use config API.
1402 * \param newPeakDifferentialVoltage Parameter to modify
1403 * \returns Itself
1404 */
1406 {
1407 PeakDifferentialVoltage = std::move(newPeakDifferentialVoltage);
1408 return *this;
1409 }
1410 /**
1411 * \brief Modifies this configuration's PeakDifferentialTorqueCurrent parameter and returns itself for
1412 * method-chaining and easier to use config API.
1413 * \param newPeakDifferentialTorqueCurrent Parameter to modify
1414 * \returns Itself
1415 */
1416 DifferentialConstantsConfigs& WithPeakDifferentialTorqueCurrent(double newPeakDifferentialTorqueCurrent)
1417 {
1418 PeakDifferentialTorqueCurrent = std::move(newPeakDifferentialTorqueCurrent);
1419 return *this;
1420 }
1421
1422
1423
1424 std::string ToString() const override
1425 {
1426 std::stringstream ss;
1427 ss << "{" << std::endl;
1428 ss << "Config Group: DifferentialConstants" << std::endl;
1429 ss << "Name: \"PeakDifferentialDutyCycle\" Value: \"" << PeakDifferentialDutyCycle << "fractional\"" << std::endl;
1430 ss << "Name: \"PeakDifferentialVoltage\" Value: \"" << PeakDifferentialVoltage << "V\"" << std::endl;
1431 ss << "Name: \"PeakDifferentialTorqueCurrent\" Value: \"" << PeakDifferentialTorqueCurrent << "A\"" << std::endl;
1432 ss << "}" << std::endl;
1433 return ss.str();
1434 }
1435
1436 std::string Serialize() const override
1437 {
1438 std::stringstream ss;
1439 char *ref;
1440 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakDiffDC, PeakDifferentialDutyCycle, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1441 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakDiffV, PeakDifferentialVoltage, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1442 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakDiffTorqCurr, PeakDifferentialTorqueCurrent, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1443 return ss.str();
1444 }
1445
1446 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
1447 {
1448 const char *string_c_str = to_deserialize.c_str();
1449 size_t string_length = to_deserialize.length();
1450 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakDiffDC, string_c_str, string_length, &PeakDifferentialDutyCycle);
1451 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakDiffV, string_c_str, string_length, &PeakDifferentialVoltage);
1452 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_PeakDiffTorqCurr, string_c_str, string_length, &PeakDifferentialTorqueCurrent);
1453 return 0;
1454 }
1455};
1456
1457
1458/**
1459 * \brief Configs that affect the open-loop control of this motor
1460 * controller.
1461 *
1462 * \details Open-loop ramp rates for the various control types.
1463 */
1465{
1466public:
1467 /**
1468 * \brief If non-zero, this determines how much time to ramp from 0%
1469 * output to 100% during open-loop modes.
1470 *
1471 * Minimum Value: 0
1472 * Maximum Value: 1
1473 * Default Value: 0
1474 * Units: sec
1475 */
1477 /**
1478 * \brief If non-zero, this determines how much time to ramp from 0V
1479 * output to 12V during open-loop modes.
1480 *
1481 * Minimum Value: 0
1482 * Maximum Value: 1
1483 * Default Value: 0
1484 * Units: sec
1485 */
1487 /**
1488 * \brief If non-zero, this determines how much time to ramp from 0A
1489 * output to 300A during open-loop modes.
1490 *
1491 * Minimum Value: 0
1492 * Maximum Value: 10
1493 * Default Value: 0
1494 * Units: sec
1495 */
1497
1498 /**
1499 * \brief Modifies this configuration's DutyCycleOpenLoopRampPeriod parameter and returns itself for
1500 * method-chaining and easier to use config API.
1501 * \param newDutyCycleOpenLoopRampPeriod Parameter to modify
1502 * \returns Itself
1503 */
1504 OpenLoopRampsConfigs& WithDutyCycleOpenLoopRampPeriod(double newDutyCycleOpenLoopRampPeriod)
1505 {
1506 DutyCycleOpenLoopRampPeriod = std::move(newDutyCycleOpenLoopRampPeriod);
1507 return *this;
1508 }
1509 /**
1510 * \brief Modifies this configuration's VoltageOpenLoopRampPeriod parameter and returns itself for
1511 * method-chaining and easier to use config API.
1512 * \param newVoltageOpenLoopRampPeriod Parameter to modify
1513 * \returns Itself
1514 */
1515 OpenLoopRampsConfigs& WithVoltageOpenLoopRampPeriod(double newVoltageOpenLoopRampPeriod)
1516 {
1517 VoltageOpenLoopRampPeriod = std::move(newVoltageOpenLoopRampPeriod);
1518 return *this;
1519 }
1520 /**
1521 * \brief Modifies this configuration's TorqueOpenLoopRampPeriod parameter and returns itself for
1522 * method-chaining and easier to use config API.
1523 * \param newTorqueOpenLoopRampPeriod Parameter to modify
1524 * \returns Itself
1525 */
1526 OpenLoopRampsConfigs& WithTorqueOpenLoopRampPeriod(double newTorqueOpenLoopRampPeriod)
1527 {
1528 TorqueOpenLoopRampPeriod = std::move(newTorqueOpenLoopRampPeriod);
1529 return *this;
1530 }
1531
1532
1533
1534 std::string ToString() const override
1535 {
1536 std::stringstream ss;
1537 ss << "{" << std::endl;
1538 ss << "Config Group: OpenLoopRamps" << std::endl;
1539 ss << "Name: \"DutyCycleOpenLoopRampPeriod\" Value: \"" << DutyCycleOpenLoopRampPeriod << "sec\"" << std::endl;
1540 ss << "Name: \"VoltageOpenLoopRampPeriod\" Value: \"" << VoltageOpenLoopRampPeriod << "sec\"" << std::endl;
1541 ss << "Name: \"TorqueOpenLoopRampPeriod\" Value: \"" << TorqueOpenLoopRampPeriod << "sec\"" << std::endl;
1542 ss << "}" << std::endl;
1543 return ss.str();
1544 }
1545
1546 std::string Serialize() const override
1547 {
1548 std::stringstream ss;
1549 char *ref;
1550 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_DutyCycleOpenLoopRampPeriod, DutyCycleOpenLoopRampPeriod, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1551 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_VoltageOpenLoopRampPeriod, VoltageOpenLoopRampPeriod, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1552 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_TorqueOpenLoopRampPeriod, TorqueOpenLoopRampPeriod, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1553 return ss.str();
1554 }
1555
1556 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
1557 {
1558 const char *string_c_str = to_deserialize.c_str();
1559 size_t string_length = to_deserialize.length();
1560 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_DutyCycleOpenLoopRampPeriod, string_c_str, string_length, &DutyCycleOpenLoopRampPeriod);
1561 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_VoltageOpenLoopRampPeriod, string_c_str, string_length, &VoltageOpenLoopRampPeriod);
1562 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_TorqueOpenLoopRampPeriod, string_c_str, string_length, &TorqueOpenLoopRampPeriod);
1563 return 0;
1564 }
1565};
1566
1567
1568/**
1569 * \brief Configs that affect the closed-loop control of this motor
1570 * controller.
1571 *
1572 * \details Closed-loop ramp rates for the various control types.
1573 */
1575{
1576public:
1577 /**
1578 * \brief If non-zero, this determines how much time to ramp from 0%
1579 * output to 100% during closed-loop modes.
1580 *
1581 * Minimum Value: 0
1582 * Maximum Value: 1
1583 * Default Value: 0
1584 * Units: sec
1585 */
1587 /**
1588 * \brief If non-zero, this determines how much time to ramp from 0V
1589 * output to 12V during closed-loop modes.
1590 *
1591 * Minimum Value: 0
1592 * Maximum Value: 1
1593 * Default Value: 0
1594 * Units: sec
1595 */
1597 /**
1598 * \brief If non-zero, this determines how much time to ramp from 0A
1599 * output to 300A during closed-loop modes.
1600 *
1601 * Minimum Value: 0
1602 * Maximum Value: 10
1603 * Default Value: 0
1604 * Units: sec
1605 */
1607
1608 /**
1609 * \brief Modifies this configuration's DutyCycleClosedLoopRampPeriod parameter and returns itself for
1610 * method-chaining and easier to use config API.
1611 * \param newDutyCycleClosedLoopRampPeriod Parameter to modify
1612 * \returns Itself
1613 */
1614 ClosedLoopRampsConfigs& WithDutyCycleClosedLoopRampPeriod(double newDutyCycleClosedLoopRampPeriod)
1615 {
1616 DutyCycleClosedLoopRampPeriod = std::move(newDutyCycleClosedLoopRampPeriod);
1617 return *this;
1618 }
1619 /**
1620 * \brief Modifies this configuration's VoltageClosedLoopRampPeriod parameter and returns itself for
1621 * method-chaining and easier to use config API.
1622 * \param newVoltageClosedLoopRampPeriod Parameter to modify
1623 * \returns Itself
1624 */
1625 ClosedLoopRampsConfigs& WithVoltageClosedLoopRampPeriod(double newVoltageClosedLoopRampPeriod)
1626 {
1627 VoltageClosedLoopRampPeriod = std::move(newVoltageClosedLoopRampPeriod);
1628 return *this;
1629 }
1630 /**
1631 * \brief Modifies this configuration's TorqueClosedLoopRampPeriod parameter and returns itself for
1632 * method-chaining and easier to use config API.
1633 * \param newTorqueClosedLoopRampPeriod Parameter to modify
1634 * \returns Itself
1635 */
1636 ClosedLoopRampsConfigs& WithTorqueClosedLoopRampPeriod(double newTorqueClosedLoopRampPeriod)
1637 {
1638 TorqueClosedLoopRampPeriod = std::move(newTorqueClosedLoopRampPeriod);
1639 return *this;
1640 }
1641
1642
1643
1644 std::string ToString() const override
1645 {
1646 std::stringstream ss;
1647 ss << "{" << std::endl;
1648 ss << "Config Group: ClosedLoopRamps" << std::endl;
1649 ss << "Name: \"DutyCycleClosedLoopRampPeriod\" Value: \"" << DutyCycleClosedLoopRampPeriod << "sec\"" << std::endl;
1650 ss << "Name: \"VoltageClosedLoopRampPeriod\" Value: \"" << VoltageClosedLoopRampPeriod << "sec\"" << std::endl;
1651 ss << "Name: \"TorqueClosedLoopRampPeriod\" Value: \"" << TorqueClosedLoopRampPeriod << "sec\"" << std::endl;
1652 ss << "}" << std::endl;
1653 return ss.str();
1654 }
1655
1656 std::string Serialize() const override
1657 {
1658 std::stringstream ss;
1659 char *ref;
1660 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_DutyCycleClosedLoopRampPeriod, DutyCycleClosedLoopRampPeriod, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1661 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_VoltageClosedLoopRampPeriod, VoltageClosedLoopRampPeriod, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1662 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_TorqueClosedLoopRampPeriod, TorqueClosedLoopRampPeriod, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1663 return ss.str();
1664 }
1665
1666 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
1667 {
1668 const char *string_c_str = to_deserialize.c_str();
1669 size_t string_length = to_deserialize.length();
1670 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_DutyCycleClosedLoopRampPeriod, string_c_str, string_length, &DutyCycleClosedLoopRampPeriod);
1671 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_VoltageClosedLoopRampPeriod, string_c_str, string_length, &VoltageClosedLoopRampPeriod);
1672 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_TorqueClosedLoopRampPeriod, string_c_str, string_length, &TorqueClosedLoopRampPeriod);
1673 return 0;
1674 }
1675};
1676
1677
1678/**
1679 * \brief Configs that change how the motor controller behaves under
1680 * different limit switch statse.
1681 *
1682 * \details Includes configs such as enabling limit switches,
1683 * configuring the remote sensor ID, the source, and the
1684 * position to set on limit.
1685 */
1687{
1688public:
1689 /**
1690 * \brief Determines if limit is normally-open (default) or
1691 * normally-closed.
1692 *
1693 */
1695 /**
1696 * \brief If enabled, the position is auto-set to a specific value,
1697 * specified by ForwardLimitAutosetPositionValue
1698 *
1699 * Default Value: False
1700 */
1702 /**
1703 * \brief The value to auto-set the position to. This has no effect
1704 * if ForwardLimitAutosetPositionEnable is false.
1705 *
1706 * Minimum Value: -3.4e+38
1707 * Maximum Value: 3.4e+38
1708 * Default Value: 0
1709 * Units: rotations
1710 */
1712 /**
1713 * \brief If enabled, motor output is set to neutral when forward
1714 * limit switch is asseted and positive output is requested.
1715 *
1716 * Default Value: True
1717 */
1719 /**
1720 * \brief Determines where to poll the forward limit switch. This
1721 * defaults to the limit switch pin on the limit switch connector.
1722 *
1723 */
1725 /**
1726 * \brief Device ID of the device if using remote limit switch
1727 * features.
1728 *
1729 * Minimum Value: 0
1730 * Maximum Value: 62
1731 * Default Value: 0
1732 * Units:
1733 */
1735 /**
1736 * \brief Determines if limit is normally-open (default) or
1737 * normally-closed.
1738 *
1739 */
1741 /**
1742 * \brief If enabled, the position is auto-set to a specific value,
1743 * specified by ReverseLimitAutosetPositionValue
1744 *
1745 * Default Value: False
1746 */
1748 /**
1749 * \brief The value to auto-set the position to. This has no effect
1750 * if ReverseLimitAutosetPositionEnable is false.
1751 *
1752 * Minimum Value: -3.4e+38
1753 * Maximum Value: 3.4e+38
1754 * Default Value: 0
1755 * Units: rotations
1756 */
1758 /**
1759 * \brief If enabled, motor output is set to neutral when reverse
1760 * limit switch is asseted and positive output is requested.
1761 *
1762 * Default Value: True
1763 */
1765 /**
1766 * \brief Determines where to poll the reverse limit switch. This
1767 * defaults to the limit switch pin on the limit switch connector.
1768 *
1769 */
1771 /**
1772 * \brief Device ID of the device if using remote limit switch
1773 * features.
1774 *
1775 * Minimum Value: 0
1776 * Maximum Value: 62
1777 * Default Value: 0
1778 * Units:
1779 */
1781
1782 /**
1783 * \brief Modifies this configuration's ForwardLimitType parameter and returns itself for
1784 * method-chaining and easier to use config API.
1785 * \param newForwardLimitType Parameter to modify
1786 * \returns Itself
1787 */
1789 {
1790 ForwardLimitType = std::move(newForwardLimitType);
1791 return *this;
1792 }
1793 /**
1794 * \brief Modifies this configuration's ForwardLimitAutosetPositionEnable parameter and returns itself for
1795 * method-chaining and easier to use config API.
1796 * \param newForwardLimitAutosetPositionEnable Parameter to modify
1797 * \returns Itself
1798 */
1799 HardwareLimitSwitchConfigs& WithForwardLimitAutosetPositionEnable(bool newForwardLimitAutosetPositionEnable)
1800 {
1801 ForwardLimitAutosetPositionEnable = std::move(newForwardLimitAutosetPositionEnable);
1802 return *this;
1803 }
1804 /**
1805 * \brief Modifies this configuration's ForwardLimitAutosetPositionValue parameter and returns itself for
1806 * method-chaining and easier to use config API.
1807 * \param newForwardLimitAutosetPositionValue Parameter to modify
1808 * \returns Itself
1809 */
1810 HardwareLimitSwitchConfigs& WithForwardLimitAutosetPositionValue(double newForwardLimitAutosetPositionValue)
1811 {
1812 ForwardLimitAutosetPositionValue = std::move(newForwardLimitAutosetPositionValue);
1813 return *this;
1814 }
1815 /**
1816 * \brief Modifies this configuration's ForwardLimitEnable parameter and returns itself for
1817 * method-chaining and easier to use config API.
1818 * \param newForwardLimitEnable Parameter to modify
1819 * \returns Itself
1820 */
1822 {
1823 ForwardLimitEnable = std::move(newForwardLimitEnable);
1824 return *this;
1825 }
1826 /**
1827 * \brief Modifies this configuration's ForwardLimitSource parameter and returns itself for
1828 * method-chaining and easier to use config API.
1829 * \param newForwardLimitSource Parameter to modify
1830 * \returns Itself
1831 */
1833 {
1834 ForwardLimitSource = std::move(newForwardLimitSource);
1835 return *this;
1836 }
1837 /**
1838 * \brief Modifies this configuration's ForwardLimitRemoteSensorID parameter and returns itself for
1839 * method-chaining and easier to use config API.
1840 * \param newForwardLimitRemoteSensorID Parameter to modify
1841 * \returns Itself
1842 */
1844 {
1845 ForwardLimitRemoteSensorID = std::move(newForwardLimitRemoteSensorID);
1846 return *this;
1847 }
1848 /**
1849 * \brief Modifies this configuration's ReverseLimitType parameter and returns itself for
1850 * method-chaining and easier to use config API.
1851 * \param newReverseLimitType Parameter to modify
1852 * \returns Itself
1853 */
1855 {
1856 ReverseLimitType = std::move(newReverseLimitType);
1857 return *this;
1858 }
1859 /**
1860 * \brief Modifies this configuration's ReverseLimitAutosetPositionEnable parameter and returns itself for
1861 * method-chaining and easier to use config API.
1862 * \param newReverseLimitAutosetPositionEnable Parameter to modify
1863 * \returns Itself
1864 */
1865 HardwareLimitSwitchConfigs& WithReverseLimitAutosetPositionEnable(bool newReverseLimitAutosetPositionEnable)
1866 {
1867 ReverseLimitAutosetPositionEnable = std::move(newReverseLimitAutosetPositionEnable);
1868 return *this;
1869 }
1870 /**
1871 * \brief Modifies this configuration's ReverseLimitAutosetPositionValue parameter and returns itself for
1872 * method-chaining and easier to use config API.
1873 * \param newReverseLimitAutosetPositionValue Parameter to modify
1874 * \returns Itself
1875 */
1876 HardwareLimitSwitchConfigs& WithReverseLimitAutosetPositionValue(double newReverseLimitAutosetPositionValue)
1877 {
1878 ReverseLimitAutosetPositionValue = std::move(newReverseLimitAutosetPositionValue);
1879 return *this;
1880 }
1881 /**
1882 * \brief Modifies this configuration's ReverseLimitEnable parameter and returns itself for
1883 * method-chaining and easier to use config API.
1884 * \param newReverseLimitEnable Parameter to modify
1885 * \returns Itself
1886 */
1888 {
1889 ReverseLimitEnable = std::move(newReverseLimitEnable);
1890 return *this;
1891 }
1892 /**
1893 * \brief Modifies this configuration's ReverseLimitSource parameter and returns itself for
1894 * method-chaining and easier to use config API.
1895 * \param newReverseLimitSource Parameter to modify
1896 * \returns Itself
1897 */
1899 {
1900 ReverseLimitSource = std::move(newReverseLimitSource);
1901 return *this;
1902 }
1903 /**
1904 * \brief Modifies this configuration's ReverseLimitRemoteSensorID parameter and returns itself for
1905 * method-chaining and easier to use config API.
1906 * \param newReverseLimitRemoteSensorID Parameter to modify
1907 * \returns Itself
1908 */
1910 {
1911 ReverseLimitRemoteSensorID = std::move(newReverseLimitRemoteSensorID);
1912 return *this;
1913 }
1914
1915
1916
1917 std::string ToString() const override
1918 {
1919 std::stringstream ss;
1920 ss << "{" << std::endl;
1921 ss << "Config Group: HardwareLimitSwitch" << std::endl;
1922 ss << "Name: \"ForwardLimitType\" Value: \"" << ForwardLimitType << "\"" << std::endl;
1923 ss << "Name: \"ForwardLimitAutosetPositionEnable\" Value: \"" << ForwardLimitAutosetPositionEnable << "\"" << std::endl;
1924 ss << "Name: \"ForwardLimitAutosetPositionValue\" Value: \"" << ForwardLimitAutosetPositionValue << "rotations\"" << std::endl;
1925 ss << "Name: \"ForwardLimitEnable\" Value: \"" << ForwardLimitEnable << "\"" << std::endl;
1926 ss << "Name: \"ForwardLimitSource\" Value: \"" << ForwardLimitSource << "\"" << std::endl;
1927 ss << "Name: \"ForwardLimitRemoteSensorID\" Value: \"" << ForwardLimitRemoteSensorID << "\"" << std::endl;
1928 ss << "Name: \"ReverseLimitType\" Value: \"" << ReverseLimitType << "\"" << std::endl;
1929 ss << "Name: \"ReverseLimitAutosetPositionEnable\" Value: \"" << ReverseLimitAutosetPositionEnable << "\"" << std::endl;
1930 ss << "Name: \"ReverseLimitAutosetPositionValue\" Value: \"" << ReverseLimitAutosetPositionValue << "rotations\"" << std::endl;
1931 ss << "Name: \"ReverseLimitEnable\" Value: \"" << ReverseLimitEnable << "\"" << std::endl;
1932 ss << "Name: \"ReverseLimitSource\" Value: \"" << ReverseLimitSource << "\"" << std::endl;
1933 ss << "Name: \"ReverseLimitRemoteSensorID\" Value: \"" << ReverseLimitRemoteSensorID << "\"" << std::endl;
1934 ss << "}" << std::endl;
1935 return ss.str();
1936 }
1937
1938 std::string Serialize() const override
1939 {
1940 std::stringstream ss;
1941 char *ref;
1942 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitType, ForwardLimitType.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1943 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitAutosetPosEnable, ForwardLimitAutosetPositionEnable, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1944 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitAutosetPosValue, ForwardLimitAutosetPositionValue, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1945 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitEnable, ForwardLimitEnable, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1946 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitSource, ForwardLimitSource.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1947 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitRemoteSensorID, ForwardLimitRemoteSensorID, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1948 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitType, ReverseLimitType.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1949 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitAutosetPosEnable, ReverseLimitAutosetPositionEnable, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1950 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitAutosetPosValue, ReverseLimitAutosetPositionValue, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1951 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitEnable, ReverseLimitEnable, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1952 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitSource, ReverseLimitSource.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1953 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitRemoteSensorID, ReverseLimitRemoteSensorID, &ref); if (ref != nullptr) { ss << ref; free(ref); }
1954 return ss.str();
1955 }
1956
1957 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
1958 {
1959 const char *string_c_str = to_deserialize.c_str();
1960 size_t string_length = to_deserialize.length();
1961 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitType, string_c_str, string_length, &ForwardLimitType.value);
1962 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitAutosetPosEnable, string_c_str, string_length, &ForwardLimitAutosetPositionEnable);
1963 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitAutosetPosValue, string_c_str, string_length, &ForwardLimitAutosetPositionValue);
1964 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitEnable, string_c_str, string_length, &ForwardLimitEnable);
1965 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitSource, string_c_str, string_length, &ForwardLimitSource.value);
1966 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_ForwardLimitRemoteSensorID, string_c_str, string_length, &ForwardLimitRemoteSensorID);
1967 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitType, string_c_str, string_length, &ReverseLimitType.value);
1968 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitAutosetPosEnable, string_c_str, string_length, &ReverseLimitAutosetPositionEnable);
1969 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitAutosetPosValue, string_c_str, string_length, &ReverseLimitAutosetPositionValue);
1970 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitEnable, string_c_str, string_length, &ReverseLimitEnable);
1971 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitSource, string_c_str, string_length, &ReverseLimitSource.value);
1972 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Config_ReverseLimitRemoteSensorID, string_c_str, string_length, &ReverseLimitRemoteSensorID);
1973 return 0;
1974 }
1975};
1976
1977
1978/**
1979 * \brief Configs that affect audible components of the device.
1980 *
1981 * \details Includes configuration for the beep on boot.
1982 */
1984{
1985public:
1986 /**
1987 * \brief If true, the TalonFX will beep during boot-up. This is
1988 * useful for general debugging, and defaults to true. If rotor is
1989 * moving during boot-up, the beep will not occur regardless of this
1990 * setting.
1991 *
1992 * Default Value: True
1993 */
1994 bool BeepOnBoot = true;
1995 /**
1996 * \brief If true, the TalonFX will beep during configuration API
1997 * calls if device is disabled. This is useful for general debugging,
1998 * and defaults to true. Note that if the rotor is moving, the beep
1999 * will not occur regardless of this setting.
2000 *
2001 * Default Value: True
2002 */
2003 bool BeepOnConfig = true;
2004 /**
2005 * \brief If true, the TalonFX will allow Orchestra and MusicTone
2006 * requests during disabled state. This can be used to address corner
2007 * cases when music features are needed when disabled. This setting
2008 * defaults to false. Note that if the rotor is moving, music
2009 * features are always disabled regardless of this setting.
2010 *
2011 * Default Value: False
2012 */
2014
2015 /**
2016 * \brief Modifies this configuration's BeepOnBoot parameter and returns itself for
2017 * method-chaining and easier to use config API.
2018 * \param newBeepOnBoot Parameter to modify
2019 * \returns Itself
2020 */
2021 AudioConfigs& WithBeepOnBoot(bool newBeepOnBoot)
2022 {
2023 BeepOnBoot = std::move(newBeepOnBoot);
2024 return *this;
2025 }
2026 /**
2027 * \brief Modifies this configuration's BeepOnConfig parameter and returns itself for
2028 * method-chaining and easier to use config API.
2029 * \param newBeepOnConfig Parameter to modify
2030 * \returns Itself
2031 */
2032 AudioConfigs& WithBeepOnConfig(bool newBeepOnConfig)
2033 {
2034 BeepOnConfig = std::move(newBeepOnConfig);
2035 return *this;
2036 }
2037 /**
2038 * \brief Modifies this configuration's AllowMusicDurDisable parameter and returns itself for
2039 * method-chaining and easier to use config API.
2040 * \param newAllowMusicDurDisable Parameter to modify
2041 * \returns Itself
2042 */
2043 AudioConfigs& WithAllowMusicDurDisable(bool newAllowMusicDurDisable)
2044 {
2045 AllowMusicDurDisable = std::move(newAllowMusicDurDisable);
2046 return *this;
2047 }
2048
2049
2050
2051 std::string ToString() const override
2052 {
2053 std::stringstream ss;
2054 ss << "{" << std::endl;
2055 ss << "Config Group: Audio" << std::endl;
2056 ss << "Name: \"BeepOnBoot\" Value: \"" << BeepOnBoot << "\"" << std::endl;
2057 ss << "Name: \"BeepOnConfig\" Value: \"" << BeepOnConfig << "\"" << std::endl;
2058 ss << "Name: \"AllowMusicDurDisable\" Value: \"" << AllowMusicDurDisable << "\"" << std::endl;
2059 ss << "}" << std::endl;
2060 return ss.str();
2061 }
2062
2063 std::string Serialize() const override
2064 {
2065 std::stringstream ss;
2066 char *ref;
2067 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_BeepOnBoot, BeepOnBoot, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2068 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_BeepOnConfig, BeepOnConfig, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2069 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_AllowMusicDurDisable, AllowMusicDurDisable, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2070 return ss.str();
2071 }
2072
2073 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
2074 {
2075 const char *string_c_str = to_deserialize.c_str();
2076 size_t string_length = to_deserialize.length();
2077 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_BeepOnBoot, string_c_str, string_length, &BeepOnBoot);
2078 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_BeepOnConfig, string_c_str, string_length, &BeepOnConfig);
2079 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_AllowMusicDurDisable, string_c_str, string_length, &AllowMusicDurDisable);
2080 return 0;
2081 }
2082};
2083
2084
2085/**
2086 * \brief Configs that affect how software-limit switches behave.
2087 *
2088 * \details Includes enabling software-limit switches and the
2089 * threshold at which they're tripped.
2090 */
2092{
2093public:
2094 /**
2095 * \brief If enabled, the motor output is set to neutral if position
2096 * exceeds ForwardSoftLimitThreshold and forward output is requested.
2097 *
2098 * Default Value: False
2099 */
2101 /**
2102 * \brief If enabled, the motor output is set to neutral if position
2103 * exceeds ReverseSoftLimitThreshold and reverse output is requested.
2104 *
2105 * Default Value: False
2106 */
2108 /**
2109 * \brief Position threshold for forward soft limit features.
2110 * ForwardSoftLimitEnable must be enabled for this to take effect.
2111 *
2112 * Minimum Value: -3.4e+38
2113 * Maximum Value: 3.4e+38
2114 * Default Value: 0
2115 * Units: rotations
2116 */
2118 /**
2119 * \brief Position threshold for reverse soft limit features.
2120 * ReverseSoftLimitEnable must be enabled for this to take effect.
2121 *
2122 * Minimum Value: -3.4e+38
2123 * Maximum Value: 3.4e+38
2124 * Default Value: 0
2125 * Units: rotations
2126 */
2128
2129 /**
2130 * \brief Modifies this configuration's ForwardSoftLimitEnable parameter and returns itself for
2131 * method-chaining and easier to use config API.
2132 * \param newForwardSoftLimitEnable Parameter to modify
2133 * \returns Itself
2134 */
2136 {
2137 ForwardSoftLimitEnable = std::move(newForwardSoftLimitEnable);
2138 return *this;
2139 }
2140 /**
2141 * \brief Modifies this configuration's ReverseSoftLimitEnable parameter and returns itself for
2142 * method-chaining and easier to use config API.
2143 * \param newReverseSoftLimitEnable Parameter to modify
2144 * \returns Itself
2145 */
2147 {
2148 ReverseSoftLimitEnable = std::move(newReverseSoftLimitEnable);
2149 return *this;
2150 }
2151 /**
2152 * \brief Modifies this configuration's ForwardSoftLimitThreshold parameter and returns itself for
2153 * method-chaining and easier to use config API.
2154 * \param newForwardSoftLimitThreshold Parameter to modify
2155 * \returns Itself
2156 */
2157 SoftwareLimitSwitchConfigs& WithForwardSoftLimitThreshold(double newForwardSoftLimitThreshold)
2158 {
2159 ForwardSoftLimitThreshold = std::move(newForwardSoftLimitThreshold);
2160 return *this;
2161 }
2162 /**
2163 * \brief Modifies this configuration's ReverseSoftLimitThreshold parameter and returns itself for
2164 * method-chaining and easier to use config API.
2165 * \param newReverseSoftLimitThreshold Parameter to modify
2166 * \returns Itself
2167 */
2168 SoftwareLimitSwitchConfigs& WithReverseSoftLimitThreshold(double newReverseSoftLimitThreshold)
2169 {
2170 ReverseSoftLimitThreshold = std::move(newReverseSoftLimitThreshold);
2171 return *this;
2172 }
2173
2174
2175
2176 std::string ToString() const override
2177 {
2178 std::stringstream ss;
2179 ss << "{" << std::endl;
2180 ss << "Config Group: SoftwareLimitSwitch" << std::endl;
2181 ss << "Name: \"ForwardSoftLimitEnable\" Value: \"" << ForwardSoftLimitEnable << "\"" << std::endl;
2182 ss << "Name: \"ReverseSoftLimitEnable\" Value: \"" << ReverseSoftLimitEnable << "\"" << std::endl;
2183 ss << "Name: \"ForwardSoftLimitThreshold\" Value: \"" << ForwardSoftLimitThreshold << "rotations\"" << std::endl;
2184 ss << "Name: \"ReverseSoftLimitThreshold\" Value: \"" << ReverseSoftLimitThreshold << "rotations\"" << std::endl;
2185 ss << "}" << std::endl;
2186 return ss.str();
2187 }
2188
2189 std::string Serialize() const override
2190 {
2191 std::stringstream ss;
2192 char *ref;
2193 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_ForwardSoftLimitEnable, ForwardSoftLimitEnable, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2194 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_ReverseSoftLimitEnable, ReverseSoftLimitEnable, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2195 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_ForwardSoftLimitThreshold, ForwardSoftLimitThreshold, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2196 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_ReverseSoftLimitThreshold, ReverseSoftLimitThreshold, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2197 return ss.str();
2198 }
2199
2200 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
2201 {
2202 const char *string_c_str = to_deserialize.c_str();
2203 size_t string_length = to_deserialize.length();
2204 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_ForwardSoftLimitEnable, string_c_str, string_length, &ForwardSoftLimitEnable);
2205 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_ReverseSoftLimitEnable, string_c_str, string_length, &ReverseSoftLimitEnable);
2206 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_ForwardSoftLimitThreshold, string_c_str, string_length, &ForwardSoftLimitThreshold);
2207 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_ReverseSoftLimitThreshold, string_c_str, string_length, &ReverseSoftLimitThreshold);
2208 return 0;
2209 }
2210};
2211
2212
2213/**
2214 * \brief Configs for Motion Magic®.
2215 *
2216 * \details Includes Velocity, Acceleration, Jerk, and Expo
2217 * parameters.
2218 */
2220{
2221public:
2222 /**
2223 * \brief This is the maximum velocity Motion Magic® based control
2224 * modes are allowed to use. Motion Magic® Velocity control modes do
2225 * not use this config. When using Motion Magic® Expo control modes,
2226 * setting this to 0 will allow the profile to run to the max possible
2227 * velocity based on Expo_kV.
2228 *
2229 * Minimum Value: 0
2230 * Maximum Value: 9999
2231 * Default Value: 0
2232 * Units: rps
2233 */
2235 /**
2236 * \brief This is the target acceleration Motion Magic® based control
2237 * modes are allowed to use. Motion Magic® Expo control modes do not
2238 * use this config.
2239 *
2240 * Minimum Value: 0
2241 * Maximum Value: 9999
2242 * Default Value: 0
2243 * Units: rot per sec²
2244 */
2246 /**
2247 * \brief This is the target jerk (acceleration derivative) Motion
2248 * Magic® based control modes are allowed to use. Motion Magic® Expo
2249 * control modes do not use this config. This allows Motion Magic®
2250 * support of S-Curves. If this is set to zero, then Motion Magic®
2251 * will not apply a Jerk limit.
2252 *
2253 * Minimum Value: 0
2254 * Maximum Value: 9999
2255 * Default Value: 0
2256 * Units: rot per sec³
2257 */
2259 /**
2260 * \brief This is the target kV used only by Motion Magic® Expo
2261 * control modes, in units of V/rps. This represents the amount of
2262 * voltage necessary to hold a velocity. In terms of the Motion Magic®
2263 * Expo profile, a higher kV results in a slower maximum velocity. A
2264 * kV of 0 will be promoted to a reasonable default of 0.12.
2265 *
2266 * Minimum Value: 0.001
2267 * Maximum Value: 100
2268 * Default Value: 0
2269 * Units: V/rps
2270 */
2272 /**
2273 * \brief This is the target kA used only by Motion Magic® Expo
2274 * control modes, in units of V/rps². This represents the amount of
2275 * voltage necessary to achieve an acceleration. In terms of the
2276 * Motion Magic® Expo profile, a higher kA results in a slower
2277 * acceleration. A kA of 0 will be promoted to a reasonable default of
2278 * 0.1.
2279 *
2280 * Minimum Value: 1e-05
2281 * Maximum Value: 100
2282 * Default Value: 0
2283 * Units: V/rps²
2284 */
2286
2287 /**
2288 * \brief Modifies this configuration's MotionMagicCruiseVelocity parameter and returns itself for
2289 * method-chaining and easier to use config API.
2290 * \param newMotionMagicCruiseVelocity Parameter to modify
2291 * \returns Itself
2292 */
2293 MotionMagicConfigs& WithMotionMagicCruiseVelocity(double newMotionMagicCruiseVelocity)
2294 {
2295 MotionMagicCruiseVelocity = std::move(newMotionMagicCruiseVelocity);
2296 return *this;
2297 }
2298 /**
2299 * \brief Modifies this configuration's MotionMagicAcceleration parameter and returns itself for
2300 * method-chaining and easier to use config API.
2301 * \param newMotionMagicAcceleration Parameter to modify
2302 * \returns Itself
2303 */
2304 MotionMagicConfigs& WithMotionMagicAcceleration(double newMotionMagicAcceleration)
2305 {
2306 MotionMagicAcceleration = std::move(newMotionMagicAcceleration);
2307 return *this;
2308 }
2309 /**
2310 * \brief Modifies this configuration's MotionMagicJerk parameter and returns itself for
2311 * method-chaining and easier to use config API.
2312 * \param newMotionMagicJerk Parameter to modify
2313 * \returns Itself
2314 */
2315 MotionMagicConfigs& WithMotionMagicJerk(double newMotionMagicJerk)
2316 {
2317 MotionMagicJerk = std::move(newMotionMagicJerk);
2318 return *this;
2319 }
2320 /**
2321 * \brief Modifies this configuration's MotionMagicExpo_kV parameter and returns itself for
2322 * method-chaining and easier to use config API.
2323 * \param newMotionMagicExpo_kV Parameter to modify
2324 * \returns Itself
2325 */
2326 MotionMagicConfigs& WithMotionMagicExpo_kV(double newMotionMagicExpo_kV)
2327 {
2328 MotionMagicExpo_kV = std::move(newMotionMagicExpo_kV);
2329 return *this;
2330 }
2331 /**
2332 * \brief Modifies this configuration's MotionMagicExpo_kA parameter and returns itself for
2333 * method-chaining and easier to use config API.
2334 * \param newMotionMagicExpo_kA Parameter to modify
2335 * \returns Itself
2336 */
2337 MotionMagicConfigs& WithMotionMagicExpo_kA(double newMotionMagicExpo_kA)
2338 {
2339 MotionMagicExpo_kA = std::move(newMotionMagicExpo_kA);
2340 return *this;
2341 }
2342
2343
2344
2345 std::string ToString() const override
2346 {
2347 std::stringstream ss;
2348 ss << "{" << std::endl;
2349 ss << "Config Group: MotionMagic" << std::endl;
2350 ss << "Name: \"MotionMagicCruiseVelocity\" Value: \"" << MotionMagicCruiseVelocity << "rps\"" << std::endl;
2351 ss << "Name: \"MotionMagicAcceleration\" Value: \"" << MotionMagicAcceleration << "rot per sec²\"" << std::endl;
2352 ss << "Name: \"MotionMagicJerk\" Value: \"" << MotionMagicJerk << "rot per sec³\"" << std::endl;
2353 ss << "Name: \"MotionMagicExpo_kV\" Value: \"" << MotionMagicExpo_kV << "V/rps\"" << std::endl;
2354 ss << "Name: \"MotionMagicExpo_kA\" Value: \"" << MotionMagicExpo_kA << "V/rps²\"" << std::endl;
2355 ss << "}" << std::endl;
2356 return ss.str();
2357 }
2358
2359 std::string Serialize() const override
2360 {
2361 std::stringstream ss;
2362 char *ref;
2363 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_MotionMagicCruiseVelocity, MotionMagicCruiseVelocity, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2364 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_MotionMagicAcceleration, MotionMagicAcceleration, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2365 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_MotionMagicJerk, MotionMagicJerk, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2366 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_MotionMagicExpo_kV, MotionMagicExpo_kV, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2367 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Config_MotionMagicExpo_kA, MotionMagicExpo_kA, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2368 return ss.str();
2369 }
2370
2371 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
2372 {
2373 const char *string_c_str = to_deserialize.c_str();
2374 size_t string_length = to_deserialize.length();
2375 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_MotionMagicCruiseVelocity, string_c_str, string_length, &MotionMagicCruiseVelocity);
2376 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_MotionMagicAcceleration, string_c_str, string_length, &MotionMagicAcceleration);
2377 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_MotionMagicJerk, string_c_str, string_length, &MotionMagicJerk);
2378 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_MotionMagicExpo_kV, string_c_str, string_length, &MotionMagicExpo_kV);
2379 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Config_MotionMagicExpo_kA, string_c_str, string_length, &MotionMagicExpo_kA);
2380 return 0;
2381 }
2382};
2383
2384
2385/**
2386 * \brief Custom Params.
2387 *
2388 * \details Custom paramaters that have no real impact on controller.
2389 */
2391{
2392public:
2393 /**
2394 * \brief Custom parameter 0. This is provided to allow
2395 * end-applications to store persistent information in the device.
2396 *
2397 * Minimum Value: -32768
2398 * Maximum Value: 32767
2399 * Default Value: 0
2400 * Units:
2401 */
2403 /**
2404 * \brief Custom parameter 1. This is provided to allow
2405 * end-applications to store persistent information in the device.
2406 *
2407 * Minimum Value: -32768
2408 * Maximum Value: 32767
2409 * Default Value: 0
2410 * Units:
2411 */
2413
2414 /**
2415 * \brief Modifies this configuration's CustomParam0 parameter and returns itself for
2416 * method-chaining and easier to use config API.
2417 * \param newCustomParam0 Parameter to modify
2418 * \returns Itself
2419 */
2421 {
2422 CustomParam0 = std::move(newCustomParam0);
2423 return *this;
2424 }
2425 /**
2426 * \brief Modifies this configuration's CustomParam1 parameter and returns itself for
2427 * method-chaining and easier to use config API.
2428 * \param newCustomParam1 Parameter to modify
2429 * \returns Itself
2430 */
2432 {
2433 CustomParam1 = std::move(newCustomParam1);
2434 return *this;
2435 }
2436
2437
2438
2439 std::string ToString() const override
2440 {
2441 std::stringstream ss;
2442 ss << "{" << std::endl;
2443 ss << "Config Group: CustomParams" << std::endl;
2444 ss << "Name: \"CustomParam0\" Value: \"" << CustomParam0 << "\"" << std::endl;
2445 ss << "Name: \"CustomParam1\" Value: \"" << CustomParam1 << "\"" << std::endl;
2446 ss << "}" << std::endl;
2447 return ss.str();
2448 }
2449
2450 std::string Serialize() const override
2451 {
2452 std::stringstream ss;
2453 char *ref;
2454 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::CustomParam0, CustomParam0, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2455 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::CustomParam1, CustomParam1, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2456 return ss.str();
2457 }
2458
2459 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
2460 {
2461 const char *string_c_str = to_deserialize.c_str();
2462 size_t string_length = to_deserialize.length();
2463 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::CustomParam0, string_c_str, string_length, &CustomParam0);
2464 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::CustomParam1, string_c_str, string_length, &CustomParam1);
2465 return 0;
2466 }
2467};
2468
2469
2470/**
2471 * \brief Configs that affect general behavior during closed-looping.
2472 *
2473 * \details Includes Continuous Wrap features.
2474 */
2476{
2477public:
2478 /**
2479 * \brief Wrap position error within [-0.5,+0.5) mechanism rotations.
2480 * Typically used for continuous position closed-loops like swerve
2481 * azimuth.
2482 *
2483 * \details This uses the mechanism rotation value. If there is a gear
2484 * ratio between the sensor and the mechanism, make sure to apply a
2485 * SensorToMechanismRatio so the closed loop operates on the full
2486 * rotation.
2487 *
2488 * Default Value: False
2489 */
2490 bool ContinuousWrap = false;
2491
2492
2493
2494
2495 std::string ToString() const override
2496 {
2497 std::stringstream ss;
2498 ss << "{" << std::endl;
2499 ss << "Config Group: ClosedLoopGeneral" << std::endl;
2500 ss << "Name: \"ContinuousWrap\" Value: \"" << ContinuousWrap << "\"" << std::endl;
2501 ss << "}" << std::endl;
2502 return ss.str();
2503 }
2504
2505 std::string Serialize() const override
2506 {
2507 std::stringstream ss;
2508 char *ref;
2509 c_ctre_phoenix6_serialize_bool(ctre::phoenix6::spns::SpnValue::Config_ContinuousWrap, ContinuousWrap, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2510 return ss.str();
2511 }
2512
2513 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
2514 {
2515 const char *string_c_str = to_deserialize.c_str();
2516 size_t string_length = to_deserialize.length();
2517 c_ctre_phoenix6_deserialize_bool(ctre::phoenix6::spns::SpnValue::Config_ContinuousWrap, string_c_str, string_length, &ContinuousWrap);
2518 return 0;
2519 }
2520};
2521
2522
2523/**
2524 * \brief Gains for the specified slot.
2525 *
2526 * \details If this slot is selected, these gains are used in closed
2527 * loop control requests.
2528 */
2530{
2531public:
2532 /**
2533 * \brief Proportional Gain
2534 *
2535 * \details The units for this gain is dependent on the control mode.
2536 * Since this gain is multiplied by error in the input, the units
2537 * should be defined as units of output per unit of input error. For
2538 * example, when controlling velocity using a duty cycle closed loop,
2539 * the units for the proportional gain will be duty cycle per rps of
2540 * error, or 1/rps.
2541 *
2542 * Minimum Value: 0
2543 * Maximum Value: 3.4e+38
2544 * Default Value: 0
2545 * Units:
2546 */
2547 double kP = 0;
2548 /**
2549 * \brief Integral Gain
2550 *
2551 * \details The units for this gain is dependent on the control mode.
2552 * Since this gain is multiplied by error in the input integrated over
2553 * time (in units of seconds), the units should be defined as units of
2554 * output per unit of integrated input error. For example, when
2555 * controlling velocity using a duty cycle closed loop, integrating
2556 * velocity over time results in rps * s = rotations. Therefore, the
2557 * units for the integral gain will be duty cycle per rotation of
2558 * accumulated error, or 1/rot.
2559 *
2560 * Minimum Value: 0
2561 * Maximum Value: 3.4e+38
2562 * Default Value: 0
2563 * Units:
2564 */
2565 double kI = 0;
2566 /**
2567 * \brief Derivative Gain
2568 *
2569 * \details The units for this gain is dependent on the control mode.
2570 * Since this gain is multiplied by the derivative of error in the
2571 * input with respect to time (in units of seconds), the units should
2572 * be defined as units of output per unit of the differentiated input
2573 * error. For example, when controlling velocity using a duty cycle
2574 * closed loop, the derivative of velocity with respect to time is
2575 * rps/s, which is acceleration. Therefore, the units for the
2576 * derivative gain will be duty cycle per unit of acceleration error,
2577 * or 1/(rps/s).
2578 *
2579 * Minimum Value: 0
2580 * Maximum Value: 3.4e+38
2581 * Default Value: 0
2582 * Units:
2583 */
2584 double kD = 0;
2585 /**
2586 * \brief Static Feedforward Gain
2587 *
2588 * \details This is added to the closed loop output. The unit for this
2589 * constant is dependent on the control mode, typically fractional
2590 * duty cycle, voltage, or torque current. The sign is typically
2591 * determined by reference velocity when using position and velocity
2592 * closed loop modes. However, when using position closed loop with
2593 * zero velocity reference (no motion profiling), application can
2594 * instead use the position closed loop error by setting the Static
2595 * Feedforward Sign configuration parameter. In which case, we
2596 * recommend the minimal amount of kS, otherwise the motor output may
2597 * dither when closed loop error is near zero.
2598 *
2599 * Minimum Value: -512
2600 * Maximum Value: 511
2601 * Default Value: 0
2602 * Units:
2603 */
2604 double kS = 0;
2605 /**
2606 * \brief Velocity Feedforward Gain
2607 *
2608 * \details The units for this gain is dependent on the control mode.
2609 * Since this gain is multiplied by the requested velocity, the units
2610 * should be defined as units of output per unit of requested input
2611 * velocity. For example, when controlling velocity using a duty cycle
2612 * closed loop, the units for the velocity feedfoward gain will be
2613 * duty cycle per requested rps, or 1/rps.
2614 *
2615 * Minimum Value: 0
2616 * Maximum Value: 3.4e+38
2617 * Default Value: 0
2618 * Units:
2619 */
2620 double kV = 0;
2621 /**
2622 * \brief Acceleration Feedforward Gain
2623 *
2624 * \details The units for this gain is dependent on the control mode.
2625 * Since this gain is multiplied by the requested acceleration, the
2626 * units should be defined as units of output per unit of requested
2627 * input acceleration. For example, when controlling velocity using a
2628 * duty cycle closed loop, the units for the acceleration feedfoward
2629 * gain will be duty cycle per requested rps/s, or 1/(rps/s).
2630 *
2631 * Minimum Value: 0
2632 * Maximum Value: 3.4e+38
2633 * Default Value: 0
2634 * Units:
2635 */
2636 double kA = 0;
2637 /**
2638 * \brief Gravity Feedforward Gain
2639 *
2640 * \details This is added to the closed loop output. The sign is
2641 * determined by the type of gravity feedforward. The unit for this
2642 * constant is dependent on the control mode, typically fractional
2643 * duty cycle, voltage, or torque current.
2644 *
2645 * Minimum Value: -512
2646 * Maximum Value: 511
2647 * Default Value: 0
2648 * Units:
2649 */
2650 double kG = 0;
2651 /**
2652 * \brief Gravity Feedforward Type
2653 *
2654 * \details This determines the type of the gravity feedforward.
2655 * Choose Elevator_Static for systems where the gravity feedforward is
2656 * constant, such as an elevator. The gravity feedforward output will
2657 * always have the same sign. Choose Arm_Cosine for systems where the
2658 * gravity feedforward is dependent on the angular position of the
2659 * mechanism, such as an arm. The gravity feedforward output will vary
2660 * depending on the mechanism angular position. Note that the sensor
2661 * offset and ratios must be configured so that the sensor reports a
2662 * position of 0 when the mechanism is horizonal (parallel to the
2663 * ground), and the reported sensor position is 1:1 with the
2664 * mechanism.
2665 *
2666 */
2668 /**
2669 * \brief Static Feedforward Sign during position closed loop
2670 *
2671 * \details This determines the sign of the applied kS during position
2672 * closed-loop modes. The default behavior uses the velocity
2673 * feedforward sign. This works well with position closed loop when
2674 * velocity reference is specified (motion profiling). However, when
2675 * using position closed loop with zero velocity reference (no motion
2676 * profiling), the application may want to apply static feedforward
2677 * based on the closed loop error sign instead. In which case, we
2678 * recommend the minimal amount of kS, otherwise the motor output may
2679 * dither when closed loop error is near zero.
2680 *
2681 */
2683
2684 /**
2685 * \brief Modifies this configuration's kP parameter and returns itself for
2686 * method-chaining and easier to use config API.
2687 * \param newKP Parameter to modify
2688 * \returns Itself
2689 */
2690 Slot0Configs& WithKP(double newKP)
2691 {
2692 kP = std::move(newKP);
2693 return *this;
2694 }
2695 /**
2696 * \brief Modifies this configuration's kI parameter and returns itself for
2697 * method-chaining and easier to use config API.
2698 * \param newKI Parameter to modify
2699 * \returns Itself
2700 */
2701 Slot0Configs& WithKI(double newKI)
2702 {
2703 kI = std::move(newKI);
2704 return *this;
2705 }
2706 /**
2707 * \brief Modifies this configuration's kD parameter and returns itself for
2708 * method-chaining and easier to use config API.
2709 * \param newKD Parameter to modify
2710 * \returns Itself
2711 */
2712 Slot0Configs& WithKD(double newKD)
2713 {
2714 kD = std::move(newKD);
2715 return *this;
2716 }
2717 /**
2718 * \brief Modifies this configuration's kS parameter and returns itself for
2719 * method-chaining and easier to use config API.
2720 * \param newKS Parameter to modify
2721 * \returns Itself
2722 */
2723 Slot0Configs& WithKS(double newKS)
2724 {
2725 kS = std::move(newKS);
2726 return *this;
2727 }
2728 /**
2729 * \brief Modifies this configuration's kV parameter and returns itself for
2730 * method-chaining and easier to use config API.
2731 * \param newKV Parameter to modify
2732 * \returns Itself
2733 */
2734 Slot0Configs& WithKV(double newKV)
2735 {
2736 kV = std::move(newKV);
2737 return *this;
2738 }
2739 /**
2740 * \brief Modifies this configuration's kA parameter and returns itself for
2741 * method-chaining and easier to use config API.
2742 * \param newKA Parameter to modify
2743 * \returns Itself
2744 */
2745 Slot0Configs& WithKA(double newKA)
2746 {
2747 kA = std::move(newKA);
2748 return *this;
2749 }
2750 /**
2751 * \brief Modifies this configuration's kG parameter and returns itself for
2752 * method-chaining and easier to use config API.
2753 * \param newKG Parameter to modify
2754 * \returns Itself
2755 */
2756 Slot0Configs& WithKG(double newKG)
2757 {
2758 kG = std::move(newKG);
2759 return *this;
2760 }
2761 /**
2762 * \brief Modifies this configuration's GravityType parameter and returns itself for
2763 * method-chaining and easier to use config API.
2764 * \param newGravityType Parameter to modify
2765 * \returns Itself
2766 */
2768 {
2769 GravityType = std::move(newGravityType);
2770 return *this;
2771 }
2772 /**
2773 * \brief Modifies this configuration's StaticFeedforwardSign parameter and returns itself for
2774 * method-chaining and easier to use config API.
2775 * \param newStaticFeedforwardSign Parameter to modify
2776 * \returns Itself
2777 */
2779 {
2780 StaticFeedforwardSign = std::move(newStaticFeedforwardSign);
2781 return *this;
2782 }
2783
2784 static Slot0Configs From(const SlotConfigs& value);
2785
2786 std::string ToString() const override
2787 {
2788 std::stringstream ss;
2789 ss << "{" << std::endl;
2790 ss << "Config Group: Slot0" << std::endl;
2791 ss << "Name: \"kP\" Value: \"" << kP << "\"" << std::endl;
2792 ss << "Name: \"kI\" Value: \"" << kI << "\"" << std::endl;
2793 ss << "Name: \"kD\" Value: \"" << kD << "\"" << std::endl;
2794 ss << "Name: \"kS\" Value: \"" << kS << "\"" << std::endl;
2795 ss << "Name: \"kV\" Value: \"" << kV << "\"" << std::endl;
2796 ss << "Name: \"kA\" Value: \"" << kA << "\"" << std::endl;
2797 ss << "Name: \"kG\" Value: \"" << kG << "\"" << std::endl;
2798 ss << "Name: \"GravityType\" Value: \"" << GravityType << "\"" << std::endl;
2799 ss << "Name: \"StaticFeedforwardSign\" Value: \"" << StaticFeedforwardSign << "\"" << std::endl;
2800 ss << "}" << std::endl;
2801 return ss.str();
2802 }
2803
2804 std::string Serialize() const override
2805 {
2806 std::stringstream ss;
2807 char *ref;
2808 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kP, kP, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2809 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kI, kI, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2810 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kD, kD, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2811 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kS, kS, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2812 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kV, kV, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2813 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kA, kA, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2814 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kG, kG, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2815 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Slot0_kG_Type, GravityType.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2816 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Slot0_kS_Sign, StaticFeedforwardSign.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
2817 return ss.str();
2818 }
2819
2820 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
2821 {
2822 const char *string_c_str = to_deserialize.c_str();
2823 size_t string_length = to_deserialize.length();
2824 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kP, string_c_str, string_length, &kP);
2825 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kI, string_c_str, string_length, &kI);
2826 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kD, string_c_str, string_length, &kD);
2827 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kS, string_c_str, string_length, &kS);
2828 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kV, string_c_str, string_length, &kV);
2829 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kA, string_c_str, string_length, &kA);
2830 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot0_kG, string_c_str, string_length, &kG);
2831 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Slot0_kG_Type, string_c_str, string_length, &GravityType.value);
2832 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Slot0_kS_Sign, string_c_str, string_length, &StaticFeedforwardSign.value);
2833 return 0;
2834 }
2835};
2836
2837
2838/**
2839 * \brief Gains for the specified slot.
2840 *
2841 * \details If this slot is selected, these gains are used in closed
2842 * loop control requests.
2843 */
2845{
2846public:
2847 /**
2848 * \brief Proportional Gain
2849 *
2850 * \details The units for this gain is dependent on the control mode.
2851 * Since this gain is multiplied by error in the input, the units
2852 * should be defined as units of output per unit of input error. For
2853 * example, when controlling velocity using a duty cycle closed loop,
2854 * the units for the proportional gain will be duty cycle per rps, or
2855 * 1/rps.
2856 *
2857 * Minimum Value: 0
2858 * Maximum Value: 3.4e+38
2859 * Default Value: 0
2860 * Units:
2861 */
2862 double kP = 0;
2863 /**
2864 * \brief Integral Gain
2865 *
2866 * \details The units for this gain is dependent on the control mode.
2867 * Since this gain is multiplied by error in the input integrated over
2868 * time (in units of seconds), the units should be defined as units of
2869 * output per unit of integrated input error. For example, when
2870 * controlling velocity using a duty cycle closed loop, integrating
2871 * velocity over time results in rps * s = rotations. Therefore, the
2872 * units for the integral gain will be duty cycle per rotation of
2873 * accumulated error, or 1/rot.
2874 *
2875 * Minimum Value: 0
2876 * Maximum Value: 3.4e+38
2877 * Default Value: 0
2878 * Units:
2879 */
2880 double kI = 0;
2881 /**
2882 * \brief Derivative Gain
2883 *
2884 * \details The units for this gain is dependent on the control mode.
2885 * Since this gain is multiplied by the derivative of error in the
2886 * input with respect to time (in units of seconds), the units should
2887 * be defined as units of output per unit of the differentiated input
2888 * error. For example, when controlling velocity using a duty cycle
2889 * closed loop, the derivative of velocity with respect to time is
2890 * rps/s, which is acceleration. Therefore, the units for the
2891 * derivative gain will be duty cycle per unit of acceleration error,
2892 * or 1/(rps/s).
2893 *
2894 * Minimum Value: 0
2895 * Maximum Value: 3.4e+38
2896 * Default Value: 0
2897 * Units:
2898 */
2899 double kD = 0;
2900 /**
2901 * \brief Static Feedforward Gain
2902 *
2903 * \details This is added to the closed loop output. The unit for this
2904 * constant is dependent on the control mode, typically fractional
2905 * duty cycle, voltage, or torque current. The sign is typically
2906 * determined by reference velocity when using position and velocity
2907 * closed loop modes. However, when using position closed loop with
2908 * zero velocity reference (no motion profiling), application can
2909 * instead use the position closed loop error by setting the Static
2910 * Feedforward Sign configuration parameter. In which case, we
2911 * recommend the minimal amount of kS, otherwise the motor output may
2912 * dither when closed loop error is near zero.
2913 *
2914 * Minimum Value: -512
2915 * Maximum Value: 511
2916 * Default Value: 0
2917 * Units:
2918 */
2919 double kS = 0;
2920 /**
2921 * \brief Velocity Feedforward Gain
2922 *
2923 * \details The units for this gain is dependent on the control mode.
2924 * Since this gain is multiplied by the requested velocity, the units
2925 * should be defined as units of output per unit of requested input
2926 * velocity. For example, when controlling velocity using a duty cycle
2927 * closed loop, the units for the velocity feedfoward gain will be
2928 * duty cycle per requested rps, or 1/rps.
2929 *
2930 * Minimum Value: 0
2931 * Maximum Value: 3.4e+38
2932 * Default Value: 0
2933 * Units:
2934 */
2935 double kV = 0;
2936 /**
2937 * \brief Acceleration Feedforward Gain
2938 *
2939 * \details The units for this gain is dependent on the control mode.
2940 * Since this gain is multiplied by the requested acceleration, the
2941 * units should be defined as units of output per unit of requested
2942 * input acceleration. For example, when controlling velocity using a
2943 * duty cycle closed loop, the units for the acceleration feedfoward
2944 * gain will be duty cycle per requested rps/s, or 1/(rps/s).
2945 *
2946 * Minimum Value: 0
2947 * Maximum Value: 3.4e+38
2948 * Default Value: 0
2949 * Units:
2950 */
2951 double kA = 0;
2952 /**
2953 * \brief Gravity Feedforward Gain
2954 *
2955 * \details This is added to the closed loop output. The sign is
2956 * determined by the type of gravity feedforward. The unit for this
2957 * constant is dependent on the control mode, typically fractional
2958 * duty cycle, voltage, or torque current.
2959 *
2960 * Minimum Value: -512
2961 * Maximum Value: 511
2962 * Default Value: 0
2963 * Units:
2964 */
2965 double kG = 0;
2966 /**
2967 * \brief Gravity Feedforward Type
2968 *
2969 * \details This determines the type of the gravity feedforward.
2970 * Choose Elevator_Static for systems where the gravity feedforward is
2971 * constant, such as an elevator. The gravity feedforward output will
2972 * always be positive. Choose Arm_Cosine for systems where the gravity
2973 * feedforward is dependent on the angular position of the mechanism,
2974 * such as an arm. The gravity feedforward output will vary depending
2975 * on the mechanism angular position. Note that the sensor offset and
2976 * ratios must be configured so that the sensor position is 0 when the
2977 * mechanism is horizonal, and one rotation of the mechanism
2978 * corresponds to one rotation of the sensor position.
2979 *
2980 */
2982 /**
2983 * \brief Static Feedforward Sign during position closed loop
2984 *
2985 * \details This determines the sign of the applied kS during position
2986 * closed-loop modes. The default behavior uses the velocity
2987 * feedforward sign. This works well with position closed loop when
2988 * velocity reference is specified (motion profiling). However, when
2989 * using position closed loop with zero velocity reference (no motion
2990 * profiling), the application may want to apply static feedforward
2991 * based on the closed loop error sign instead. In which case, we
2992 * recommend the minimal amount of kS, otherwise the motor output may
2993 * dither when closed loop error is near zero.
2994 *
2995 */
2997
2998 /**
2999 * \brief Modifies this configuration's kP parameter and returns itself for
3000 * method-chaining and easier to use config API.
3001 * \param newKP Parameter to modify
3002 * \returns Itself
3003 */
3004 Slot1Configs& WithKP(double newKP)
3005 {
3006 kP = std::move(newKP);
3007 return *this;
3008 }
3009 /**
3010 * \brief Modifies this configuration's kI parameter and returns itself for
3011 * method-chaining and easier to use config API.
3012 * \param newKI Parameter to modify
3013 * \returns Itself
3014 */
3015 Slot1Configs& WithKI(double newKI)
3016 {
3017 kI = std::move(newKI);
3018 return *this;
3019 }
3020 /**
3021 * \brief Modifies this configuration's kD parameter and returns itself for
3022 * method-chaining and easier to use config API.
3023 * \param newKD Parameter to modify
3024 * \returns Itself
3025 */
3026 Slot1Configs& WithKD(double newKD)
3027 {
3028 kD = std::move(newKD);
3029 return *this;
3030 }
3031 /**
3032 * \brief Modifies this configuration's kS parameter and returns itself for
3033 * method-chaining and easier to use config API.
3034 * \param newKS Parameter to modify
3035 * \returns Itself
3036 */
3037 Slot1Configs& WithKS(double newKS)
3038 {
3039 kS = std::move(newKS);
3040 return *this;
3041 }
3042 /**
3043 * \brief Modifies this configuration's kV parameter and returns itself for
3044 * method-chaining and easier to use config API.
3045 * \param newKV Parameter to modify
3046 * \returns Itself
3047 */
3048 Slot1Configs& WithKV(double newKV)
3049 {
3050 kV = std::move(newKV);
3051 return *this;
3052 }
3053 /**
3054 * \brief Modifies this configuration's kA parameter and returns itself for
3055 * method-chaining and easier to use config API.
3056 * \param newKA Parameter to modify
3057 * \returns Itself
3058 */
3059 Slot1Configs& WithKA(double newKA)
3060 {
3061 kA = std::move(newKA);
3062 return *this;
3063 }
3064 /**
3065 * \brief Modifies this configuration's kG parameter and returns itself for
3066 * method-chaining and easier to use config API.
3067 * \param newKG Parameter to modify
3068 * \returns Itself
3069 */
3070 Slot1Configs& WithKG(double newKG)
3071 {
3072 kG = std::move(newKG);
3073 return *this;
3074 }
3075 /**
3076 * \brief Modifies this configuration's GravityType parameter and returns itself for
3077 * method-chaining and easier to use config API.
3078 * \param newGravityType Parameter to modify
3079 * \returns Itself
3080 */
3082 {
3083 GravityType = std::move(newGravityType);
3084 return *this;
3085 }
3086 /**
3087 * \brief Modifies this configuration's StaticFeedforwardSign parameter and returns itself for
3088 * method-chaining and easier to use config API.
3089 * \param newStaticFeedforwardSign Parameter to modify
3090 * \returns Itself
3091 */
3093 {
3094 StaticFeedforwardSign = std::move(newStaticFeedforwardSign);
3095 return *this;
3096 }
3097
3098 static Slot1Configs From(const SlotConfigs& value);
3099
3100 std::string ToString() const override
3101 {
3102 std::stringstream ss;
3103 ss << "{" << std::endl;
3104 ss << "Config Group: Slot1" << std::endl;
3105 ss << "Name: \"kP\" Value: \"" << kP << "\"" << std::endl;
3106 ss << "Name: \"kI\" Value: \"" << kI << "\"" << std::endl;
3107 ss << "Name: \"kD\" Value: \"" << kD << "\"" << std::endl;
3108 ss << "Name: \"kS\" Value: \"" << kS << "\"" << std::endl;
3109 ss << "Name: \"kV\" Value: \"" << kV << "\"" << std::endl;
3110 ss << "Name: \"kA\" Value: \"" << kA << "\"" << std::endl;
3111 ss << "Name: \"kG\" Value: \"" << kG << "\"" << std::endl;
3112 ss << "Name: \"GravityType\" Value: \"" << GravityType << "\"" << std::endl;
3113 ss << "Name: \"StaticFeedforwardSign\" Value: \"" << StaticFeedforwardSign << "\"" << std::endl;
3114 ss << "}" << std::endl;
3115 return ss.str();
3116 }
3117
3118 std::string Serialize() const override
3119 {
3120 std::stringstream ss;
3121 char *ref;
3122 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kP, kP, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3123 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kI, kI, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3124 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kD, kD, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3125 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kS, kS, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3126 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kV, kV, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3127 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kA, kA, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3128 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kG, kG, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3129 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Slot1_kG_Type, GravityType.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3130 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Slot1_kS_Sign, StaticFeedforwardSign.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3131 return ss.str();
3132 }
3133
3134 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
3135 {
3136 const char *string_c_str = to_deserialize.c_str();
3137 size_t string_length = to_deserialize.length();
3138 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kP, string_c_str, string_length, &kP);
3139 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kI, string_c_str, string_length, &kI);
3140 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kD, string_c_str, string_length, &kD);
3141 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kS, string_c_str, string_length, &kS);
3142 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kV, string_c_str, string_length, &kV);
3143 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kA, string_c_str, string_length, &kA);
3144 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot1_kG, string_c_str, string_length, &kG);
3145 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Slot1_kG_Type, string_c_str, string_length, &GravityType.value);
3146 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Slot1_kS_Sign, string_c_str, string_length, &StaticFeedforwardSign.value);
3147 return 0;
3148 }
3149};
3150
3151
3152/**
3153 * \brief Gains for the specified slot.
3154 *
3155 * \details If this slot is selected, these gains are used in closed
3156 * loop control requests.
3157 */
3159{
3160public:
3161 /**
3162 * \brief Proportional Gain
3163 *
3164 * \details The units for this gain is dependent on the control mode.
3165 * Since this gain is multiplied by error in the input, the units
3166 * should be defined as units of output per unit of input error. For
3167 * example, when controlling velocity using a duty cycle closed loop,
3168 * the units for the proportional gain will be duty cycle per rps, or
3169 * 1/rps.
3170 *
3171 * Minimum Value: 0
3172 * Maximum Value: 3.4e+38
3173 * Default Value: 0
3174 * Units:
3175 */
3176 double kP = 0;
3177 /**
3178 * \brief Integral Gain
3179 *
3180 * \details The units for this gain is dependent on the control mode.
3181 * Since this gain is multiplied by error in the input integrated over
3182 * time (in units of seconds), the units should be defined as units of
3183 * output per unit of integrated input error. For example, when
3184 * controlling velocity using a duty cycle closed loop, integrating
3185 * velocity over time results in rps * s = rotations. Therefore, the
3186 * units for the integral gain will be duty cycle per rotation of
3187 * accumulated error, or 1/rot.
3188 *
3189 * Minimum Value: 0
3190 * Maximum Value: 3.4e+38
3191 * Default Value: 0
3192 * Units:
3193 */
3194 double kI = 0;
3195 /**
3196 * \brief Derivative Gain
3197 *
3198 * \details The units for this gain is dependent on the control mode.
3199 * Since this gain is multiplied by the derivative of error in the
3200 * input with respect to time (in units of seconds), the units should
3201 * be defined as units of output per unit of the differentiated input
3202 * error. For example, when controlling velocity using a duty cycle
3203 * closed loop, the derivative of velocity with respect to time is
3204 * rps/s, which is acceleration. Therefore, the units for the
3205 * derivative gain will be duty cycle per unit of acceleration error,
3206 * or 1/(rps/s).
3207 *
3208 * Minimum Value: 0
3209 * Maximum Value: 3.4e+38
3210 * Default Value: 0
3211 * Units:
3212 */
3213 double kD = 0;
3214 /**
3215 * \brief Static Feedforward Gain
3216 *
3217 * \details This is added to the closed loop output. The unit for this
3218 * constant is dependent on the control mode, typically fractional
3219 * duty cycle, voltage, or torque current. The sign is typically
3220 * determined by reference velocity when using position and velocity
3221 * closed loop modes. However, when using position closed loop with
3222 * zero velocity reference (no motion profiling), application can
3223 * instead use the position closed loop error by setting the Static
3224 * Feedforward Sign configuration parameter. In which case, we
3225 * recommend the minimal amount of kS, otherwise the motor output may
3226 * dither when closed loop error is near zero.
3227 *
3228 * Minimum Value: -512
3229 * Maximum Value: 511
3230 * Default Value: 0
3231 * Units:
3232 */
3233 double kS = 0;
3234 /**
3235 * \brief Velocity Feedforward Gain
3236 *
3237 * \details The units for this gain is dependent on the control mode.
3238 * Since this gain is multiplied by the requested velocity, the units
3239 * should be defined as units of output per unit of requested input
3240 * velocity. For example, when controlling velocity using a duty cycle
3241 * closed loop, the units for the velocity feedfoward gain will be
3242 * duty cycle per requested rps, or 1/rps.
3243 *
3244 * Minimum Value: 0
3245 * Maximum Value: 3.4e+38
3246 * Default Value: 0
3247 * Units:
3248 */
3249 double kV = 0;
3250 /**
3251 * \brief Acceleration Feedforward Gain
3252 *
3253 * \details The units for this gain is dependent on the control mode.
3254 * Since this gain is multiplied by the requested acceleration, the
3255 * units should be defined as units of output per unit of requested
3256 * input acceleration. For example, when controlling velocity using a
3257 * duty cycle closed loop, the units for the acceleration feedfoward
3258 * gain will be duty cycle per requested rps/s, or 1/(rps/s).
3259 *
3260 * Minimum Value: 0
3261 * Maximum Value: 3.4e+38
3262 * Default Value: 0
3263 * Units:
3264 */
3265 double kA = 0;
3266 /**
3267 * \brief Gravity Feedforward Gain
3268 *
3269 * \details This is added to the closed loop output. The sign is
3270 * determined by the type of gravity feedforward. The unit for this
3271 * constant is dependent on the control mode, typically fractional
3272 * duty cycle, voltage, or torque current.
3273 *
3274 * Minimum Value: -512
3275 * Maximum Value: 511
3276 * Default Value: 0
3277 * Units:
3278 */
3279 double kG = 0;
3280 /**
3281 * \brief Gravity Feedforward Type
3282 *
3283 * \details This determines the type of the gravity feedforward.
3284 * Choose Elevator_Static for systems where the gravity feedforward is
3285 * constant, such as an elevator. The gravity feedforward output will
3286 * always be positive. Choose Arm_Cosine for systems where the gravity
3287 * feedforward is dependent on the angular position of the mechanism,
3288 * such as an arm. The gravity feedforward output will vary depending
3289 * on the mechanism angular position. Note that the sensor offset and
3290 * ratios must be configured so that the sensor position is 0 when the
3291 * mechanism is horizonal, and one rotation of the mechanism
3292 * corresponds to one rotation of the sensor position.
3293 *
3294 */
3296 /**
3297 * \brief Static Feedforward Sign during position closed loop
3298 *
3299 * \details This determines the sign of the applied kS during position
3300 * closed-loop modes. The default behavior uses the velocity
3301 * feedforward sign. This works well with position closed loop when
3302 * velocity reference is specified (motion profiling). However, when
3303 * using position closed loop with zero velocity reference (no motion
3304 * profiling), the application may want to apply static feedforward
3305 * based on the closed loop error sign instead. In which case, we
3306 * recommend the minimal amount of kS, otherwise the motor output may
3307 * dither when closed loop error is near zero.
3308 *
3309 */
3311
3312 /**
3313 * \brief Modifies this configuration's kP parameter and returns itself for
3314 * method-chaining and easier to use config API.
3315 * \param newKP Parameter to modify
3316 * \returns Itself
3317 */
3318 Slot2Configs& WithKP(double newKP)
3319 {
3320 kP = std::move(newKP);
3321 return *this;
3322 }
3323 /**
3324 * \brief Modifies this configuration's kI parameter and returns itself for
3325 * method-chaining and easier to use config API.
3326 * \param newKI Parameter to modify
3327 * \returns Itself
3328 */
3329 Slot2Configs& WithKI(double newKI)
3330 {
3331 kI = std::move(newKI);
3332 return *this;
3333 }
3334 /**
3335 * \brief Modifies this configuration's kD parameter and returns itself for
3336 * method-chaining and easier to use config API.
3337 * \param newKD Parameter to modify
3338 * \returns Itself
3339 */
3340 Slot2Configs& WithKD(double newKD)
3341 {
3342 kD = std::move(newKD);
3343 return *this;
3344 }
3345 /**
3346 * \brief Modifies this configuration's kS parameter and returns itself for
3347 * method-chaining and easier to use config API.
3348 * \param newKS Parameter to modify
3349 * \returns Itself
3350 */
3351 Slot2Configs& WithKS(double newKS)
3352 {
3353 kS = std::move(newKS);
3354 return *this;
3355 }
3356 /**
3357 * \brief Modifies this configuration's kV parameter and returns itself for
3358 * method-chaining and easier to use config API.
3359 * \param newKV Parameter to modify
3360 * \returns Itself
3361 */
3362 Slot2Configs& WithKV(double newKV)
3363 {
3364 kV = std::move(newKV);
3365 return *this;
3366 }
3367 /**
3368 * \brief Modifies this configuration's kA parameter and returns itself for
3369 * method-chaining and easier to use config API.
3370 * \param newKA Parameter to modify
3371 * \returns Itself
3372 */
3373 Slot2Configs& WithKA(double newKA)
3374 {
3375 kA = std::move(newKA);
3376 return *this;
3377 }
3378 /**
3379 * \brief Modifies this configuration's kG parameter and returns itself for
3380 * method-chaining and easier to use config API.
3381 * \param newKG Parameter to modify
3382 * \returns Itself
3383 */
3384 Slot2Configs& WithKG(double newKG)
3385 {
3386 kG = std::move(newKG);
3387 return *this;
3388 }
3389 /**
3390 * \brief Modifies this configuration's GravityType parameter and returns itself for
3391 * method-chaining and easier to use config API.
3392 * \param newGravityType Parameter to modify
3393 * \returns Itself
3394 */
3396 {
3397 GravityType = std::move(newGravityType);
3398 return *this;
3399 }
3400 /**
3401 * \brief Modifies this configuration's StaticFeedforwardSign parameter and returns itself for
3402 * method-chaining and easier to use config API.
3403 * \param newStaticFeedforwardSign Parameter to modify
3404 * \returns Itself
3405 */
3407 {
3408 StaticFeedforwardSign = std::move(newStaticFeedforwardSign);
3409 return *this;
3410 }
3411
3412 static Slot2Configs From(const SlotConfigs& value);
3413
3414 std::string ToString() const override
3415 {
3416 std::stringstream ss;
3417 ss << "{" << std::endl;
3418 ss << "Config Group: Slot2" << std::endl;
3419 ss << "Name: \"kP\" Value: \"" << kP << "\"" << std::endl;
3420 ss << "Name: \"kI\" Value: \"" << kI << "\"" << std::endl;
3421 ss << "Name: \"kD\" Value: \"" << kD << "\"" << std::endl;
3422 ss << "Name: \"kS\" Value: \"" << kS << "\"" << std::endl;
3423 ss << "Name: \"kV\" Value: \"" << kV << "\"" << std::endl;
3424 ss << "Name: \"kA\" Value: \"" << kA << "\"" << std::endl;
3425 ss << "Name: \"kG\" Value: \"" << kG << "\"" << std::endl;
3426 ss << "Name: \"GravityType\" Value: \"" << GravityType << "\"" << std::endl;
3427 ss << "Name: \"StaticFeedforwardSign\" Value: \"" << StaticFeedforwardSign << "\"" << std::endl;
3428 ss << "}" << std::endl;
3429 return ss.str();
3430 }
3431
3432 std::string Serialize() const override
3433 {
3434 std::stringstream ss;
3435 char *ref;
3436 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kP, kP, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3437 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kI, kI, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3438 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kD, kD, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3439 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kS, kS, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3440 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kV, kV, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3441 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kA, kA, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3442 c_ctre_phoenix6_serialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kG, kG, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3443 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Slot2_kG_Type, GravityType.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3444 c_ctre_phoenix6_serialize_int(ctre::phoenix6::spns::SpnValue::Slot2_kS_Sign, StaticFeedforwardSign.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3445 return ss.str();
3446 }
3447
3448 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize) override
3449 {
3450 const char *string_c_str = to_deserialize.c_str();
3451 size_t string_length = to_deserialize.length();
3452 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kP, string_c_str, string_length, &kP);
3453 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kI, string_c_str, string_length, &kI);
3454 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kD, string_c_str, string_length, &kD);
3455 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kS, string_c_str, string_length, &kS);
3456 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kV, string_c_str, string_length, &kV);
3457 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kA, string_c_str, string_length, &kA);
3458 c_ctre_phoenix6_deserialize_double(ctre::phoenix6::spns::SpnValue::Slot2_kG, string_c_str, string_length, &kG);
3459 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Slot2_kG_Type, string_c_str, string_length, &GravityType.value);
3460 c_ctre_phoenix6_deserialize_int(ctre::phoenix6::spns::SpnValue::Slot2_kS_Sign, string_c_str, string_length, &StaticFeedforwardSign.value);
3461 return 0;
3462 }
3463};
3464
3465/**
3466 * \brief Gains for the specified slot.
3467 *
3468 * \details If this slot is selected, these gains are used in closed
3469 * loop control requests.
3470 */
3472{
3473 struct SlotSpns
3474 {
3475 int kPSpn;
3476 int kISpn;
3477 int kDSpn;
3478 int kSSpn;
3479 int kVSpn;
3480 int kASpn;
3481 int kGSpn;
3482 int GravityTypeSpn;
3483 int StaticFeedforwardSignSpn;
3484 };
3485
3486 std::map<int, SlotSpns> genericMap{
3487 {0, SlotSpns{
3488 ctre::phoenix6::spns::SpnValue::Slot0_kP,
3489 ctre::phoenix6::spns::SpnValue::Slot0_kI,
3490 ctre::phoenix6::spns::SpnValue::Slot0_kD,
3491 ctre::phoenix6::spns::SpnValue::Slot0_kS,
3492 ctre::phoenix6::spns::SpnValue::Slot0_kV,
3493 ctre::phoenix6::spns::SpnValue::Slot0_kA,
3494 ctre::phoenix6::spns::SpnValue::Slot0_kG,
3495 ctre::phoenix6::spns::SpnValue::Slot0_kG_Type,
3496 ctre::phoenix6::spns::SpnValue::Slot0_kS_Sign,
3497 }},
3498
3499 {1, SlotSpns{
3500 ctre::phoenix6::spns::SpnValue::Slot1_kP,
3501 ctre::phoenix6::spns::SpnValue::Slot1_kI,
3502 ctre::phoenix6::spns::SpnValue::Slot1_kD,
3503 ctre::phoenix6::spns::SpnValue::Slot1_kS,
3504 ctre::phoenix6::spns::SpnValue::Slot1_kV,
3505 ctre::phoenix6::spns::SpnValue::Slot1_kA,
3506 ctre::phoenix6::spns::SpnValue::Slot1_kG,
3507 ctre::phoenix6::spns::SpnValue::Slot1_kG_Type,
3508 ctre::phoenix6::spns::SpnValue::Slot1_kS_Sign,
3509 }},
3510
3511 {2, SlotSpns{
3512 ctre::phoenix6::spns::SpnValue::Slot2_kP,
3513 ctre::phoenix6::spns::SpnValue::Slot2_kI,
3514 ctre::phoenix6::spns::SpnValue::Slot2_kD,
3515 ctre::phoenix6::spns::SpnValue::Slot2_kS,
3516 ctre::phoenix6::spns::SpnValue::Slot2_kV,
3517 ctre::phoenix6::spns::SpnValue::Slot2_kA,
3518 ctre::phoenix6::spns::SpnValue::Slot2_kG,
3519 ctre::phoenix6::spns::SpnValue::Slot2_kG_Type,
3520 ctre::phoenix6::spns::SpnValue::Slot2_kS_Sign,
3521 }},
3522
3523 };
3524
3525public:
3526 /**
3527 * \brief Proportional Gain
3528 *
3529 * \details The units for this gain is dependent on the control mode.
3530 * Since this gain is multiplied by error in the input, the units
3531 * should be defined as units of output per unit of input error. For
3532 * example, when controlling velocity using a duty cycle closed loop,
3533 * the units for the proportional gain will be duty cycle per rps of
3534 * error, or 1/rps.
3535 *
3536 * Minimum Value: 0
3537 * Maximum Value: 3.4e+38
3538 * Default Value: 0
3539 * Units:
3540 */
3541 double kP = 0;
3542 /**
3543 * \brief Integral Gain
3544 *
3545 * \details The units for this gain is dependent on the control mode.
3546 * Since this gain is multiplied by error in the input integrated over
3547 * time (in units of seconds), the units should be defined as units of
3548 * output per unit of integrated input error. For example, when
3549 * controlling velocity using a duty cycle closed loop, integrating
3550 * velocity over time results in rps * s = rotations. Therefore, the
3551 * units for the integral gain will be duty cycle per rotation of
3552 * accumulated error, or 1/rot.
3553 *
3554 * Minimum Value: 0
3555 * Maximum Value: 3.4e+38
3556 * Default Value: 0
3557 * Units:
3558 */
3559 double kI = 0;
3560 /**
3561 * \brief Derivative Gain
3562 *
3563 * \details The units for this gain is dependent on the control mode.
3564 * Since this gain is multiplied by the derivative of error in the
3565 * input with respect to time (in units of seconds), the units should
3566 * be defined as units of output per unit of the differentiated input
3567 * error. For example, when controlling velocity using a duty cycle
3568 * closed loop, the derivative of velocity with respect to time is
3569 * rps/s, which is acceleration. Therefore, the units for the
3570 * derivative gain will be duty cycle per unit of acceleration error,
3571 * or 1/(rps/s).
3572 *
3573 * Minimum Value: 0
3574 * Maximum Value: 3.4e+38
3575 * Default Value: 0
3576 * Units:
3577 */
3578 double kD = 0;
3579 /**
3580 * \brief Static Feedforward Gain
3581 *
3582 * \details This is added to the closed loop output. The unit for this
3583 * constant is dependent on the control mode, typically fractional
3584 * duty cycle, voltage, or torque current. The sign is typically
3585 * determined by reference velocity when using position and velocity
3586 * closed loop modes. However, when using position closed loop with
3587 * zero velocity reference (no motion profiling), application can
3588 * instead use the position closed loop error by setting the Static
3589 * Feedforward Sign configuration parameter. In which case, we
3590 * recommend the minimal amount of kS, otherwise the motor output may
3591 * dither when closed loop error is near zero.
3592 *
3593 * Minimum Value: -512
3594 * Maximum Value: 511
3595 * Default Value: 0
3596 * Units:
3597 */
3598 double kS = 0;
3599 /**
3600 * \brief Velocity Feedforward Gain
3601 *
3602 * \details The units for this gain is dependent on the control mode.
3603 * Since this gain is multiplied by the requested velocity, the units
3604 * should be defined as units of output per unit of requested input
3605 * velocity. For example, when controlling velocity using a duty cycle
3606 * closed loop, the units for the velocity feedfoward gain will be
3607 * duty cycle per requested rps, or 1/rps.
3608 *
3609 * Minimum Value: 0
3610 * Maximum Value: 3.4e+38
3611 * Default Value: 0
3612 * Units:
3613 */
3614 double kV = 0;
3615 /**
3616 * \brief Acceleration Feedforward Gain
3617 *
3618 * \details The units for this gain is dependent on the control mode.
3619 * Since this gain is multiplied by the requested acceleration, the
3620 * units should be defined as units of output per unit of requested
3621 * input acceleration. For example, when controlling velocity using a
3622 * duty cycle closed loop, the units for the acceleration feedfoward
3623 * gain will be duty cycle per requested rps/s, or 1/(rps/s).
3624 *
3625 * Minimum Value: 0
3626 * Maximum Value: 3.4e+38
3627 * Default Value: 0
3628 * Units:
3629 */
3630 double kA = 0;
3631 /**
3632 * \brief Gravity Feedforward Gain
3633 *
3634 * \details This is added to the closed loop output. The sign is
3635 * determined by the type of gravity feedforward. The unit for this
3636 * constant is dependent on the control mode, typically fractional
3637 * duty cycle, voltage, or torque current.
3638 *
3639 * Minimum Value: -512
3640 * Maximum Value: 511
3641 * Default Value: 0
3642 * Units:
3643 */
3644 double kG = 0;
3645 /**
3646 * \brief Gravity Feedforward Type
3647 *
3648 * \details This determines the type of the gravity feedforward.
3649 * Choose Elevator_Static for systems where the gravity feedforward is
3650 * constant, such as an elevator. The gravity feedforward output will
3651 * always have the same sign. Choose Arm_Cosine for systems where the
3652 * gravity feedforward is dependent on the angular position of the
3653 * mechanism, such as an arm. The gravity feedforward output will vary
3654 * depending on the mechanism angular position. Note that the sensor
3655 * offset and ratios must be configured so that the sensor reports a
3656 * position of 0 when the mechanism is horizonal (parallel to the
3657 * ground), and the reported sensor position is 1:1 with the
3658 * mechanism.
3659 *
3660 */
3662 /**
3663 * \brief Static Feedforward Sign during position closed loop
3664 *
3665 * \details This determines the sign of the applied kS during position
3666 * closed-loop modes. The default behavior uses the velocity
3667 * feedforward sign. This works well with position closed loop when
3668 * velocity reference is specified (motion profiling). However, when
3669 * using position closed loop with zero velocity reference (no motion
3670 * profiling), the application may want to apply static feedforward
3671 * based on the closed loop error sign instead. In which case, we
3672 * recommend the minimal amount of kS, otherwise the motor output may
3673 * dither when closed loop error is near zero.
3674 *
3675 */
3677
3678 /**
3679 * \brief Modifies this configuration's kP parameter and returns itself for
3680 * method-chaining and easier to use config API.
3681 * \param newKP Parameter to modify
3682 * \returns Itself
3683 */
3684 SlotConfigs& WithKP(double newKP)
3685 {
3686 kP = std::move(newKP);
3687 return *this;
3688 }
3689 /**
3690 * \brief Modifies this configuration's kI parameter and returns itself for
3691 * method-chaining and easier to use config API.
3692 * \param newKI Parameter to modify
3693 * \returns Itself
3694 */
3695 SlotConfigs& WithKI(double newKI)
3696 {
3697 kI = std::move(newKI);
3698 return *this;
3699 }
3700 /**
3701 * \brief Modifies this configuration's kD parameter and returns itself for
3702 * method-chaining and easier to use config API.
3703 * \param newKD Parameter to modify
3704 * \returns Itself
3705 */
3706 SlotConfigs& WithKD(double newKD)
3707 {
3708 kD = std::move(newKD);
3709 return *this;
3710 }
3711 /**
3712 * \brief Modifies this configuration's kS parameter and returns itself for
3713 * method-chaining and easier to use config API.
3714 * \param newKS Parameter to modify
3715 * \returns Itself
3716 */
3717 SlotConfigs& WithKS(double newKS)
3718 {
3719 kS = std::move(newKS);
3720 return *this;
3721 }
3722 /**
3723 * \brief Modifies this configuration's kV parameter and returns itself for
3724 * method-chaining and easier to use config API.
3725 * \param newKV Parameter to modify
3726 * \returns Itself
3727 */
3728 SlotConfigs& WithKV(double newKV)
3729 {
3730 kV = std::move(newKV);
3731 return *this;
3732 }
3733 /**
3734 * \brief Modifies this configuration's kA parameter and returns itself for
3735 * method-chaining and easier to use config API.
3736 * \param newKA Parameter to modify
3737 * \returns Itself
3738 */
3739 SlotConfigs& WithKA(double newKA)
3740 {
3741 kA = std::move(newKA);
3742 return *this;
3743 }
3744 /**
3745 * \brief Modifies this configuration's kG parameter and returns itself for
3746 * method-chaining and easier to use config API.
3747 * \param newKG Parameter to modify
3748 * \returns Itself
3749 */
3750 SlotConfigs& WithKG(double newKG)
3751 {
3752 kG = std::move(newKG);
3753 return *this;
3754 }
3755 /**
3756 * \brief Modifies this configuration's GravityType parameter and returns itself for
3757 * method-chaining and easier to use config API.
3758 * \param newGravityType Parameter to modify
3759 * \returns Itself
3760 */
3762 {
3763 GravityType = std::move(newGravityType);
3764 return *this;
3765 }
3766 /**
3767 * \brief Modifies this configuration's StaticFeedforwardSign parameter and returns itself for
3768 * method-chaining and easier to use config API.
3769 * \param newStaticFeedforwardSign Parameter to modify
3770 * \returns Itself
3771 */
3773 {
3774 StaticFeedforwardSign = std::move(newStaticFeedforwardSign);
3775 return *this;
3776 }
3777
3778
3779 /**
3780 * \brief Chooses which slot these configs are for.
3781 */
3782 int SlotNumber = 0;
3783
3784 static SlotConfigs From(const Slot0Configs& value);
3785 static SlotConfigs From(const Slot1Configs& value);
3786 static SlotConfigs From(const Slot2Configs& value);
3787
3788 std::string ToString() const
3789 {
3790 std::stringstream ss;
3791 ss << "{" << std::endl;
3792 ss << "Config Group: Slot" << std::endl;
3793 ss << "Name: \"kP\" Value: \"" << kP << "\"" << std::endl;
3794 ss << "Name: \"kI\" Value: \"" << kI << "\"" << std::endl;
3795 ss << "Name: \"kD\" Value: \"" << kD << "\"" << std::endl;
3796 ss << "Name: \"kS\" Value: \"" << kS << "\"" << std::endl;
3797 ss << "Name: \"kV\" Value: \"" << kV << "\"" << std::endl;
3798 ss << "Name: \"kA\" Value: \"" << kA << "\"" << std::endl;
3799 ss << "Name: \"kG\" Value: \"" << kG << "\"" << std::endl;
3800 ss << "Name: \"GravityType\" Value: \"" << GravityType << "\"" << std::endl;
3801 ss << "Name: \"StaticFeedforwardSign\" Value: \"" << StaticFeedforwardSign << "\"" << std::endl;
3802 ss << "}" << std::endl;
3803 return ss.str();
3804 }
3805
3806 std::string Serialize() const
3807 {
3808 std::stringstream ss;
3809 SlotSpns currentSpns = genericMap.at(SlotNumber);
3810 char *ref;
3811 c_ctre_phoenix6_serialize_double(currentSpns.kPSpn, kP, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3812 c_ctre_phoenix6_serialize_double(currentSpns.kISpn, kI, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3813 c_ctre_phoenix6_serialize_double(currentSpns.kDSpn, kD, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3814 c_ctre_phoenix6_serialize_double(currentSpns.kSSpn, kS, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3815 c_ctre_phoenix6_serialize_double(currentSpns.kVSpn, kV, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3816 c_ctre_phoenix6_serialize_double(currentSpns.kASpn, kA, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3817 c_ctre_phoenix6_serialize_double(currentSpns.kGSpn, kG, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3818 c_ctre_phoenix6_serialize_int(currentSpns.GravityTypeSpn, GravityType.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3819 c_ctre_phoenix6_serialize_int(currentSpns.StaticFeedforwardSignSpn, StaticFeedforwardSign.value, &ref); if (ref != nullptr) { ss << ref; free(ref); }
3820 return ss.str();
3821 }
3822
3823 ctre::phoenix::StatusCode Deserialize(const std::string& to_deserialize)
3824 {
3825 const char *string_c_str = to_deserialize.c_str();
3826 size_t string_length = to_deserialize.length();
3827 SlotSpns currentSpns = genericMap.at(SlotNumber);
3828 c_ctre_phoenix6_deserialize_double(currentSpns.kPSpn, string_c_str, string_length, &kP);
3829 c_ctre_phoenix6_deserialize_double(currentSpns.kISpn, string_c_str, string_length, &kI);
3830 c_ctre_phoenix6_deserialize_double(currentSpns.kDSpn, string_c_str, string_length, &kD);
3831 c_ctre_phoenix6_deserialize_double(currentSpns.kSSpn, string_c_str, string_length, &kS);
3832 c_ctre_phoenix6_deserialize_double(currentSpns.kVSpn, string_c_str, string_length, &kV);
3833 c_ctre_phoenix6_deserialize_double(currentSpns.kASpn, string_c_str, string_length, &kA);
3834 c_ctre_phoenix6_deserialize_double(currentSpns.kGSpn, string_c_str, string_length, &kG);
3835 c_ctre_phoenix6_deserialize_int(currentSpns.GravityTypeSpn, string_c_str, string_length, &GravityType.value);
3836 c_ctre_phoenix6_deserialize_int(currentSpns.StaticFeedforwardSignSpn, string_c_str, string_length, &StaticFeedforwardSign.value);
3837 return 0;
3838 }
3839};
3840
3841
3842}
3843}
3844}
ii that the Software will be uninterrupted or error free
Definition: CTRE_LICENSE.txt:226
CTREXPORT int c_ctre_phoenix6_deserialize_double(int spn, const char *str, uint32_t strlen, double *val)
CTREXPORT int c_ctre_phoenix6_serialize_int(int spn, int value, char **str)
CTREXPORT int c_ctre_phoenix6_serialize_bool(int spn, bool value, char **str)
CTREXPORT int c_ctre_phoenix6_deserialize_bool(int spn, const char *str, uint32_t strlen, bool *val)
CTREXPORT int c_ctre_phoenix6_deserialize_int(int spn, const char *str, uint32_t strlen, int *val)
CTREXPORT int c_ctre_phoenix6_serialize_double(int spn, double value, char **str)
Definition: Serializable.hpp:15
Configs that affect audible components of the device.
Definition: Configs.hpp:1984
AudioConfigs & WithBeepOnBoot(bool newBeepOnBoot)
Modifies this configuration's BeepOnBoot parameter and returns itself for method-chaining and easier ...
Definition: Configs.hpp:2021
bool BeepOnConfig
If true, the TalonFX will beep during configuration API calls if device is disabled.
Definition: Configs.hpp:2003
bool AllowMusicDurDisable
If true, the TalonFX will allow Orchestra and MusicTone requests during disabled state.
Definition: Configs.hpp:2013
std::string Serialize() const override
Definition: Configs.hpp:2063
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:2073
std::string ToString() const override
Definition: Configs.hpp:2051
AudioConfigs & WithAllowMusicDurDisable(bool newAllowMusicDurDisable)
Modifies this configuration's AllowMusicDurDisable parameter and returns itself for method-chaining a...
Definition: Configs.hpp:2043
AudioConfigs & WithBeepOnConfig(bool newBeepOnConfig)
Modifies this configuration's BeepOnConfig parameter and returns itself for method-chaining and easie...
Definition: Configs.hpp:2032
bool BeepOnBoot
If true, the TalonFX will beep during boot-up.
Definition: Configs.hpp:1994
Configs that affect general behavior during closed-looping.
Definition: Configs.hpp:2476
bool ContinuousWrap
Wrap position error within [-0.5,+0.5) mechanism rotations.
Definition: Configs.hpp:2490
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:2513
std::string ToString() const override
Definition: Configs.hpp:2495
std::string Serialize() const override
Definition: Configs.hpp:2505
Configs that affect the closed-loop control of this motor controller.
Definition: Configs.hpp:1575
double TorqueClosedLoopRampPeriod
If non-zero, this determines how much time to ramp from 0A output to 300A during closed-loop modes.
Definition: Configs.hpp:1606
std::string Serialize() const override
Definition: Configs.hpp:1656
double VoltageClosedLoopRampPeriod
If non-zero, this determines how much time to ramp from 0V output to 12V during closed-loop modes.
Definition: Configs.hpp:1596
ClosedLoopRampsConfigs & WithDutyCycleClosedLoopRampPeriod(double newDutyCycleClosedLoopRampPeriod)
Modifies this configuration's DutyCycleClosedLoopRampPeriod parameter and returns itself for method-c...
Definition: Configs.hpp:1614
ClosedLoopRampsConfigs & WithTorqueClosedLoopRampPeriod(double newTorqueClosedLoopRampPeriod)
Modifies this configuration's TorqueClosedLoopRampPeriod parameter and returns itself for method-chai...
Definition: Configs.hpp:1636
double DutyCycleClosedLoopRampPeriod
If non-zero, this determines how much time to ramp from 0% output to 100% during closed-loop modes.
Definition: Configs.hpp:1586
ClosedLoopRampsConfigs & WithVoltageClosedLoopRampPeriod(double newVoltageClosedLoopRampPeriod)
Modifies this configuration's VoltageClosedLoopRampPeriod parameter and returns itself for method-cha...
Definition: Configs.hpp:1625
std::string ToString() const override
Definition: Configs.hpp:1644
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:1666
Configs that directly affect current limiting features.
Definition: Configs.hpp:616
bool StatorCurrentLimitEnable
Enable motor stator current limiting.
Definition: Configs.hpp:635
double StatorCurrentLimit
The amount of current allowed in the motor (motoring and regen current).
Definition: Configs.hpp:629
double SupplyCurrentLimit
The amount of supply current allowed.
Definition: Configs.hpp:648
CurrentLimitsConfigs & WithSupplyCurrentThreshold(double newSupplyCurrentThreshold)
Modifies this configuration's SupplyCurrentThreshold parameter and returns itself for method-chaining...
Definition: Configs.hpp:729
CurrentLimitsConfigs & WithSupplyCurrentLimit(double newSupplyCurrentLimit)
Modifies this configuration's SupplyCurrentLimit parameter and returns itself for method-chaining and...
Definition: Configs.hpp:707
double SupplyCurrentThreshold
Delay supply current limiting until current exceeds this threshold for longer than SupplyTimeThreshol...
Definition: Configs.hpp:666
std::string Serialize() const override
Definition: Configs.hpp:763
CurrentLimitsConfigs & WithSupplyCurrentLimitEnable(bool newSupplyCurrentLimitEnable)
Modifies this configuration's SupplyCurrentLimitEnable parameter and returns itself for method-chaini...
Definition: Configs.hpp:718
CurrentLimitsConfigs & WithStatorCurrentLimit(double newStatorCurrentLimit)
Modifies this configuration's StatorCurrentLimit parameter and returns itself for method-chaining and...
Definition: Configs.hpp:685
double SupplyTimeThreshold
Allows unlimited current for a period of time before current limiting occurs.
Definition: Configs.hpp:677
CurrentLimitsConfigs & WithSupplyTimeThreshold(double newSupplyTimeThreshold)
Modifies this configuration's SupplyTimeThreshold parameter and returns itself for method-chaining an...
Definition: Configs.hpp:740
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:776
CurrentLimitsConfigs & WithStatorCurrentLimitEnable(bool newStatorCurrentLimitEnable)
Modifies this configuration's StatorCurrentLimitEnable parameter and returns itself for method-chaini...
Definition: Configs.hpp:696
std::string ToString() const override
Definition: Configs.hpp:748
bool SupplyCurrentLimitEnable
Enable motor supply current limiting.
Definition: Configs.hpp:654
Custom Params.
Definition: Configs.hpp:2391
CustomParamsConfigs & WithCustomParam1(int newCustomParam1)
Modifies this configuration's CustomParam1 parameter and returns itself for method-chaining and easie...
Definition: Configs.hpp:2431
std::string ToString() const override
Definition: Configs.hpp:2439
int CustomParam0
Custom parameter 0.
Definition: Configs.hpp:2402
std::string Serialize() const override
Definition: Configs.hpp:2450
int CustomParam1
Custom parameter 1.
Definition: Configs.hpp:2412
CustomParamsConfigs & WithCustomParam0(int newCustomParam0)
Modifies this configuration's CustomParam0 parameter and returns itself for method-chaining and easie...
Definition: Configs.hpp:2420
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:2459
Configs related to constants used for differential control of a mechanism.
Definition: Configs.hpp:1355
std::string Serialize() const override
Definition: Configs.hpp:1436
std::string ToString() const override
Definition: Configs.hpp:1424
double PeakDifferentialDutyCycle
Maximum differential output during duty cycle based differential control modes.
Definition: Configs.hpp:1366
double PeakDifferentialTorqueCurrent
Maximum differential output during torque current based differential control modes.
Definition: Configs.hpp:1386
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:1446
DifferentialConstantsConfigs & WithPeakDifferentialDutyCycle(double newPeakDifferentialDutyCycle)
Modifies this configuration's PeakDifferentialDutyCycle parameter and returns itself for method-chain...
Definition: Configs.hpp:1394
DifferentialConstantsConfigs & WithPeakDifferentialTorqueCurrent(double newPeakDifferentialTorqueCurrent)
Modifies this configuration's PeakDifferentialTorqueCurrent parameter and returns itself for method-c...
Definition: Configs.hpp:1416
double PeakDifferentialVoltage
Maximum differential output during voltage based differential control modes.
Definition: Configs.hpp:1376
DifferentialConstantsConfigs & WithPeakDifferentialVoltage(double newPeakDifferentialVoltage)
Modifies this configuration's PeakDifferentialVoltage parameter and returns itself for method-chainin...
Definition: Configs.hpp:1405
Configs related to sensors used for differential control of a mechanism.
Definition: Configs.hpp:1229
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:1336
DifferentialSensorsConfigs & WithDifferentialTalonFXSensorID(int newDifferentialTalonFXSensorID)
Modifies this configuration's DifferentialTalonFXSensorID parameter and returns itself for method-cha...
Definition: Configs.hpp:1295
std::string Serialize() const override
Definition: Configs.hpp:1326
DifferentialSensorsConfigs & WithDifferentialRemoteSensorID(int newDifferentialRemoteSensorID)
Modifies this configuration's DifferentialRemoteSensorID parameter and returns itself for method-chai...
Definition: Configs.hpp:1306
DifferentialSensorsConfigs & WithDifferentialSensorSource(signals::DifferentialSensorSourceValue newDifferentialSensorSource)
Modifies this configuration's DifferentialSensorSource parameter and returns itself for method-chaini...
Definition: Configs.hpp:1284
std::string ToString() const override
Definition: Configs.hpp:1314
signals::DifferentialSensorSourceValue DifferentialSensorSource
Choose what sensor source is used for differential control of a mechanism.
Definition: Configs.hpp:1255
int DifferentialRemoteSensorID
Device ID of which remote sensor to use on the differential axis.
Definition: Configs.hpp:1276
int DifferentialTalonFXSensorID
Device ID of which remote Talon FX to use.
Definition: Configs.hpp:1265
Configs that affect the feedback of this motor controller.
Definition: Configs.hpp:1022
FeedbackConfigs & WithSensorToMechanismRatio(double newSensorToMechanismRatio)
Modifies this configuration's SensorToMechanismRatio parameter and returns itself for method-chaining...
Definition: Configs.hpp:1125
std::string ToString() const override
Definition: Configs.hpp:1182
FeedbackConfigs & WithFeedbackSensorSource(signals::FeedbackSensorSourceValue newFeedbackSensorSource)
Modifies this configuration's FeedbackSensorSource parameter and returns itself for method-chaining a...
Definition: Configs.hpp:1147
double FeedbackRotorOffset
This offset is applied to the absolute integrated rotor sensor.
Definition: Configs.hpp:1034
signals::FeedbackSensorSourceValue FeedbackSensorSource
Choose what sensor source is reported via API and used by closed-loop and limit features.
Definition: Configs.hpp:1096
FeedbackConfigs & WithRemoteCANcoder(const hardware::core::CoreCANcoder &device)
Helper method to configure this feedback group to use Remote CANcoder by passing in the CANcoder obje...
double SensorToMechanismRatio
This is the ratio of sensor rotations to the mechanism's output.
Definition: Configs.hpp:1047
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:1208
std::string Serialize() const override
Definition: Configs.hpp:1196
double RotorToSensorRatio
Talon FX is capable of fusing a remote CANcoder with its rotor sensor to produce a high-bandwidth sen...
Definition: Configs.hpp:1060
FeedbackConfigs & WithFeedbackRotorOffset(double newFeedbackRotorOffset)
Modifies this configuration's FeedbackRotorOffset parameter and returns itself for method-chaining an...
Definition: Configs.hpp:1114
FeedbackConfigs & WithFeedbackRemoteSensorID(int newFeedbackRemoteSensorID)
Modifies this configuration's FeedbackRemoteSensorID parameter and returns itself for method-chaining...
Definition: Configs.hpp:1158
FeedbackConfigs & WithRotorToSensorRatio(double newRotorToSensorRatio)
Modifies this configuration's RotorToSensorRatio parameter and returns itself for method-chaining and...
Definition: Configs.hpp:1136
int FeedbackRemoteSensorID
Device ID of which remote device to use.
Definition: Configs.hpp:1106
FeedbackConfigs & WithFusedCANcoder(const hardware::core::CoreCANcoder &device)
Helper method to configure this feedback group to use Fused CANcoder by passing in the CANcoder objec...
Configs to trim the Pigeon2's gyroscope.
Definition: Configs.hpp:261
GyroTrimConfigs & WithGyroScalarZ(double newGyroScalarZ)
Modifies this configuration's GyroScalarZ parameter and returns itself for method-chaining and easier...
Definition: Configs.hpp:319
std::string Serialize() const override
Definition: Configs.hpp:339
std::string ToString() const override
Definition: Configs.hpp:327
double GyroScalarX
The gyro scalar component for the X axis.
Definition: Configs.hpp:271
GyroTrimConfigs & WithGyroScalarY(double newGyroScalarY)
Modifies this configuration's GyroScalarY parameter and returns itself for method-chaining and easier...
Definition: Configs.hpp:308
GyroTrimConfigs & WithGyroScalarX(double newGyroScalarX)
Modifies this configuration's GyroScalarX parameter and returns itself for method-chaining and easier...
Definition: Configs.hpp:297
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:349
double GyroScalarZ
The gyro scalar component for the Z axis.
Definition: Configs.hpp:289
double GyroScalarY
The gyro scalar component for the Y axis.
Definition: Configs.hpp:280
Configs that change how the motor controller behaves under different limit switch statse.
Definition: Configs.hpp:1687
std::string ToString() const override
Definition: Configs.hpp:1917
signals::ForwardLimitTypeValue ForwardLimitType
Determines if limit is normally-open (default) or normally-closed.
Definition: Configs.hpp:1694
HardwareLimitSwitchConfigs & WithForwardLimitRemoteSensorID(int newForwardLimitRemoteSensorID)
Modifies this configuration's ForwardLimitRemoteSensorID parameter and returns itself for method-chai...
Definition: Configs.hpp:1843
signals::ForwardLimitSourceValue ForwardLimitSource
Determines where to poll the forward limit switch.
Definition: Configs.hpp:1724
HardwareLimitSwitchConfigs & WithReverseLimitSource(signals::ReverseLimitSourceValue newReverseLimitSource)
Modifies this configuration's ReverseLimitSource parameter and returns itself for method-chaining and...
Definition: Configs.hpp:1898
bool ForwardLimitEnable
If enabled, motor output is set to neutral when forward limit switch is asseted and positive output i...
Definition: Configs.hpp:1718
HardwareLimitSwitchConfigs & WithReverseLimitRemoteSensorID(int newReverseLimitRemoteSensorID)
Modifies this configuration's ReverseLimitRemoteSensorID parameter and returns itself for method-chai...
Definition: Configs.hpp:1909
bool ReverseLimitAutosetPositionEnable
If enabled, the position is auto-set to a specific value, specified by ReverseLimitAutosetPositionVal...
Definition: Configs.hpp:1747
bool ForwardLimitAutosetPositionEnable
If enabled, the position is auto-set to a specific value, specified by ForwardLimitAutosetPositionVal...
Definition: Configs.hpp:1701
signals::ReverseLimitTypeValue ReverseLimitType
Determines if limit is normally-open (default) or normally-closed.
Definition: Configs.hpp:1740
HardwareLimitSwitchConfigs & WithForwardLimitSource(signals::ForwardLimitSourceValue newForwardLimitSource)
Modifies this configuration's ForwardLimitSource parameter and returns itself for method-chaining and...
Definition: Configs.hpp:1832
double ReverseLimitAutosetPositionValue
The value to auto-set the position to.
Definition: Configs.hpp:1757
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:1957
int ForwardLimitRemoteSensorID
Device ID of the device if using remote limit switch features.
Definition: Configs.hpp:1734
double ForwardLimitAutosetPositionValue
The value to auto-set the position to.
Definition: Configs.hpp:1711
signals::ReverseLimitSourceValue ReverseLimitSource
Determines where to poll the reverse limit switch.
Definition: Configs.hpp:1770
HardwareLimitSwitchConfigs & WithForwardLimitAutosetPositionEnable(bool newForwardLimitAutosetPositionEnable)
Modifies this configuration's ForwardLimitAutosetPositionEnable parameter and returns itself for meth...
Definition: Configs.hpp:1799
HardwareLimitSwitchConfigs & WithReverseLimitEnable(bool newReverseLimitEnable)
Modifies this configuration's ReverseLimitEnable parameter and returns itself for method-chaining and...
Definition: Configs.hpp:1887
std::string Serialize() const override
Definition: Configs.hpp:1938
HardwareLimitSwitchConfigs & WithReverseLimitType(signals::ReverseLimitTypeValue newReverseLimitType)
Modifies this configuration's ReverseLimitType parameter and returns itself for method-chaining and e...
Definition: Configs.hpp:1854
HardwareLimitSwitchConfigs & WithReverseLimitAutosetPositionEnable(bool newReverseLimitAutosetPositionEnable)
Modifies this configuration's ReverseLimitAutosetPositionEnable parameter and returns itself for meth...
Definition: Configs.hpp:1865
HardwareLimitSwitchConfigs & WithForwardLimitEnable(bool newForwardLimitEnable)
Modifies this configuration's ForwardLimitEnable parameter and returns itself for method-chaining and...
Definition: Configs.hpp:1821
HardwareLimitSwitchConfigs & WithForwardLimitAutosetPositionValue(double newForwardLimitAutosetPositionValue)
Modifies this configuration's ForwardLimitAutosetPositionValue parameter and returns itself for metho...
Definition: Configs.hpp:1810
HardwareLimitSwitchConfigs & WithReverseLimitAutosetPositionValue(double newReverseLimitAutosetPositionValue)
Modifies this configuration's ReverseLimitAutosetPositionValue parameter and returns itself for metho...
Definition: Configs.hpp:1876
bool ReverseLimitEnable
If enabled, motor output is set to neutral when reverse limit switch is asseted and positive output i...
Definition: Configs.hpp:1764
int ReverseLimitRemoteSensorID
Device ID of the device if using remote limit switch features.
Definition: Configs.hpp:1780
HardwareLimitSwitchConfigs & WithForwardLimitType(signals::ForwardLimitTypeValue newForwardLimitType)
Modifies this configuration's ForwardLimitType parameter and returns itself for method-chaining and e...
Definition: Configs.hpp:1788
Configs that affect the magnet sensor and how to interpret it.
Definition: Configs.hpp:46
std::string Serialize() const override
Definition: Configs.hpp:121
signals::AbsoluteSensorRangeValue AbsoluteSensorRange
The range of the absolute sensor, either [-0.5, 0.5) or [0, 1).
Definition: Configs.hpp:71
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:131
MagnetSensorConfigs & WithMagnetOffset(double newMagnetOffset)
Modifies this configuration's MagnetOffset parameter and returns itself for method-chaining and easie...
Definition: Configs.hpp:90
double MagnetOffset
This offset is added to the reported position, allowing the application to trim the zero position.
Definition: Configs.hpp:65
MagnetSensorConfigs & WithSensorDirection(signals::SensorDirectionValue newSensorDirection)
Modifies this configuration's SensorDirection parameter and returns itself for method-chaining and ea...
Definition: Configs.hpp:79
std::string ToString() const override
Definition: Configs.hpp:109
signals::SensorDirectionValue SensorDirection
Direction of the sensor to determine positive facing the LED side of the CANcoder.
Definition: Configs.hpp:53
MagnetSensorConfigs & WithAbsoluteSensorRange(signals::AbsoluteSensorRangeValue newAbsoluteSensorRange)
Modifies this configuration's AbsoluteSensorRange parameter and returns itself for method-chaining an...
Definition: Configs.hpp:101
Configs for Motion Magic®.
Definition: Configs.hpp:2220
double MotionMagicCruiseVelocity
This is the maximum velocity Motion Magic® based control modes are allowed to use.
Definition: Configs.hpp:2234
MotionMagicConfigs & WithMotionMagicJerk(double newMotionMagicJerk)
Modifies this configuration's MotionMagicJerk parameter and returns itself for method-chaining and ea...
Definition: Configs.hpp:2315
MotionMagicConfigs & WithMotionMagicAcceleration(double newMotionMagicAcceleration)
Modifies this configuration's MotionMagicAcceleration parameter and returns itself for method-chainin...
Definition: Configs.hpp:2304
MotionMagicConfigs & WithMotionMagicCruiseVelocity(double newMotionMagicCruiseVelocity)
Modifies this configuration's MotionMagicCruiseVelocity parameter and returns itself for method-chain...
Definition: Configs.hpp:2293
std::string Serialize() const override
Definition: Configs.hpp:2359
double MotionMagicJerk
This is the target jerk (acceleration derivative) Motion Magic® based control modes are allowed to us...
Definition: Configs.hpp:2258
double MotionMagicExpo_kV
This is the target kV used only by Motion Magic® Expo control modes, in units of V/rps.
Definition: Configs.hpp:2271
double MotionMagicAcceleration
This is the target acceleration Motion Magic® based control modes are allowed to use.
Definition: Configs.hpp:2245
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:2371
double MotionMagicExpo_kA
This is the target kA used only by Motion Magic® Expo control modes, in units of V/rps².
Definition: Configs.hpp:2285
MotionMagicConfigs & WithMotionMagicExpo_kV(double newMotionMagicExpo_kV)
Modifies this configuration's MotionMagicExpo_kV parameter and returns itself for method-chaining and...
Definition: Configs.hpp:2326
std::string ToString() const override
Definition: Configs.hpp:2345
MotionMagicConfigs & WithMotionMagicExpo_kA(double newMotionMagicExpo_kA)
Modifies this configuration's MotionMagicExpo_kA parameter and returns itself for method-chaining and...
Definition: Configs.hpp:2337
Configs that directly affect motor-output.
Definition: Configs.hpp:468
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:595
MotorOutputConfigs & WithNeutralMode(signals::NeutralModeValue newNeutralMode)
Modifies this configuration's NeutralMode parameter and returns itself for method-chaining and easier...
Definition: Configs.hpp:528
MotorOutputConfigs & WithPeakForwardDutyCycle(double newPeakForwardDutyCycle)
Modifies this configuration's PeakForwardDutyCycle parameter and returns itself for method-chaining a...
Definition: Configs.hpp:550
double PeakForwardDutyCycle
Maximum (forward) output during duty cycle based control modes.
Definition: Configs.hpp:499
double DutyCycleNeutralDeadband
Configures the output deadband percentage.
Definition: Configs.hpp:489
signals::NeutralModeValue NeutralMode
The state of the motor controller bridge when output is neutral or disabled.
Definition: Configs.hpp:480
MotorOutputConfigs & WithDutyCycleNeutralDeadband(double newDutyCycleNeutralDeadband)
Modifies this configuration's DutyCycleNeutralDeadband parameter and returns itself for method-chaini...
Definition: Configs.hpp:539
MotorOutputConfigs & WithPeakReverseDutyCycle(double newPeakReverseDutyCycle)
Modifies this configuration's PeakReverseDutyCycle parameter and returns itself for method-chaining a...
Definition: Configs.hpp:561
double PeakReverseDutyCycle
Minimum (reverse) output during duty cycle based control modes.
Definition: Configs.hpp:509
MotorOutputConfigs & WithInverted(signals::InvertedValue newInverted)
Modifies this configuration's Inverted parameter and returns itself for method-chaining and easier to...
Definition: Configs.hpp:517
std::string ToString() const override
Definition: Configs.hpp:569
signals::InvertedValue Inverted
Invert state of the device.
Definition: Configs.hpp:474
std::string Serialize() const override
Definition: Configs.hpp:583
Configs for Pigeon 2's Mount Pose configuration.
Definition: Configs.hpp:151
MountPoseConfigs & WithMountPoseRoll(double newMountPoseRoll)
Modifies this configuration's MountPoseRoll parameter and returns itself for method-chaining and easi...
Definition: Configs.hpp:209
double MountPoseYaw
The mounting calibration yaw-component.
Definition: Configs.hpp:161
double MountPosePitch
The mounting calibration pitch-component.
Definition: Configs.hpp:170
MountPoseConfigs & WithMountPosePitch(double newMountPosePitch)
Modifies this configuration's MountPosePitch parameter and returns itself for method-chaining and eas...
Definition: Configs.hpp:198
std::string ToString() const override
Definition: Configs.hpp:217
MountPoseConfigs & WithMountPoseYaw(double newMountPoseYaw)
Modifies this configuration's MountPoseYaw parameter and returns itself for method-chaining and easie...
Definition: Configs.hpp:187
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:239
double MountPoseRoll
The mounting calibration roll-component.
Definition: Configs.hpp:179
std::string Serialize() const override
Definition: Configs.hpp:229
Configs that affect the open-loop control of this motor controller.
Definition: Configs.hpp:1465
OpenLoopRampsConfigs & WithTorqueOpenLoopRampPeriod(double newTorqueOpenLoopRampPeriod)
Modifies this configuration's TorqueOpenLoopRampPeriod parameter and returns itself for method-chaini...
Definition: Configs.hpp:1526
std::string Serialize() const override
Definition: Configs.hpp:1546
OpenLoopRampsConfigs & WithDutyCycleOpenLoopRampPeriod(double newDutyCycleOpenLoopRampPeriod)
Modifies this configuration's DutyCycleOpenLoopRampPeriod parameter and returns itself for method-cha...
Definition: Configs.hpp:1504
double DutyCycleOpenLoopRampPeriod
If non-zero, this determines how much time to ramp from 0% output to 100% during open-loop modes.
Definition: Configs.hpp:1476
OpenLoopRampsConfigs & WithVoltageOpenLoopRampPeriod(double newVoltageOpenLoopRampPeriod)
Modifies this configuration's VoltageOpenLoopRampPeriod parameter and returns itself for method-chain...
Definition: Configs.hpp:1515
std::string ToString() const override
Definition: Configs.hpp:1534
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:1556
double VoltageOpenLoopRampPeriod
If non-zero, this determines how much time to ramp from 0V output to 12V during open-loop modes.
Definition: Configs.hpp:1486
double TorqueOpenLoopRampPeriod
If non-zero, this determines how much time to ramp from 0A output to 300A during open-loop modes.
Definition: Configs.hpp:1496
friend std::ostream & operator<<(std::ostream &str, const ParentConfiguration &v)
Definition: Configs.hpp:30
virtual ctre::phoenix::StatusCode Deserialize(const std::string &string)=0
virtual std::string ToString() const =0
Configs to enable/disable various features of the Pigeon2.
Definition: Configs.hpp:368
bool DisableTemperatureCompensation
Disables using the temperature compensation feature.
Definition: Configs.hpp:384
std::string ToString() const override
Definition: Configs.hpp:428
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:450
Pigeon2FeaturesConfigs & WithDisableNoMotionCalibration(bool newDisableNoMotionCalibration)
Modifies this configuration's DisableNoMotionCalibration parameter and returns itself for method-chai...
Definition: Configs.hpp:420
std::string Serialize() const override
Definition: Configs.hpp:440
bool DisableNoMotionCalibration
Disables using the no-motion calibration feature.
Definition: Configs.hpp:390
Pigeon2FeaturesConfigs & WithEnableCompass(bool newEnableCompass)
Modifies this configuration's EnableCompass parameter and returns itself for method-chaining and easi...
Definition: Configs.hpp:398
bool EnableCompass
Turns on or off the magnetometer fusing for 9-axis.
Definition: Configs.hpp:378
Pigeon2FeaturesConfigs & WithDisableTemperatureCompensation(bool newDisableTemperatureCompensation)
Modifies this configuration's DisableTemperatureCompensation parameter and returns itself for method-...
Definition: Configs.hpp:409
Gains for the specified slot.
Definition: Configs.hpp:2530
Slot0Configs & WithKP(double newKP)
Modifies this configuration's kP parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:2690
static Slot0Configs From(const SlotConfigs &value)
Slot0Configs & WithKV(double newKV)
Modifies this configuration's kV parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:2734
signals::StaticFeedforwardSignValue StaticFeedforwardSign
Static Feedforward Sign during position closed loop.
Definition: Configs.hpp:2682
Slot0Configs & WithKD(double newKD)
Modifies this configuration's kD parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:2712
std::string ToString() const override
Definition: Configs.hpp:2786
signals::GravityTypeValue GravityType
Gravity Feedforward Type.
Definition: Configs.hpp:2667
Slot0Configs & WithGravityType(signals::GravityTypeValue newGravityType)
Modifies this configuration's GravityType parameter and returns itself for method-chaining and easier...
Definition: Configs.hpp:2767
double kD
Derivative Gain.
Definition: Configs.hpp:2584
double kG
Gravity Feedforward Gain.
Definition: Configs.hpp:2650
double kV
Velocity Feedforward Gain.
Definition: Configs.hpp:2620
double kI
Integral Gain.
Definition: Configs.hpp:2565
Slot0Configs & WithStaticFeedforwardSign(signals::StaticFeedforwardSignValue newStaticFeedforwardSign)
Modifies this configuration's StaticFeedforwardSign parameter and returns itself for method-chaining ...
Definition: Configs.hpp:2778
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:2820
Slot0Configs & WithKI(double newKI)
Modifies this configuration's kI parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:2701
double kA
Acceleration Feedforward Gain.
Definition: Configs.hpp:2636
double kP
Proportional Gain.
Definition: Configs.hpp:2547
Slot0Configs & WithKG(double newKG)
Modifies this configuration's kG parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:2756
std::string Serialize() const override
Definition: Configs.hpp:2804
Slot0Configs & WithKS(double newKS)
Modifies this configuration's kS parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:2723
Slot0Configs & WithKA(double newKA)
Modifies this configuration's kA parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:2745
double kS
Static Feedforward Gain.
Definition: Configs.hpp:2604
Gains for the specified slot.
Definition: Configs.hpp:2845
Slot1Configs & WithKS(double newKS)
Modifies this configuration's kS parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3037
Slot1Configs & WithKI(double newKI)
Modifies this configuration's kI parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3015
std::string Serialize() const override
Definition: Configs.hpp:3118
static Slot1Configs From(const SlotConfigs &value)
double kD
Derivative Gain.
Definition: Configs.hpp:2899
double kI
Integral Gain.
Definition: Configs.hpp:2880
double kS
Static Feedforward Gain.
Definition: Configs.hpp:2919
signals::StaticFeedforwardSignValue StaticFeedforwardSign
Static Feedforward Sign during position closed loop.
Definition: Configs.hpp:2996
Slot1Configs & WithGravityType(signals::GravityTypeValue newGravityType)
Modifies this configuration's GravityType parameter and returns itself for method-chaining and easier...
Definition: Configs.hpp:3081
double kA
Acceleration Feedforward Gain.
Definition: Configs.hpp:2951
Slot1Configs & WithKV(double newKV)
Modifies this configuration's kV parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3048
double kG
Gravity Feedforward Gain.
Definition: Configs.hpp:2965
std::string ToString() const override
Definition: Configs.hpp:3100
Slot1Configs & WithKD(double newKD)
Modifies this configuration's kD parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3026
double kP
Proportional Gain.
Definition: Configs.hpp:2862
signals::GravityTypeValue GravityType
Gravity Feedforward Type.
Definition: Configs.hpp:2981
Slot1Configs & WithKG(double newKG)
Modifies this configuration's kG parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3070
Slot1Configs & WithKP(double newKP)
Modifies this configuration's kP parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3004
Slot1Configs & WithKA(double newKA)
Modifies this configuration's kA parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3059
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:3134
Slot1Configs & WithStaticFeedforwardSign(signals::StaticFeedforwardSignValue newStaticFeedforwardSign)
Modifies this configuration's StaticFeedforwardSign parameter and returns itself for method-chaining ...
Definition: Configs.hpp:3092
double kV
Velocity Feedforward Gain.
Definition: Configs.hpp:2935
Gains for the specified slot.
Definition: Configs.hpp:3159
double kV
Velocity Feedforward Gain.
Definition: Configs.hpp:3249
std::string Serialize() const override
Definition: Configs.hpp:3432
Slot2Configs & WithKV(double newKV)
Modifies this configuration's kV parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3362
signals::GravityTypeValue GravityType
Gravity Feedforward Type.
Definition: Configs.hpp:3295
double kP
Proportional Gain.
Definition: Configs.hpp:3176
Slot2Configs & WithKD(double newKD)
Modifies this configuration's kD parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3340
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:3448
double kI
Integral Gain.
Definition: Configs.hpp:3194
Slot2Configs & WithKI(double newKI)
Modifies this configuration's kI parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3329
double kA
Acceleration Feedforward Gain.
Definition: Configs.hpp:3265
Slot2Configs & WithKA(double newKA)
Modifies this configuration's kA parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3373
Slot2Configs & WithStaticFeedforwardSign(signals::StaticFeedforwardSignValue newStaticFeedforwardSign)
Modifies this configuration's StaticFeedforwardSign parameter and returns itself for method-chaining ...
Definition: Configs.hpp:3406
double kG
Gravity Feedforward Gain.
Definition: Configs.hpp:3279
Slot2Configs & WithKP(double newKP)
Modifies this configuration's kP parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3318
double kS
Static Feedforward Gain.
Definition: Configs.hpp:3233
static Slot2Configs From(const SlotConfigs &value)
Slot2Configs & WithGravityType(signals::GravityTypeValue newGravityType)
Modifies this configuration's GravityType parameter and returns itself for method-chaining and easier...
Definition: Configs.hpp:3395
Slot2Configs & WithKG(double newKG)
Modifies this configuration's kG parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3384
signals::StaticFeedforwardSignValue StaticFeedforwardSign
Static Feedforward Sign during position closed loop.
Definition: Configs.hpp:3310
std::string ToString() const override
Definition: Configs.hpp:3414
Slot2Configs & WithKS(double newKS)
Modifies this configuration's kS parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3351
double kD
Derivative Gain.
Definition: Configs.hpp:3213
Gains for the specified slot.
Definition: Configs.hpp:3472
static SlotConfigs From(const Slot2Configs &value)
std::string ToString() const
Definition: Configs.hpp:3788
double kP
Proportional Gain.
Definition: Configs.hpp:3541
static SlotConfigs From(const Slot1Configs &value)
SlotConfigs & WithKA(double newKA)
Modifies this configuration's kA parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3739
SlotConfigs & WithGravityType(signals::GravityTypeValue newGravityType)
Modifies this configuration's GravityType parameter and returns itself for method-chaining and easier...
Definition: Configs.hpp:3761
SlotConfigs & WithKD(double newKD)
Modifies this configuration's kD parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3706
double kG
Gravity Feedforward Gain.
Definition: Configs.hpp:3644
double kI
Integral Gain.
Definition: Configs.hpp:3559
SlotConfigs & WithKV(double newKV)
Modifies this configuration's kV parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3728
double kA
Acceleration Feedforward Gain.
Definition: Configs.hpp:3630
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize)
Definition: Configs.hpp:3823
signals::StaticFeedforwardSignValue StaticFeedforwardSign
Static Feedforward Sign during position closed loop.
Definition: Configs.hpp:3676
SlotConfigs & WithKP(double newKP)
Modifies this configuration's kP parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3684
double kD
Derivative Gain.
Definition: Configs.hpp:3578
SlotConfigs & WithKG(double newKG)
Modifies this configuration's kG parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3750
int SlotNumber
Chooses which slot these configs are for.
Definition: Configs.hpp:3782
double kV
Velocity Feedforward Gain.
Definition: Configs.hpp:3614
SlotConfigs & WithKS(double newKS)
Modifies this configuration's kS parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3717
std::string Serialize() const
Definition: Configs.hpp:3806
static SlotConfigs From(const Slot0Configs &value)
signals::GravityTypeValue GravityType
Gravity Feedforward Type.
Definition: Configs.hpp:3661
SlotConfigs & WithKI(double newKI)
Modifies this configuration's kI parameter and returns itself for method-chaining and easier to use c...
Definition: Configs.hpp:3695
SlotConfigs & WithStaticFeedforwardSign(signals::StaticFeedforwardSignValue newStaticFeedforwardSign)
Modifies this configuration's StaticFeedforwardSign parameter and returns itself for method-chaining ...
Definition: Configs.hpp:3772
double kS
Static Feedforward Gain.
Definition: Configs.hpp:3598
Configs that affect how software-limit switches behave.
Definition: Configs.hpp:2092
double ForwardSoftLimitThreshold
Position threshold for forward soft limit features.
Definition: Configs.hpp:2117
std::string ToString() const override
Definition: Configs.hpp:2176
double ReverseSoftLimitThreshold
Position threshold for reverse soft limit features.
Definition: Configs.hpp:2127
SoftwareLimitSwitchConfigs & WithForwardSoftLimitEnable(bool newForwardSoftLimitEnable)
Modifies this configuration's ForwardSoftLimitEnable parameter and returns itself for method-chaining...
Definition: Configs.hpp:2135
SoftwareLimitSwitchConfigs & WithForwardSoftLimitThreshold(double newForwardSoftLimitThreshold)
Modifies this configuration's ForwardSoftLimitThreshold parameter and returns itself for method-chain...
Definition: Configs.hpp:2157
SoftwareLimitSwitchConfigs & WithReverseSoftLimitEnable(bool newReverseSoftLimitEnable)
Modifies this configuration's ReverseSoftLimitEnable parameter and returns itself for method-chaining...
Definition: Configs.hpp:2146
std::string Serialize() const override
Definition: Configs.hpp:2189
SoftwareLimitSwitchConfigs & WithReverseSoftLimitThreshold(double newReverseSoftLimitThreshold)
Modifies this configuration's ReverseSoftLimitThreshold parameter and returns itself for method-chain...
Definition: Configs.hpp:2168
bool ReverseSoftLimitEnable
If enabled, the motor output is set to neutral if position exceeds ReverseSoftLimitThreshold and reve...
Definition: Configs.hpp:2107
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:2200
bool ForwardSoftLimitEnable
If enabled, the motor output is set to neutral if position exceeds ForwardSoftLimitThreshold and forw...
Definition: Configs.hpp:2100
Configs to control the maximum and minimum applied torque when using Torque Current control types.
Definition: Configs.hpp:910
std::string ToString() const override
Definition: Configs.hpp:979
double TorqueNeutralDeadband
Configures the output deadband during torque current based control modes.
Definition: Configs.hpp:941
TorqueCurrentConfigs & WithTorqueNeutralDeadband(double newTorqueNeutralDeadband)
Modifies this configuration's TorqueNeutralDeadband parameter and returns itself for method-chaining ...
Definition: Configs.hpp:971
double PeakForwardTorqueCurrent
Maximum (forward) output during torque current based control modes.
Definition: Configs.hpp:921
TorqueCurrentConfigs & WithPeakForwardTorqueCurrent(double newPeakForwardTorqueCurrent)
Modifies this configuration's PeakForwardTorqueCurrent parameter and returns itself for method-chaini...
Definition: Configs.hpp:949
TorqueCurrentConfigs & WithPeakReverseTorqueCurrent(double newPeakReverseTorqueCurrent)
Modifies this configuration's PeakReverseTorqueCurrent parameter and returns itself for method-chaini...
Definition: Configs.hpp:960
std::string Serialize() const override
Definition: Configs.hpp:991
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:1001
double PeakReverseTorqueCurrent
Minimum (reverse) output during torque current based control modes.
Definition: Configs.hpp:931
Voltage-specific configs.
Definition: Configs.hpp:797
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition: Configs.hpp:890
double PeakReverseVoltage
Minimum (reverse) output during voltage based control modes.
Definition: Configs.hpp:830
std::string Serialize() const override
Definition: Configs.hpp:880
std::string ToString() const override
Definition: Configs.hpp:868
double PeakForwardVoltage
Maximum (forward) output during voltage based control modes.
Definition: Configs.hpp:821
VoltageConfigs & WithPeakForwardVoltage(double newPeakForwardVoltage)
Modifies this configuration's PeakForwardVoltage parameter and returns itself for method-chaining and...
Definition: Configs.hpp:849
VoltageConfigs & WithSupplyVoltageTimeConstant(double newSupplyVoltageTimeConstant)
Modifies this configuration's SupplyVoltageTimeConstant parameter and returns itself for method-chain...
Definition: Configs.hpp:838
double SupplyVoltageTimeConstant
The time constant (in seconds) of the low-pass filter for the supply voltage.
Definition: Configs.hpp:812
VoltageConfigs & WithPeakReverseVoltage(double newPeakReverseVoltage)
Modifies this configuration's PeakReverseVoltage parameter and returns itself for method-chaining and...
Definition: Configs.hpp:860
Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along w...
Definition: CoreCANcoder.hpp:498
The range of the absolute sensor, either [-0.5, 0.5) or [0, 1).
Definition: SpnEnums.hpp:749
static constexpr int Signed_PlusMinusHalf
Definition: SpnEnums.hpp:754
Choose what sensor source is used for differential control of a mechanism.
Definition: SpnEnums.hpp:2146
static constexpr int Disabled
Definition: SpnEnums.hpp:2150
Choose what sensor source is reported via API and used by closed-loop and limit features.
Definition: SpnEnums.hpp:1628
int value
Definition: SpnEnums.hpp:1630
static constexpr int RotorSensor
Definition: SpnEnums.hpp:1632
Determines where to poll the forward limit switch.
Definition: SpnEnums.hpp:1769
static constexpr int LimitSwitchPin
Definition: SpnEnums.hpp:1773
int value
Definition: SpnEnums.hpp:1771
Determines if limit is normally-open (default) or normally-closed.
Definition: SpnEnums.hpp:1703
static constexpr int NormallyOpen
Definition: SpnEnums.hpp:1707
int value
Definition: SpnEnums.hpp:1705
Gravity Feedforward Type.
Definition: SpnEnums.hpp:1402
static constexpr int Elevator_Static
Definition: SpnEnums.hpp:1406
int value
Definition: SpnEnums.hpp:1404
Invert state of the device.
Definition: SpnEnums.hpp:1467
static constexpr int CounterClockwise_Positive
Definition: SpnEnums.hpp:1471
int value
Definition: SpnEnums.hpp:1469
The state of the motor controller bridge when output is neutral or disabled.
Definition: SpnEnums.hpp:1533
int value
Definition: SpnEnums.hpp:1535
static constexpr int Coast
Definition: SpnEnums.hpp:1537
Determines where to poll the reverse limit switch.
Definition: SpnEnums.hpp:1906
int value
Definition: SpnEnums.hpp:1908
static constexpr int LimitSwitchPin
Definition: SpnEnums.hpp:1910
Determines if limit is normally-open (default) or normally-closed.
Definition: SpnEnums.hpp:1840
static constexpr int NormallyOpen
Definition: SpnEnums.hpp:1844
int value
Definition: SpnEnums.hpp:1842
Direction of the sensor to determine positive facing the LED side of the CANcoder.
Definition: SpnEnums.hpp:246
static constexpr int CounterClockwise_Positive
Definition: SpnEnums.hpp:250
int value
Definition: SpnEnums.hpp:248
Static Feedforward Sign during position closed loop.
Definition: SpnEnums.hpp:2229
static constexpr int UseVelocitySign
Definition: SpnEnums.hpp:2233
Definition: string_util.hpp:15