CTRE Phoenix 6 C++ 26.70.0-alpha-2
Loading...
Searching...
No Matches
SwerveModuleConstants.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
10
11#include <wpi/units/length.hpp>
12#include <wpi/units/moment_of_inertia.hpp>
13#include <wpi/units/velocity.hpp>
14
15namespace ctre {
16namespace phoenix6 {
17namespace swerve {
18
19/**
20 * \brief Supported closed-loop output types.
21 */
24 /** \brief Requires Pro */
26};
27
28/**
29 * \brief Supported motor arrangements for the drive motors.
30 */
32 /**
33 * \brief Talon FX integrated brushless motor.
34 */
36 /**
37 * \brief Third party NEO brushless motor connected to a Talon FXS over JST.
38 */
40 /**
41 * \brief Third party VORTEX brushless motor connected to a Talon FXS over JST.
42 */
44};
45
46/**
47 * \brief Supported motor arrangements for the steer motors.
48 */
50 /**
51 * \brief Talon FX integrated brushless motor.
52 */
54 /**
55 * \brief CTR Electronics MinionĀ® brushless motor connected to a Talon FXS over JST.
56 */
58 /**
59 * \brief Third party NEO brushless motor connected to a Talon FXS over JST.
60 */
62 /**
63 * \brief Third party VORTEX brushless motor connected to a Talon FXS over JST.
64 */
66 /**
67 * \brief Third party NEO550 brushless motor connected to a Talon FXS over JST.
68 */
70 /**
71 * \brief Brushed motor connected to a Talon FXS on terminals A and B.
72 */
74 /**
75 * \brief Brushed motor connected to a Talon FXS on terminals A and C.
76 */
78 /**
79 * \brief Brushed motor connected to a Talon FXS on terminals B and C.
80 */
82};
83
84/**
85 * \brief Supported feedback sensors for the steer motors.
86 */
88 /**
89 * \brief Requires Pro; Use signals#FeedbackSensorSourceValue#FusedCANcoder
90 * for the steer motor.
91 */
93 /**
94 * \brief Requires Pro; Use signals#FeedbackSensorSourceValue#SyncCANcoder
95 * for the steer motor.
96 */
98 /**
99 * \brief Use signals#FeedbackSensorSourceValue#RemoteCANcoder
100 * for the steer motor.
101 */
103 /**
104 * \brief Requires Pro; Use signals#FeedbackSensorSourceValue#FusedCANdiPWM1
105 * for the steer motor.
106 */
108 /**
109 * \brief Requires Pro; Use signals#FeedbackSensorSourceValue#FusedCANdiPWM2
110 * for the steer motor.
111 */
113 /**
114 * \brief Requires Pro; Use signals#FeedbackSensorSourceValue#SyncCANdiPWM1
115 * for the steer motor.
116 */
118 /**
119 * \brief Requires Pro; Use signals#FeedbackSensorSourceValue#SyncCANdiPWM2
120 * for the steer motor.
121 */
123 /**
124 * \brief Use signals#FeedbackSensorSourceValue#RemoteCANdiPWM1
125 * for the steer motor.
126 */
128 /**
129 * \brief Use signals#FeedbackSensorSourceValue#RemoteCANdiPWM2
130 * for the steer motor.
131 */
133 /**
134 * \brief Use signals#ExternalFeedbackSensorSourceValue#PulseWidth
135 * for the steer motor. This requires Talon FXS.
136 */
138};
139
140/**
141 * \brief All constants for a swerve module.
142 *
143 * \tparam DriveMotorConfigsT Type of the drive motor configs
144 * \tparam SteerMotorConfigsT Type of the steer motor configs
145 * \tparam EncoderConfigsT Type of the steer encoder configs
146 */
147template <
148 std::derived_from<configs::ParentConfiguration> DriveMotorConfigsT,
149 std::derived_from<configs::ParentConfiguration> SteerMotorConfigsT,
150 std::derived_from<configs::ParentConfiguration> EncoderConfigsT
151>
153 constexpr SwerveModuleConstants() = default;
154
155 /**
156 * \brief CAN ID of the steer motor.
157 */
159 /**
160 * \brief CAN ID of the drive motor.
161 */
163 /**
164 * \brief CAN ID of the absolute encoder used for azimuth.
165 */
166 int EncoderId = 0;
167 /**
168 * \brief Offset of the azimuth encoder.
169 */
170 wpi::units::turn_t EncoderOffset = 0_tr;
171 /**
172 * \brief The location of this module's wheels relative to the physical center
173 * of the robot in meters along the X axis of the robot.
174 */
175 wpi::units::meter_t LocationX = 0_m;
176 /**
177 * \brief The location of this module's wheels relative to the physical center
178 * of the robot in meters along the Y axis of the robot.
179 */
180 wpi::units::meter_t LocationY = 0_m;
181 /**
182 * \brief True if the drive motor is inverted.
183 */
184 bool DriveMotorInverted = false;
185 /**
186 * \brief True if the steer motor is inverted from the azimuth. The azimuth
187 * should rotate counter-clockwise (as seen from the top of the robot) for a
188 * positive motor output.
189 */
190 bool SteerMotorInverted = false;
191 /**
192 * \brief True if the azimuth encoder is inverted from the azimuth. The encoder
193 * should report a positive velocity when the azimuth rotates counter-clockwise
194 * (as seen from the top of the robot).
195 */
196 bool EncoderInverted = false;
197 /**
198 * \brief Gear ratio between the drive motor and the wheel.
199 */
200 wpi::units::scalar_t DriveMotorGearRatio = 0;
201 /**
202 * \brief Gear ratio between the steer motor and the azimuth encoder. For
203 * example, the SDS Mk4 has a steering ratio of 12.8.
204 */
205 wpi::units::scalar_t SteerMotorGearRatio = 0;
206 /**
207 * \brief Coupled gear ratio between the azimuth encoder and the drive motor.
208 *
209 * For a typical swerve module, the azimuth turn motor also drives the wheel a
210 * nontrivial amount, which affects the accuracy of odometry and control. This
211 * ratio represents the number of rotations of the drive motor caused by a
212 * rotation of the azimuth.
213 */
214 wpi::units::scalar_t CouplingGearRatio = 0;
215 /**
216 * \brief Radius of the driving wheel in meters.
217 */
218 wpi::units::meter_t WheelRadius = 0_m;
219 /**
220 * \brief The steer motor closed-loop gains.
221 *
222 * The steer motor uses the control ouput type specified by
223 * #SteerMotorClosedLoopOutput and any SwerveModule#SteerRequestType. These
224 * gains operate on azimuth rotations (after the gear ratio).
225 */
227 /**
228 * \brief The drive motor closed-loop gains.
229 *
230 * When using closed-loop control, the drive motor uses the control output type
231 * specified by #DriveMotorClosedLoopOutput and any closed-loop
232 * SwerveModule#DriveRequestType. These gains operate on motor rotor rotations
233 * (before the gear ratio).
234 */
236 /**
237 * \brief The closed-loop output type to use for the steer motors.
238 */
240 /**
241 * \brief The closed-loop output type to use for the drive motors.
242 */
244 /**
245 * \brief The maximum amount of stator current the drive motors can apply
246 * without slippage.
247 */
248 wpi::units::ampere_t SlipCurrent = 120_A;
249 /**
250 * \brief When using open-loop drive control, this specifies the measured speed
251 * at which the robot travels when driven with 12 volts. This is used to
252 * approximate the output for a desired velocity; it cannot be used to change
253 * the desired max speed of the robot. If using closed loop control, this value
254 * is ignored.
255 */
256 wpi::units::meters_per_second_t SpeedAt12Volts = 0_mps;
257 /**
258 * \brief Choose the motor used for the drive motor.
259 *
260 * If using a Talon FX, this should be set to TalonFX_Integrated. If using a
261 * Talon FXS, this should be set to the motor attached to the Talon FXS.
262 */
264 /**
265 * \brief Choose the motor used for the steer motor.
266 *
267 * If using a Talon FX, this should be set to TalonFX_Integrated. If using a
268 * Talon FXS, this should be set to the motor attached to the Talon FXS.
269 */
271 /**
272 * \brief Choose how the feedback sensors should be configured.
273 *
274 * If the robot does not support Pro, then this should be set to RemoteCANcoder.
275 * Otherwise, users have the option to use either FusedCANcoder or SyncCANcoder
276 * depending on if there is a risk that the CANcoder can fail in a way to
277 * provide "good" data.
278 *
279 * If this is set to FusedCANcoder or SyncCANcoder when the steer motor is not
280 * Pro-licensed, the device will automatically fall back to RemoteCANcoder and
281 * report a UsingProFeatureOnUnlicensedDevice status code.
282 */
284 /**
285 * \brief The initial configs used to configure the drive motor of the swerve
286 * module. The default value is the factory-default.
287 *
288 * Users may change the initial configuration as they need. Any config that's
289 * not referenced in the SwerveModuleConstants class is available to be changed.
290 *
291 * The list of configs that will be overwritten is as follows:
292 *
293 * - configs#MotorOutputConfigs#NeutralMode (Brake mode, overwritten with
294 * SwerveDrivetrain#ConfigNeutralMode)
295 * - configs#MotorOutputConfigs#Inverted
296 * (SwerveModuleConstants#DriveMotorInverted)
297 * - configs#Slot0Configs (#DriveMotorGains)
298 * - configs#CurrentLimitsConfigs#StatorCurrentLimit /
299 * configs#TorqueCurrentConfigs#PeakForwardTorqueCurrent /
300 * configs#TorqueCurrentConfigs#PeakReverseTorqueCurrent (#SlipCurrent)
301 * - configs#CurrentLimitsConfigs#StatorCurrentLimitEnable (Enabled)
302 * - configs#FeedbackConfigs#RotorToSensorRatio /
303 * configs#FeedbackConfigs#SensorToMechanismRatio (1.0)
304 *
305 */
306 DriveMotorConfigsT DriveMotorInitialConfigs = {};
307 /**
308 * \brief The initial configs used to configure the steer motor of the swerve
309 * module. The default value is the factory-default.
310 *
311 * Users may change the initial configuration as they need. Any config that's
312 * not referenced in the SwerveModuleConstants class is available to be changed.
313 *
314 * The list of configs that will be overwritten is as follows:
315 *
316 * - configs#MotorOutputConfigs#NeutralMode (Brake mode)
317 * - configs#MotorOutputConfigs#Inverted
318 * (SwerveModuleConstants#SteerMotorInverted)
319 * - configs#Slot0Configs (#SteerMotorGains)
320 * - configs#FeedbackConfigs#FeedbackRemoteSensorID
321 * (SwerveModuleConstants#EncoderId)
322 * - configs#FeedbackConfigs#FeedbackSensorSource (#FeedbackSource)
323 * - configs#FeedbackConfigs#RotorToSensorRatio (#SteerMotorGearRatio)
324 * - configs#FeedbackConfigs#SensorToMechanismRatio (1.0)
325 * - configs#MotionMagicConfigs#MotionMagicExpo_kV /
326 * configs#MotionMagicConfigs#MotionMagicExpo_kA (Calculated from gear ratios)
327 * - configs#ClosedLoopGeneralConfigs#ContinuousWrap (true)
328 *
329 */
330 SteerMotorConfigsT SteerMotorInitialConfigs = {};
331 /**
332 * \brief The initial configs used to configure the azimuth encoder of the
333 * swerve module. The default value is the factory-default.
334 *
335 * Users may change the initial configuration as they need. Any config that's
336 * not referenced in the SwerveModuleConstants class is available to be changed.
337 *
338 * For CANcoder, the list of configs that will be overwritten is as follows:
339 *
340 * - configs#MagnetSensorConfigs#MagnetOffset
341 * (SwerveModuleConstants#EncoderOffset)
342 * - configs#MagnetSensorConfigs#SensorDirection
343 * (SwerveModuleConstants#EncoderInverted)
344 *
345 */
346 EncoderConfigsT EncoderInitialConfigs = {};
347 /**
348 * \brief Simulated azimuthal inertia.
349 */
350 wpi::units::kilogram_square_meter_t SteerInertia = 0.01_kg_sq_m;
351 /**
352 * \brief Simulated drive inertia.
353 */
354 wpi::units::kilogram_square_meter_t DriveInertia = 0.035_kg_sq_m;
355 /**
356 * \brief Simulated steer voltage required to overcome friction.
357 */
358 wpi::units::volt_t SteerFrictionVoltage = 0.2_V;
359 /**
360 * \brief Simulated drive voltage required to overcome friction.
361 */
362 wpi::units::volt_t DriveFrictionVoltage = 0.2_V;
363
364 /**
365 * \brief Modifies the SteerMotorId parameter and returns itself.
366 *
367 * CAN ID of the steer motor.
368 *
369 * \param newSteerMotorId Parameter to modify
370 * \returns this object
371 */
373 {
374 this->SteerMotorId = newSteerMotorId;
375 return *this;
376 }
377
378 /**
379 * \brief Modifies the DriveMotorId parameter and returns itself.
380 *
381 * CAN ID of the drive motor.
382 *
383 * \param newDriveMotorId Parameter to modify
384 * \returns this object
385 */
387 {
388 this->DriveMotorId = newDriveMotorId;
389 return *this;
390 }
391
392 /**
393 * \brief Modifies the EncoderId parameter and returns itself.
394 *
395 * CAN ID of the absolute encoder used for azimuth.
396 *
397 * \param newEncoderId Parameter to modify
398 * \returns this object
399 */
401 {
402 this->EncoderId = newEncoderId;
403 return *this;
404 }
405
406 /**
407 * \brief Modifies the EncoderOffset parameter and returns itself.
408 *
409 * Offset of the azimuth encoder.
410 *
411 * \param newEncoderOffset Parameter to modify
412 * \returns this object
413 */
415 {
416 this->EncoderOffset = newEncoderOffset;
417 return *this;
418 }
419
420 /**
421 * \brief Modifies the LocationX parameter and returns itself.
422 *
423 * The location of this module's wheels relative to the physical center of the
424 * robot in meters along the X axis of the robot.
425 *
426 * \param newLocationX Parameter to modify
427 * \returns this object
428 */
430 {
431 this->LocationX = newLocationX;
432 return *this;
433 }
434
435 /**
436 * \brief Modifies the LocationY parameter and returns itself.
437 *
438 * The location of this module's wheels relative to the physical center of the
439 * robot in meters along the Y axis of the robot.
440 *
441 * \param newLocationY Parameter to modify
442 * \returns this object
443 */
445 {
446 this->LocationY = newLocationY;
447 return *this;
448 }
449
450 /**
451 * \brief Modifies the DriveMotorInverted parameter and returns itself.
452 *
453 * True if the drive motor is inverted.
454 *
455 * \param newDriveMotorInverted Parameter to modify
456 * \returns this object
457 */
459 {
460 this->DriveMotorInverted = newDriveMotorInverted;
461 return *this;
462 }
463
464 /**
465 * \brief Modifies the SteerMotorInverted parameter and returns itself.
466 *
467 * True if the steer motor is inverted from the azimuth. The azimuth should
468 * rotate counter-clockwise (as seen from the top of the robot) for a positive
469 * motor output.
470 *
471 * \param newSteerMotorInverted Parameter to modify
472 * \returns this object
473 */
475 {
476 this->SteerMotorInverted = newSteerMotorInverted;
477 return *this;
478 }
479
480 /**
481 * \brief Modifies the EncoderInverted parameter and returns itself.
482 *
483 * True if the azimuth encoder is inverted from the azimuth. The encoder should
484 * report a positive velocity when the azimuth rotates counter-clockwise (as
485 * seen from the top of the robot).
486 *
487 * \param newEncoderInverted Parameter to modify
488 * \returns this object
489 */
491 {
492 this->EncoderInverted = newEncoderInverted;
493 return *this;
494 }
495
496 /**
497 * \brief Modifies the DriveMotorGearRatio parameter and returns itself.
498 *
499 * Gear ratio between the drive motor and the wheel.
500 *
501 * \param newDriveMotorGearRatio Parameter to modify
502 * \returns this object
503 */
505 {
506 this->DriveMotorGearRatio = newDriveMotorGearRatio;
507 return *this;
508 }
509
510 /**
511 * \brief Modifies the SteerMotorGearRatio parameter and returns itself.
512 *
513 * Gear ratio between the steer motor and the azimuth encoder. For example, the
514 * SDS Mk4 has a steering ratio of 12.8.
515 *
516 * \param newSteerMotorGearRatio Parameter to modify
517 * \returns this object
518 */
520 {
521 this->SteerMotorGearRatio = newSteerMotorGearRatio;
522 return *this;
523 }
524
525 /**
526 * \brief Modifies the CouplingGearRatio parameter and returns itself.
527 *
528 * Coupled gear ratio between the azimuth encoder and the drive motor.
529 *
530 * For a typical swerve module, the azimuth turn motor also drives the wheel a
531 * nontrivial amount, which affects the accuracy of odometry and control. This
532 * ratio represents the number of rotations of the drive motor caused by a
533 * rotation of the azimuth.
534 *
535 * \param newCouplingGearRatio Parameter to modify
536 * \returns this object
537 */
539 {
540 this->CouplingGearRatio = newCouplingGearRatio;
541 return *this;
542 }
543
544 /**
545 * \brief Modifies the WheelRadius parameter and returns itself.
546 *
547 * Radius of the driving wheel in meters.
548 *
549 * \param newWheelRadius Parameter to modify
550 * \returns this object
551 */
553 {
554 this->WheelRadius = newWheelRadius;
555 return *this;
556 }
557
558 /**
559 * \brief Modifies the SteerMotorGains parameter and returns itself.
560 *
561 * The steer motor closed-loop gains.
562 *
563 * The steer motor uses the control ouput type specified by
564 * #SteerMotorClosedLoopOutput and any SwerveModule#SteerRequestType. These
565 * gains operate on azimuth rotations (after the gear ratio).
566 *
567 * \param newSteerMotorGains Parameter to modify
568 * \returns this object
569 */
571 {
572 this->SteerMotorGains = newSteerMotorGains;
573 return *this;
574 }
575
576 /**
577 * \brief Modifies the DriveMotorGains parameter and returns itself.
578 *
579 * The drive motor closed-loop gains.
580 *
581 * When using closed-loop control, the drive motor uses the control output type
582 * specified by #DriveMotorClosedLoopOutput and any closed-loop
583 * SwerveModule#DriveRequestType. These gains operate on motor rotor rotations
584 * (before the gear ratio).
585 *
586 * \param newDriveMotorGains Parameter to modify
587 * \returns this object
588 */
590 {
591 this->DriveMotorGains = newDriveMotorGains;
592 return *this;
593 }
594
595 /**
596 * \brief Modifies the SteerMotorClosedLoopOutput parameter and returns itself.
597 *
598 * The closed-loop output type to use for the steer motors.
599 *
600 * \param newSteerMotorClosedLoopOutput Parameter to modify
601 * \returns this object
602 */
604 {
605 this->SteerMotorClosedLoopOutput = newSteerMotorClosedLoopOutput;
606 return *this;
607 }
608
609 /**
610 * \brief Modifies the DriveMotorClosedLoopOutput parameter and returns itself.
611 *
612 * The closed-loop output type to use for the drive motors.
613 *
614 * \param newDriveMotorClosedLoopOutput Parameter to modify
615 * \returns this object
616 */
618 {
619 this->DriveMotorClosedLoopOutput = newDriveMotorClosedLoopOutput;
620 return *this;
621 }
622
623 /**
624 * \brief Modifies the SlipCurrent parameter and returns itself.
625 *
626 * The maximum amount of stator current the drive motors can apply without
627 * slippage.
628 *
629 * \param newSlipCurrent Parameter to modify
630 * \returns this object
631 */
633 {
634 this->SlipCurrent = newSlipCurrent;
635 return *this;
636 }
637
638 /**
639 * \brief Modifies the SpeedAt12Volts parameter and returns itself.
640 *
641 * When using open-loop drive control, this specifies the measured speed at
642 * which the robot travels when driven with 12 volts. This is used to
643 * approximate the output for a desired velocity; it cannot be used to change
644 * the desired max speed of the robot. If using closed loop control, this value
645 * is ignored.
646 *
647 * \param newSpeedAt12Volts Parameter to modify
648 * \returns this object
649 */
651 {
652 this->SpeedAt12Volts = newSpeedAt12Volts;
653 return *this;
654 }
655
656 /**
657 * \brief Modifies the DriveMotorType parameter and returns itself.
658 *
659 * Choose the motor used for the drive motor.
660 *
661 * If using a Talon FX, this should be set to TalonFX_Integrated. If using a
662 * Talon FXS, this should be set to the motor attached to the Talon FXS.
663 *
664 * \param newDriveMotorType Parameter to modify
665 * \returns this object
666 */
668 {
669 this->DriveMotorType = newDriveMotorType;
670 return *this;
671 }
672
673 /**
674 * \brief Modifies the SteerMotorType parameter and returns itself.
675 *
676 * Choose the motor used for the steer motor.
677 *
678 * If using a Talon FX, this should be set to TalonFX_Integrated. If using a
679 * Talon FXS, this should be set to the motor attached to the Talon FXS.
680 *
681 * \param newSteerMotorType Parameter to modify
682 * \returns this object
683 */
685 {
686 this->SteerMotorType = newSteerMotorType;
687 return *this;
688 }
689
690 /**
691 * \brief Modifies the FeedbackSource parameter and returns itself.
692 *
693 * Choose how the feedback sensors should be configured.
694 *
695 * If the robot does not support Pro, then this should be set to RemoteCANcoder.
696 * Otherwise, users have the option to use either FusedCANcoder or SyncCANcoder
697 * depending on if there is a risk that the CANcoder can fail in a way to
698 * provide "good" data.
699 *
700 * If this is set to FusedCANcoder or SyncCANcoder when the steer motor is not
701 * Pro-licensed, the device will automatically fall back to RemoteCANcoder and
702 * report a UsingProFeatureOnUnlicensedDevice status code.
703 *
704 * \param newFeedbackSource Parameter to modify
705 * \returns this object
706 */
708 {
709 this->FeedbackSource = newFeedbackSource;
710 return *this;
711 }
712
713 /**
714 * \brief Modifies the DriveMotorInitialConfigs parameter and returns itself.
715 *
716 * The initial configs used to configure the drive motor of the swerve module.
717 * The default value is the factory-default.
718 *
719 * Users may change the initial configuration as they need. Any config that's
720 * not referenced in the SwerveModuleConstants class is available to be changed.
721 *
722 * The list of configs that will be overwritten is as follows:
723 *
724 * - configs#MotorOutputConfigs#NeutralMode (Brake mode, overwritten with
725 * SwerveDrivetrain#ConfigNeutralMode)
726 * - configs#MotorOutputConfigs#Inverted
727 * (SwerveModuleConstants#DriveMotorInverted)
728 * - configs#Slot0Configs (#DriveMotorGains)
729 * - configs#CurrentLimitsConfigs#StatorCurrentLimit /
730 * configs#TorqueCurrentConfigs#PeakForwardTorqueCurrent /
731 * configs#TorqueCurrentConfigs#PeakReverseTorqueCurrent (#SlipCurrent)
732 * - configs#CurrentLimitsConfigs#StatorCurrentLimitEnable (Enabled)
733 * - configs#FeedbackConfigs#RotorToSensorRatio /
734 * configs#FeedbackConfigs#SensorToMechanismRatio (1.0)
735 *
736 *
737 * \param newDriveMotorInitialConfigs Parameter to modify
738 * \returns this object
739 */
741 {
742 this->DriveMotorInitialConfigs = newDriveMotorInitialConfigs;
743 return *this;
744 }
745
746 /**
747 * \brief Modifies the SteerMotorInitialConfigs parameter and returns itself.
748 *
749 * The initial configs used to configure the steer motor of the swerve module.
750 * The default value is the factory-default.
751 *
752 * Users may change the initial configuration as they need. Any config that's
753 * not referenced in the SwerveModuleConstants class is available to be changed.
754 *
755 * The list of configs that will be overwritten is as follows:
756 *
757 * - configs#MotorOutputConfigs#NeutralMode (Brake mode)
758 * - configs#MotorOutputConfigs#Inverted
759 * (SwerveModuleConstants#SteerMotorInverted)
760 * - configs#Slot0Configs (#SteerMotorGains)
761 * - configs#FeedbackConfigs#FeedbackRemoteSensorID
762 * (SwerveModuleConstants#EncoderId)
763 * - configs#FeedbackConfigs#FeedbackSensorSource (#FeedbackSource)
764 * - configs#FeedbackConfigs#RotorToSensorRatio (#SteerMotorGearRatio)
765 * - configs#FeedbackConfigs#SensorToMechanismRatio (1.0)
766 * - configs#MotionMagicConfigs#MotionMagicExpo_kV /
767 * configs#MotionMagicConfigs#MotionMagicExpo_kA (Calculated from gear ratios)
768 * - configs#ClosedLoopGeneralConfigs#ContinuousWrap (true)
769 *
770 *
771 * \param newSteerMotorInitialConfigs Parameter to modify
772 * \returns this object
773 */
775 {
776 this->SteerMotorInitialConfigs = newSteerMotorInitialConfigs;
777 return *this;
778 }
779
780 /**
781 * \brief Modifies the EncoderInitialConfigs parameter and returns itself.
782 *
783 * The initial configs used to configure the azimuth encoder of the swerve
784 * module. The default value is the factory-default.
785 *
786 * Users may change the initial configuration as they need. Any config that's
787 * not referenced in the SwerveModuleConstants class is available to be changed.
788 *
789 * For CANcoder, the list of configs that will be overwritten is as follows:
790 *
791 * - configs#MagnetSensorConfigs#MagnetOffset
792 * (SwerveModuleConstants#EncoderOffset)
793 * - configs#MagnetSensorConfigs#SensorDirection
794 * (SwerveModuleConstants#EncoderInverted)
795 *
796 *
797 * \param newEncoderInitialConfigs Parameter to modify
798 * \returns this object
799 */
801 {
802 this->EncoderInitialConfigs = newEncoderInitialConfigs;
803 return *this;
804 }
805
806 /**
807 * \brief Modifies the SteerInertia parameter and returns itself.
808 *
809 * Simulated azimuthal inertia.
810 *
811 * \param newSteerInertia Parameter to modify
812 * \returns this object
813 */
814 constexpr SwerveModuleConstants<DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT> &WithSteerInertia(wpi::units::kilogram_square_meter_t newSteerInertia)
815 {
816 this->SteerInertia = newSteerInertia;
817 return *this;
818 }
819
820 /**
821 * \brief Modifies the DriveInertia parameter and returns itself.
822 *
823 * Simulated drive inertia.
824 *
825 * \param newDriveInertia Parameter to modify
826 * \returns this object
827 */
828 constexpr SwerveModuleConstants<DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT> &WithDriveInertia(wpi::units::kilogram_square_meter_t newDriveInertia)
829 {
830 this->DriveInertia = newDriveInertia;
831 return *this;
832 }
833
834 /**
835 * \brief Modifies the SteerFrictionVoltage parameter and returns itself.
836 *
837 * Simulated steer voltage required to overcome friction.
838 *
839 * \param newSteerFrictionVoltage Parameter to modify
840 * \returns this object
841 */
843 {
844 this->SteerFrictionVoltage = newSteerFrictionVoltage;
845 return *this;
846 }
847
848 /**
849 * \brief Modifies the DriveFrictionVoltage parameter and returns itself.
850 *
851 * Simulated drive voltage required to overcome friction.
852 *
853 * \param newDriveFrictionVoltage Parameter to modify
854 * \returns this object
855 */
857 {
858 this->DriveFrictionVoltage = newDriveFrictionVoltage;
859 return *this;
860 }
861
862};
863
864/**
865 * \brief Constants that are common across the swerve modules, used
866 * for creating instances of module-specific SwerveModuleConstants.
867 *
868 * \tparam DriveMotorConfigsT Type of the drive motor configs
869 * \tparam SteerMotorConfigsT Type of the steer motor configs
870 * \tparam EncoderConfigsT Type of the steer encoder configs
871 */
872template <
873 std::derived_from<configs::ParentConfiguration> DriveMotorConfigsT,
874 std::derived_from<configs::ParentConfiguration> SteerMotorConfigsT,
875 std::derived_from<configs::ParentConfiguration> EncoderConfigsT
876>
878 constexpr SwerveModuleConstantsFactory() = default;
879
880 /**
881 * \brief Gear ratio between the drive motor and the wheel.
882 */
883 wpi::units::scalar_t DriveMotorGearRatio = 0;
884 /**
885 * \brief Gear ratio between the steer motor and the azimuth encoder. For
886 * example, the SDS Mk4 has a steering ratio of 12.8.
887 */
888 wpi::units::scalar_t SteerMotorGearRatio = 0;
889 /**
890 * \brief Coupled gear ratio between the azimuth encoder and the drive motor.
891 *
892 * For a typical swerve module, the azimuth turn motor also drives the wheel a
893 * nontrivial amount, which affects the accuracy of odometry and control. This
894 * ratio represents the number of rotations of the drive motor caused by a
895 * rotation of the azimuth.
896 */
897 wpi::units::scalar_t CouplingGearRatio = 0;
898 /**
899 * \brief Radius of the driving wheel in meters.
900 */
901 wpi::units::meter_t WheelRadius = 0_m;
902 /**
903 * \brief The steer motor closed-loop gains.
904 *
905 * The steer motor uses the control ouput type specified by
906 * #SteerMotorClosedLoopOutput and any SwerveModule#SteerRequestType. These
907 * gains operate on azimuth rotations (after the gear ratio).
908 */
910 /**
911 * \brief The drive motor closed-loop gains.
912 *
913 * When using closed-loop control, the drive motor uses the control output type
914 * specified by #DriveMotorClosedLoopOutput and any closed-loop
915 * SwerveModule#DriveRequestType. These gains operate on motor rotor rotations
916 * (before the gear ratio).
917 */
919 /**
920 * \brief The closed-loop output type to use for the steer motors.
921 */
923 /**
924 * \brief The closed-loop output type to use for the drive motors.
925 */
927 /**
928 * \brief The maximum amount of stator current the drive motors can apply
929 * without slippage.
930 */
931 wpi::units::ampere_t SlipCurrent = 120_A;
932 /**
933 * \brief When using open-loop drive control, this specifies the measured speed
934 * at which the robot travels when driven with 12 volts. This is used to
935 * approximate the output for a desired velocity; it cannot be used to change
936 * the desired max speed of the robot. If using closed loop control, this value
937 * is ignored.
938 */
939 wpi::units::meters_per_second_t SpeedAt12Volts = 0_mps;
940 /**
941 * \brief Choose the motor used for the drive motor.
942 *
943 * If using a Talon FX, this should be set to TalonFX_Integrated. If using a
944 * Talon FXS, this should be set to the motor attached to the Talon FXS.
945 */
947 /**
948 * \brief Choose the motor used for the steer motor.
949 *
950 * If using a Talon FX, this should be set to TalonFX_Integrated. If using a
951 * Talon FXS, this should be set to the motor attached to the Talon FXS.
952 */
954 /**
955 * \brief Choose how the feedback sensors should be configured.
956 *
957 * If the robot does not support Pro, then this should be set to RemoteCANcoder.
958 * Otherwise, users have the option to use either FusedCANcoder or SyncCANcoder
959 * depending on if there is a risk that the CANcoder can fail in a way to
960 * provide "good" data.
961 *
962 * If this is set to FusedCANcoder or SyncCANcoder when the steer motor is not
963 * Pro-licensed, the device will automatically fall back to RemoteCANcoder and
964 * report a UsingProFeatureOnUnlicensedDevice status code.
965 */
967 /**
968 * \brief The initial configs used to configure the drive motor of the swerve
969 * module. The default value is the factory-default.
970 *
971 * Users may change the initial configuration as they need. Any config that's
972 * not referenced in the SwerveModuleConstants class is available to be changed.
973 *
974 * The list of configs that will be overwritten is as follows:
975 *
976 * - configs#MotorOutputConfigs#NeutralMode (Brake mode, overwritten with
977 * SwerveDrivetrain#ConfigNeutralMode)
978 * - configs#MotorOutputConfigs#Inverted
979 * (SwerveModuleConstants#DriveMotorInverted)
980 * - configs#Slot0Configs (#DriveMotorGains)
981 * - configs#CurrentLimitsConfigs#StatorCurrentLimit /
982 * configs#TorqueCurrentConfigs#PeakForwardTorqueCurrent /
983 * configs#TorqueCurrentConfigs#PeakReverseTorqueCurrent (#SlipCurrent)
984 * - configs#CurrentLimitsConfigs#StatorCurrentLimitEnable (Enabled)
985 * - configs#FeedbackConfigs#RotorToSensorRatio /
986 * configs#FeedbackConfigs#SensorToMechanismRatio (1.0)
987 *
988 */
989 DriveMotorConfigsT DriveMotorInitialConfigs = {};
990 /**
991 * \brief The initial configs used to configure the steer motor of the swerve
992 * module. The default value is the factory-default.
993 *
994 * Users may change the initial configuration as they need. Any config that's
995 * not referenced in the SwerveModuleConstants class is available to be changed.
996 *
997 * The list of configs that will be overwritten is as follows:
998 *
999 * - configs#MotorOutputConfigs#NeutralMode (Brake mode)
1000 * - configs#MotorOutputConfigs#Inverted
1001 * (SwerveModuleConstants#SteerMotorInverted)
1002 * - configs#Slot0Configs (#SteerMotorGains)
1003 * - configs#FeedbackConfigs#FeedbackRemoteSensorID
1004 * (SwerveModuleConstants#EncoderId)
1005 * - configs#FeedbackConfigs#FeedbackSensorSource (#FeedbackSource)
1006 * - configs#FeedbackConfigs#RotorToSensorRatio (#SteerMotorGearRatio)
1007 * - configs#FeedbackConfigs#SensorToMechanismRatio (1.0)
1008 * - configs#MotionMagicConfigs#MotionMagicExpo_kV /
1009 * configs#MotionMagicConfigs#MotionMagicExpo_kA (Calculated from gear ratios)
1010 * - configs#ClosedLoopGeneralConfigs#ContinuousWrap (true)
1011 *
1012 */
1013 SteerMotorConfigsT SteerMotorInitialConfigs = {};
1014 /**
1015 * \brief The initial configs used to configure the azimuth encoder of the
1016 * swerve module. The default value is the factory-default.
1017 *
1018 * Users may change the initial configuration as they need. Any config that's
1019 * not referenced in the SwerveModuleConstants class is available to be changed.
1020 *
1021 * For CANcoder, the list of configs that will be overwritten is as follows:
1022 *
1023 * - configs#MagnetSensorConfigs#MagnetOffset
1024 * (SwerveModuleConstants#EncoderOffset)
1025 * - configs#MagnetSensorConfigs#SensorDirection
1026 * (SwerveModuleConstants#EncoderInverted)
1027 *
1028 */
1029 EncoderConfigsT EncoderInitialConfigs = {};
1030 /**
1031 * \brief Simulated azimuthal inertia.
1032 */
1033 wpi::units::kilogram_square_meter_t SteerInertia = 0.01_kg_sq_m;
1034 /**
1035 * \brief Simulated drive inertia.
1036 */
1037 wpi::units::kilogram_square_meter_t DriveInertia = 0.035_kg_sq_m;
1038 /**
1039 * \brief Simulated steer voltage required to overcome friction.
1040 */
1041 wpi::units::volt_t SteerFrictionVoltage = 0.2_V;
1042 /**
1043 * \brief Simulated drive voltage required to overcome friction.
1044 */
1045 wpi::units::volt_t DriveFrictionVoltage = 0.2_V;
1046
1047 /**
1048 * \brief Modifies the DriveMotorGearRatio parameter and returns itself.
1049 *
1050 * Gear ratio between the drive motor and the wheel.
1051 *
1052 * \param newDriveMotorGearRatio Parameter to modify
1053 * \returns this object
1054 */
1056 {
1057 this->DriveMotorGearRatio = newDriveMotorGearRatio;
1058 return *this;
1059 }
1060
1061 /**
1062 * \brief Modifies the SteerMotorGearRatio parameter and returns itself.
1063 *
1064 * Gear ratio between the steer motor and the azimuth encoder. For example, the
1065 * SDS Mk4 has a steering ratio of 12.8.
1066 *
1067 * \param newSteerMotorGearRatio Parameter to modify
1068 * \returns this object
1069 */
1071 {
1072 this->SteerMotorGearRatio = newSteerMotorGearRatio;
1073 return *this;
1074 }
1075
1076 /**
1077 * \brief Modifies the CouplingGearRatio parameter and returns itself.
1078 *
1079 * Coupled gear ratio between the azimuth encoder and the drive motor.
1080 *
1081 * For a typical swerve module, the azimuth turn motor also drives the wheel a
1082 * nontrivial amount, which affects the accuracy of odometry and control. This
1083 * ratio represents the number of rotations of the drive motor caused by a
1084 * rotation of the azimuth.
1085 *
1086 * \param newCouplingGearRatio Parameter to modify
1087 * \returns this object
1088 */
1090 {
1091 this->CouplingGearRatio = newCouplingGearRatio;
1092 return *this;
1093 }
1094
1095 /**
1096 * \brief Modifies the WheelRadius parameter and returns itself.
1097 *
1098 * Radius of the driving wheel in meters.
1099 *
1100 * \param newWheelRadius Parameter to modify
1101 * \returns this object
1102 */
1104 {
1105 this->WheelRadius = newWheelRadius;
1106 return *this;
1107 }
1108
1109 /**
1110 * \brief Modifies the SteerMotorGains parameter and returns itself.
1111 *
1112 * The steer motor closed-loop gains.
1113 *
1114 * The steer motor uses the control ouput type specified by
1115 * #SteerMotorClosedLoopOutput and any SwerveModule#SteerRequestType. These
1116 * gains operate on azimuth rotations (after the gear ratio).
1117 *
1118 * \param newSteerMotorGains Parameter to modify
1119 * \returns this object
1120 */
1122 {
1123 this->SteerMotorGains = newSteerMotorGains;
1124 return *this;
1125 }
1126
1127 /**
1128 * \brief Modifies the DriveMotorGains parameter and returns itself.
1129 *
1130 * The drive motor closed-loop gains.
1131 *
1132 * When using closed-loop control, the drive motor uses the control output type
1133 * specified by #DriveMotorClosedLoopOutput and any closed-loop
1134 * SwerveModule#DriveRequestType. These gains operate on motor rotor rotations
1135 * (before the gear ratio).
1136 *
1137 * \param newDriveMotorGains Parameter to modify
1138 * \returns this object
1139 */
1141 {
1142 this->DriveMotorGains = newDriveMotorGains;
1143 return *this;
1144 }
1145
1146 /**
1147 * \brief Modifies the SteerMotorClosedLoopOutput parameter and returns itself.
1148 *
1149 * The closed-loop output type to use for the steer motors.
1150 *
1151 * \param newSteerMotorClosedLoopOutput Parameter to modify
1152 * \returns this object
1153 */
1155 {
1156 this->SteerMotorClosedLoopOutput = newSteerMotorClosedLoopOutput;
1157 return *this;
1158 }
1159
1160 /**
1161 * \brief Modifies the DriveMotorClosedLoopOutput parameter and returns itself.
1162 *
1163 * The closed-loop output type to use for the drive motors.
1164 *
1165 * \param newDriveMotorClosedLoopOutput Parameter to modify
1166 * \returns this object
1167 */
1169 {
1170 this->DriveMotorClosedLoopOutput = newDriveMotorClosedLoopOutput;
1171 return *this;
1172 }
1173
1174 /**
1175 * \brief Modifies the SlipCurrent parameter and returns itself.
1176 *
1177 * The maximum amount of stator current the drive motors can apply without
1178 * slippage.
1179 *
1180 * \param newSlipCurrent Parameter to modify
1181 * \returns this object
1182 */
1184 {
1185 this->SlipCurrent = newSlipCurrent;
1186 return *this;
1187 }
1188
1189 /**
1190 * \brief Modifies the SpeedAt12Volts parameter and returns itself.
1191 *
1192 * When using open-loop drive control, this specifies the measured speed at
1193 * which the robot travels when driven with 12 volts. This is used to
1194 * approximate the output for a desired velocity; it cannot be used to change
1195 * the desired max speed of the robot. If using closed loop control, this value
1196 * is ignored.
1197 *
1198 * \param newSpeedAt12Volts Parameter to modify
1199 * \returns this object
1200 */
1202 {
1203 this->SpeedAt12Volts = newSpeedAt12Volts;
1204 return *this;
1205 }
1206
1207 /**
1208 * \brief Modifies the DriveMotorType parameter and returns itself.
1209 *
1210 * Choose the motor used for the drive motor.
1211 *
1212 * If using a Talon FX, this should be set to TalonFX_Integrated. If using a
1213 * Talon FXS, this should be set to the motor attached to the Talon FXS.
1214 *
1215 * \param newDriveMotorType Parameter to modify
1216 * \returns this object
1217 */
1219 {
1220 this->DriveMotorType = newDriveMotorType;
1221 return *this;
1222 }
1223
1224 /**
1225 * \brief Modifies the SteerMotorType parameter and returns itself.
1226 *
1227 * Choose the motor used for the steer motor.
1228 *
1229 * If using a Talon FX, this should be set to TalonFX_Integrated. If using a
1230 * Talon FXS, this should be set to the motor attached to the Talon FXS.
1231 *
1232 * \param newSteerMotorType Parameter to modify
1233 * \returns this object
1234 */
1236 {
1237 this->SteerMotorType = newSteerMotorType;
1238 return *this;
1239 }
1240
1241 /**
1242 * \brief Modifies the FeedbackSource parameter and returns itself.
1243 *
1244 * Choose how the feedback sensors should be configured.
1245 *
1246 * If the robot does not support Pro, then this should be set to RemoteCANcoder.
1247 * Otherwise, users have the option to use either FusedCANcoder or SyncCANcoder
1248 * depending on if there is a risk that the CANcoder can fail in a way to
1249 * provide "good" data.
1250 *
1251 * If this is set to FusedCANcoder or SyncCANcoder when the steer motor is not
1252 * Pro-licensed, the device will automatically fall back to RemoteCANcoder and
1253 * report a UsingProFeatureOnUnlicensedDevice status code.
1254 *
1255 * \param newFeedbackSource Parameter to modify
1256 * \returns this object
1257 */
1259 {
1260 this->FeedbackSource = newFeedbackSource;
1261 return *this;
1262 }
1263
1264 /**
1265 * \brief Modifies the DriveMotorInitialConfigs parameter and returns itself.
1266 *
1267 * The initial configs used to configure the drive motor of the swerve module.
1268 * The default value is the factory-default.
1269 *
1270 * Users may change the initial configuration as they need. Any config that's
1271 * not referenced in the SwerveModuleConstants class is available to be changed.
1272 *
1273 * The list of configs that will be overwritten is as follows:
1274 *
1275 * - configs#MotorOutputConfigs#NeutralMode (Brake mode, overwritten with
1276 * SwerveDrivetrain#ConfigNeutralMode)
1277 * - configs#MotorOutputConfigs#Inverted
1278 * (SwerveModuleConstants#DriveMotorInverted)
1279 * - configs#Slot0Configs (#DriveMotorGains)
1280 * - configs#CurrentLimitsConfigs#StatorCurrentLimit /
1281 * configs#TorqueCurrentConfigs#PeakForwardTorqueCurrent /
1282 * configs#TorqueCurrentConfigs#PeakReverseTorqueCurrent (#SlipCurrent)
1283 * - configs#CurrentLimitsConfigs#StatorCurrentLimitEnable (Enabled)
1284 * - configs#FeedbackConfigs#RotorToSensorRatio /
1285 * configs#FeedbackConfigs#SensorToMechanismRatio (1.0)
1286 *
1287 *
1288 * \param newDriveMotorInitialConfigs Parameter to modify
1289 * \returns this object
1290 */
1292 {
1293 this->DriveMotorInitialConfigs = newDriveMotorInitialConfigs;
1294 return *this;
1295 }
1296
1297 /**
1298 * \brief Modifies the SteerMotorInitialConfigs parameter and returns itself.
1299 *
1300 * The initial configs used to configure the steer motor of the swerve module.
1301 * The default value is the factory-default.
1302 *
1303 * Users may change the initial configuration as they need. Any config that's
1304 * not referenced in the SwerveModuleConstants class is available to be changed.
1305 *
1306 * The list of configs that will be overwritten is as follows:
1307 *
1308 * - configs#MotorOutputConfigs#NeutralMode (Brake mode)
1309 * - configs#MotorOutputConfigs#Inverted
1310 * (SwerveModuleConstants#SteerMotorInverted)
1311 * - configs#Slot0Configs (#SteerMotorGains)
1312 * - configs#FeedbackConfigs#FeedbackRemoteSensorID
1313 * (SwerveModuleConstants#EncoderId)
1314 * - configs#FeedbackConfigs#FeedbackSensorSource (#FeedbackSource)
1315 * - configs#FeedbackConfigs#RotorToSensorRatio (#SteerMotorGearRatio)
1316 * - configs#FeedbackConfigs#SensorToMechanismRatio (1.0)
1317 * - configs#MotionMagicConfigs#MotionMagicExpo_kV /
1318 * configs#MotionMagicConfigs#MotionMagicExpo_kA (Calculated from gear ratios)
1319 * - configs#ClosedLoopGeneralConfigs#ContinuousWrap (true)
1320 *
1321 *
1322 * \param newSteerMotorInitialConfigs Parameter to modify
1323 * \returns this object
1324 */
1326 {
1327 this->SteerMotorInitialConfigs = newSteerMotorInitialConfigs;
1328 return *this;
1329 }
1330
1331 /**
1332 * \brief Modifies the EncoderInitialConfigs parameter and returns itself.
1333 *
1334 * The initial configs used to configure the azimuth encoder of the swerve
1335 * module. The default value is the factory-default.
1336 *
1337 * Users may change the initial configuration as they need. Any config that's
1338 * not referenced in the SwerveModuleConstants class is available to be changed.
1339 *
1340 * For CANcoder, the list of configs that will be overwritten is as follows:
1341 *
1342 * - configs#MagnetSensorConfigs#MagnetOffset
1343 * (SwerveModuleConstants#EncoderOffset)
1344 * - configs#MagnetSensorConfigs#SensorDirection
1345 * (SwerveModuleConstants#EncoderInverted)
1346 *
1347 *
1348 * \param newEncoderInitialConfigs Parameter to modify
1349 * \returns this object
1350 */
1352 {
1353 this->EncoderInitialConfigs = newEncoderInitialConfigs;
1354 return *this;
1355 }
1356
1357 /**
1358 * \brief Modifies the SteerInertia parameter and returns itself.
1359 *
1360 * Simulated azimuthal inertia.
1361 *
1362 * \param newSteerInertia Parameter to modify
1363 * \returns this object
1364 */
1366 {
1367 this->SteerInertia = newSteerInertia;
1368 return *this;
1369 }
1370
1371 /**
1372 * \brief Modifies the DriveInertia parameter and returns itself.
1373 *
1374 * Simulated drive inertia.
1375 *
1376 * \param newDriveInertia Parameter to modify
1377 * \returns this object
1378 */
1380 {
1381 this->DriveInertia = newDriveInertia;
1382 return *this;
1383 }
1384
1385 /**
1386 * \brief Modifies the SteerFrictionVoltage parameter and returns itself.
1387 *
1388 * Simulated steer voltage required to overcome friction.
1389 *
1390 * \param newSteerFrictionVoltage Parameter to modify
1391 * \returns this object
1392 */
1394 {
1395 this->SteerFrictionVoltage = newSteerFrictionVoltage;
1396 return *this;
1397 }
1398
1399 /**
1400 * \brief Modifies the DriveFrictionVoltage parameter and returns itself.
1401 *
1402 * Simulated drive voltage required to overcome friction.
1403 *
1404 * \param newDriveFrictionVoltage Parameter to modify
1405 * \returns this object
1406 */
1408 {
1409 this->DriveFrictionVoltage = newDriveFrictionVoltage;
1410 return *this;
1411 }
1412
1413 /**
1414 * \brief Creates the constants for a swerve module with the given properties.
1415 *
1416 * \param steerMotorId CAN ID of the steer motor.
1417 * \param driveMotorId CAN ID of the drive motor.
1418 * \param encoderId CAN ID of the absolute encoder used for azimuth.
1419 * \param encoderOffset Offset of the azimuth encoder.
1420 * \param locationX The location of this module's wheels relative to the
1421 * physical center of the robot in meters along the X axis of
1422 * the robot.
1423 * \param locationY The location of this module's wheels relative to the
1424 * physical center of the robot in meters along the Y axis of
1425 * the robot.
1426 * \param driveMotorInverted True if the drive motor is inverted.
1427 * \param steerMotorInverted True if the steer motor is inverted from the
1428 * azimuth. The azimuth should rotate
1429 * counter-clockwise (as seen from the top of the
1430 * robot) for a positive motor output.
1431 * \param encoderInverted True if the azimuth encoder is inverted from the
1432 * azimuth. The encoder should report a positive velocity
1433 * when the azimuth rotates counter-clockwise (as seen
1434 * from the top of the robot).
1435 * \returns Constants for the swerve module
1436 */
1438 int steerMotorId,
1439 int driveMotorId,
1440 int encoderId,
1441 wpi::units::turn_t encoderOffset,
1442 wpi::units::meter_t locationX,
1443 wpi::units::meter_t locationY,
1444 bool driveMotorInverted,
1445 bool steerMotorInverted,
1446 bool encoderInverted) const
1447 {
1449 .WithSteerMotorId(steerMotorId)
1450 .WithDriveMotorId(driveMotorId)
1451 .WithEncoderId(encoderId)
1452 .WithEncoderOffset(encoderOffset)
1453 .WithLocationX(locationX)
1454 .WithLocationY(locationY)
1455 .WithDriveMotorInverted(driveMotorInverted)
1456 .WithSteerMotorInverted(steerMotorInverted)
1457 .WithEncoderInverted(encoderInverted)
1458 .WithDriveMotorGearRatio(DriveMotorGearRatio)
1459 .WithSteerMotorGearRatio(SteerMotorGearRatio)
1460 .WithCouplingGearRatio(CouplingGearRatio)
1461 .WithWheelRadius(WheelRadius)
1462 .WithSteerMotorGains(SteerMotorGains)
1463 .WithDriveMotorGains(DriveMotorGains)
1464 .WithSteerMotorClosedLoopOutput(SteerMotorClosedLoopOutput)
1465 .WithDriveMotorClosedLoopOutput(DriveMotorClosedLoopOutput)
1466 .WithSlipCurrent(SlipCurrent)
1467 .WithSpeedAt12Volts(SpeedAt12Volts)
1468 .WithDriveMotorType(DriveMotorType)
1469 .WithSteerMotorType(SteerMotorType)
1470 .WithFeedbackSource(FeedbackSource)
1471 .WithDriveMotorInitialConfigs(DriveMotorInitialConfigs)
1472 .WithSteerMotorInitialConfigs(SteerMotorInitialConfigs)
1473 .WithEncoderInitialConfigs(EncoderInitialConfigs)
1474 .WithSteerInertia(SteerInertia)
1475 .WithDriveInertia(DriveInertia)
1476 .WithSteerFrictionVoltage(SteerFrictionVoltage)
1477 .WithDriveFrictionVoltage(DriveFrictionVoltage);
1478 }
1479};
1480
1481}
1482}
1483}
Gains for the specified slot.
Definition Slot0Configs.hpp:26
Definition SwerveModule.hpp:28
ClosedLoopOutputType
Supported closed-loop output types.
Definition SwerveModuleConstants.hpp:22
@ TorqueCurrentFOC
Requires Pro.
Definition SwerveModuleConstants.hpp:25
@ Voltage
Definition SwerveModuleConstants.hpp:23
SteerMotorArrangement
Supported motor arrangements for the steer motors.
Definition SwerveModuleConstants.hpp:49
@ TalonFXS_Brushed_AC
Brushed motor connected to a Talon FXS on terminals A and C.
Definition SwerveModuleConstants.hpp:77
@ TalonFXS_Brushed_AB
Brushed motor connected to a Talon FXS on terminals A and B.
Definition SwerveModuleConstants.hpp:73
@ TalonFX_Integrated
Talon FX integrated brushless motor.
Definition SwerveModuleConstants.hpp:53
@ TalonFXS_Brushed_BC
Brushed motor connected to a Talon FXS on terminals B and C.
Definition SwerveModuleConstants.hpp:81
@ TalonFXS_NEO550_JST
Third party NEO550 brushless motor connected to a Talon FXS over JST.
Definition SwerveModuleConstants.hpp:69
@ TalonFXS_Minion_JST
CTR Electronics MinionĀ® brushless motor connected to a Talon FXS over JST.
Definition SwerveModuleConstants.hpp:57
SteerFeedbackType
Supported feedback sensors for the steer motors.
Definition SwerveModuleConstants.hpp:87
@ FusedCANcoder
Requires Pro; Use signals::FeedbackSensorSourceValue::FusedCANcoder for the steer motor.
Definition SwerveModuleConstants.hpp:92
@ SyncCANdiPWM2
Requires Pro; Use signals::FeedbackSensorSourceValue::SyncCANdiPWM2 for the steer motor.
Definition SwerveModuleConstants.hpp:122
@ SyncCANdiPWM1
Requires Pro; Use signals::FeedbackSensorSourceValue::SyncCANdiPWM1 for the steer motor.
Definition SwerveModuleConstants.hpp:117
@ RemoteCANdiPWM2
Use signals::FeedbackSensorSourceValue::RemoteCANdiPWM2 for the steer motor.
Definition SwerveModuleConstants.hpp:132
@ FusedCANdiPWM2
Requires Pro; Use signals::FeedbackSensorSourceValue::FusedCANdiPWM2 for the steer motor.
Definition SwerveModuleConstants.hpp:112
@ FusedCANdiPWM1
Requires Pro; Use signals::FeedbackSensorSourceValue::FusedCANdiPWM1 for the steer motor.
Definition SwerveModuleConstants.hpp:107
@ RemoteCANdiPWM1
Use signals::FeedbackSensorSourceValue::RemoteCANdiPWM1 for the steer motor.
Definition SwerveModuleConstants.hpp:127
@ SyncCANcoder
Requires Pro; Use signals::FeedbackSensorSourceValue::SyncCANcoder for the steer motor.
Definition SwerveModuleConstants.hpp:97
@ TalonFXS_PulseWidth
Use signals::ExternalFeedbackSensorSourceValue::PulseWidth for the steer motor.
Definition SwerveModuleConstants.hpp:137
@ RemoteCANcoder
Use signals::FeedbackSensorSourceValue::RemoteCANcoder for the steer motor.
Definition SwerveModuleConstants.hpp:102
DriveMotorArrangement
Supported motor arrangements for the drive motors.
Definition SwerveModuleConstants.hpp:31
@ TalonFX_Integrated
Talon FX integrated brushless motor.
Definition SwerveModuleConstants.hpp:35
@ TalonFXS_NEO_JST
Third party NEO brushless motor connected to a Talon FXS over JST.
Definition SwerveModuleConstants.hpp:39
@ TalonFXS_VORTEX_JST
Third party VORTEX brushless motor connected to a Talon FXS over JST.
Definition SwerveModuleConstants.hpp:43
Definition ExternalFeedbackConfigs.hpp:16
Definition motor_constants.h:14
wpi::units::scalar_t DriveMotorGearRatio
Gear ratio between the drive motor and the wheel.
Definition SwerveModuleConstants.hpp:883
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorGearRatio(wpi::units::scalar_t newDriveMotorGearRatio)
Modifies the DriveMotorGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:1055
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSpeedAt12Volts(wpi::units::meters_per_second_t newSpeedAt12Volts)
Modifies the SpeedAt12Volts parameter and returns itself.
Definition SwerveModuleConstants.hpp:1201
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerFrictionVoltage(wpi::units::volt_t newSteerFrictionVoltage)
Modifies the SteerFrictionVoltage parameter and returns itself.
Definition SwerveModuleConstants.hpp:1393
configs::Slot0Configs DriveMotorGains
The drive motor closed-loop gains.
Definition SwerveModuleConstants.hpp:918
wpi::units::volt_t SteerFrictionVoltage
Simulated steer voltage required to overcome friction.
Definition SwerveModuleConstants.hpp:1041
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSlipCurrent(wpi::units::ampere_t newSlipCurrent)
Modifies the SlipCurrent parameter and returns itself.
Definition SwerveModuleConstants.hpp:1183
wpi::units::kilogram_square_meter_t SteerInertia
Simulated azimuthal inertia.
Definition SwerveModuleConstants.hpp:1033
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithEncoderInitialConfigs(EncoderConfigsT newEncoderInitialConfigs)
Modifies the EncoderInitialConfigs parameter and returns itself.
Definition SwerveModuleConstants.hpp:1351
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithFeedbackSource(SteerFeedbackType newFeedbackSource)
Modifies the FeedbackSource parameter and returns itself.
Definition SwerveModuleConstants.hpp:1258
wpi::units::ampere_t SlipCurrent
The maximum amount of stator current the drive motors can apply without slippage.
Definition SwerveModuleConstants.hpp:931
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorType(DriveMotorArrangement newDriveMotorType)
Modifies the DriveMotorType parameter and returns itself.
Definition SwerveModuleConstants.hpp:1218
DriveMotorConfigsT DriveMotorInitialConfigs
The initial configs used to configure the drive motor of the swerve module.
Definition SwerveModuleConstants.hpp:989
ClosedLoopOutputType DriveMotorClosedLoopOutput
The closed-loop output type to use for the drive motors.
Definition SwerveModuleConstants.hpp:926
EncoderConfigsT EncoderInitialConfigs
The initial configs used to configure the azimuth encoder of the swerve module.
Definition SwerveModuleConstants.hpp:1029
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > CreateModuleConstants(int steerMotorId, int driveMotorId, int encoderId, wpi::units::turn_t encoderOffset, wpi::units::meter_t locationX, wpi::units::meter_t locationY, bool driveMotorInverted, bool steerMotorInverted, bool encoderInverted) const
Creates the constants for a swerve module with the given properties.
Definition SwerveModuleConstants.hpp:1437
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorClosedLoopOutput(ClosedLoopOutputType newDriveMotorClosedLoopOutput)
Modifies the DriveMotorClosedLoopOutput parameter and returns itself.
Definition SwerveModuleConstants.hpp:1168
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveInertia(wpi::units::kilogram_square_meter_t newDriveInertia)
Modifies the DriveInertia parameter and returns itself.
Definition SwerveModuleConstants.hpp:1379
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithCouplingGearRatio(wpi::units::scalar_t newCouplingGearRatio)
Modifies the CouplingGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:1089
SteerMotorConfigsT SteerMotorInitialConfigs
The initial configs used to configure the steer motor of the swerve module.
Definition SwerveModuleConstants.hpp:1013
configs::Slot0Configs SteerMotorGains
The steer motor closed-loop gains.
Definition SwerveModuleConstants.hpp:909
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithWheelRadius(wpi::units::meter_t newWheelRadius)
Modifies the WheelRadius parameter and returns itself.
Definition SwerveModuleConstants.hpp:1103
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorGains(configs::Slot0Configs newDriveMotorGains)
Modifies the DriveMotorGains parameter and returns itself.
Definition SwerveModuleConstants.hpp:1140
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorInitialConfigs(SteerMotorConfigsT newSteerMotorInitialConfigs)
Modifies the SteerMotorInitialConfigs parameter and returns itself.
Definition SwerveModuleConstants.hpp:1325
ClosedLoopOutputType SteerMotorClosedLoopOutput
The closed-loop output type to use for the steer motors.
Definition SwerveModuleConstants.hpp:922
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorClosedLoopOutput(ClosedLoopOutputType newSteerMotorClosedLoopOutput)
Modifies the SteerMotorClosedLoopOutput parameter and returns itself.
Definition SwerveModuleConstants.hpp:1154
SteerMotorArrangement SteerMotorType
Choose the motor used for the steer motor.
Definition SwerveModuleConstants.hpp:953
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveFrictionVoltage(wpi::units::volt_t newDriveFrictionVoltage)
Modifies the DriveFrictionVoltage parameter and returns itself.
Definition SwerveModuleConstants.hpp:1407
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerInertia(wpi::units::kilogram_square_meter_t newSteerInertia)
Modifies the SteerInertia parameter and returns itself.
Definition SwerveModuleConstants.hpp:1365
wpi::units::meter_t WheelRadius
Radius of the driving wheel in meters.
Definition SwerveModuleConstants.hpp:901
wpi::units::scalar_t CouplingGearRatio
Coupled gear ratio between the azimuth encoder and the drive motor.
Definition SwerveModuleConstants.hpp:897
wpi::units::kilogram_square_meter_t DriveInertia
Simulated drive inertia.
Definition SwerveModuleConstants.hpp:1037
SteerFeedbackType FeedbackSource
Choose how the feedback sensors should be configured.
Definition SwerveModuleConstants.hpp:966
DriveMotorArrangement DriveMotorType
Choose the motor used for the drive motor.
Definition SwerveModuleConstants.hpp:946
wpi::units::volt_t DriveFrictionVoltage
Simulated drive voltage required to overcome friction.
Definition SwerveModuleConstants.hpp:1045
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorGains(configs::Slot0Configs newSteerMotorGains)
Modifies the SteerMotorGains parameter and returns itself.
Definition SwerveModuleConstants.hpp:1121
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorGearRatio(wpi::units::scalar_t newSteerMotorGearRatio)
Modifies the SteerMotorGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:1070
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorType(SteerMotorArrangement newSteerMotorType)
Modifies the SteerMotorType parameter and returns itself.
Definition SwerveModuleConstants.hpp:1235
wpi::units::meters_per_second_t SpeedAt12Volts
When using open-loop drive control, this specifies the measured speed at which the robot travels when...
Definition SwerveModuleConstants.hpp:939
constexpr SwerveModuleConstantsFactory< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorInitialConfigs(DriveMotorConfigsT newDriveMotorInitialConfigs)
Modifies the DriveMotorInitialConfigs parameter and returns itself.
Definition SwerveModuleConstants.hpp:1291
wpi::units::scalar_t SteerMotorGearRatio
Gear ratio between the steer motor and the azimuth encoder.
Definition SwerveModuleConstants.hpp:888
All constants for a swerve module.
Definition SwerveModuleConstants.hpp:152
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveInertia(wpi::units::kilogram_square_meter_t newDriveInertia)
Modifies the DriveInertia parameter and returns itself.
Definition SwerveModuleConstants.hpp:828
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithWheelRadius(wpi::units::meter_t newWheelRadius)
Modifies the WheelRadius parameter and returns itself.
Definition SwerveModuleConstants.hpp:552
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorId(int newDriveMotorId)
Modifies the DriveMotorId parameter and returns itself.
Definition SwerveModuleConstants.hpp:386
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithCouplingGearRatio(wpi::units::scalar_t newCouplingGearRatio)
Modifies the CouplingGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:538
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithEncoderId(int newEncoderId)
Modifies the EncoderId parameter and returns itself.
Definition SwerveModuleConstants.hpp:400
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSpeedAt12Volts(wpi::units::meters_per_second_t newSpeedAt12Volts)
Modifies the SpeedAt12Volts parameter and returns itself.
Definition SwerveModuleConstants.hpp:650
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorType(DriveMotorArrangement newDriveMotorType)
Modifies the DriveMotorType parameter and returns itself.
Definition SwerveModuleConstants.hpp:667
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorClosedLoopOutput(ClosedLoopOutputType newDriveMotorClosedLoopOutput)
Modifies the DriveMotorClosedLoopOutput parameter and returns itself.
Definition SwerveModuleConstants.hpp:617
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorInitialConfigs(const SteerMotorConfigsT &newSteerMotorInitialConfigs)
Modifies the SteerMotorInitialConfigs parameter and returns itself.
Definition SwerveModuleConstants.hpp:774
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithLocationY(wpi::units::meter_t newLocationY)
Modifies the LocationY parameter and returns itself.
Definition SwerveModuleConstants.hpp:444
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorInitialConfigs(const DriveMotorConfigsT &newDriveMotorInitialConfigs)
Modifies the DriveMotorInitialConfigs parameter and returns itself.
Definition SwerveModuleConstants.hpp:740
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorGearRatio(wpi::units::scalar_t newSteerMotorGearRatio)
Modifies the SteerMotorGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:519
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithFeedbackSource(SteerFeedbackType newFeedbackSource)
Modifies the FeedbackSource parameter and returns itself.
Definition SwerveModuleConstants.hpp:707
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorGearRatio(wpi::units::scalar_t newDriveMotorGearRatio)
Modifies the DriveMotorGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:504
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorId(int newSteerMotorId)
Modifies the SteerMotorId parameter and returns itself.
Definition SwerveModuleConstants.hpp:372
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSlipCurrent(wpi::units::ampere_t newSlipCurrent)
Modifies the SlipCurrent parameter and returns itself.
Definition SwerveModuleConstants.hpp:632
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithLocationX(wpi::units::meter_t newLocationX)
Modifies the LocationX parameter and returns itself.
Definition SwerveModuleConstants.hpp:429
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorGains(const configs::Slot0Configs &newDriveMotorGains)
Modifies the DriveMotorGains parameter and returns itself.
Definition SwerveModuleConstants.hpp:589
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithEncoderOffset(wpi::units::turn_t newEncoderOffset)
Modifies the EncoderOffset parameter and returns itself.
Definition SwerveModuleConstants.hpp:414
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveFrictionVoltage(wpi::units::volt_t newDriveFrictionVoltage)
Modifies the DriveFrictionVoltage parameter and returns itself.
Definition SwerveModuleConstants.hpp:856
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithEncoderInverted(bool newEncoderInverted)
Modifies the EncoderInverted parameter and returns itself.
Definition SwerveModuleConstants.hpp:490
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorClosedLoopOutput(ClosedLoopOutputType newSteerMotorClosedLoopOutput)
Modifies the SteerMotorClosedLoopOutput parameter and returns itself.
Definition SwerveModuleConstants.hpp:603
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerInertia(wpi::units::kilogram_square_meter_t newSteerInertia)
Modifies the SteerInertia parameter and returns itself.
Definition SwerveModuleConstants.hpp:814
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerFrictionVoltage(wpi::units::volt_t newSteerFrictionVoltage)
Modifies the SteerFrictionVoltage parameter and returns itself.
Definition SwerveModuleConstants.hpp:842
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorInverted(bool newSteerMotorInverted)
Modifies the SteerMotorInverted parameter and returns itself.
Definition SwerveModuleConstants.hpp:474
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithEncoderInitialConfigs(const EncoderConfigsT &newEncoderInitialConfigs)
Modifies the EncoderInitialConfigs parameter and returns itself.
Definition SwerveModuleConstants.hpp:800
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorGains(const configs::Slot0Configs &newSteerMotorGains)
Modifies the SteerMotorGains parameter and returns itself.
Definition SwerveModuleConstants.hpp:570
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithDriveMotorInverted(bool newDriveMotorInverted)
Modifies the DriveMotorInverted parameter and returns itself.
Definition SwerveModuleConstants.hpp:458
constexpr SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > & WithSteerMotorType(SteerMotorArrangement newSteerMotorType)
Modifies the SteerMotorType parameter and returns itself.
Definition SwerveModuleConstants.hpp:684