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