Swervedrive
Constructor
Config
Type | Name | Description | See Also |
---|---|---|---|
std::string | path | The path in the networktables | |
wom::SwerveModule::angle_pid_conf_t | anglePID | The angle PID config | SwerveModule |
wom::SwerveModule::velocity_pid_conf_t | velocityPID | The velocity PID config | SwerveModule |
wpi::array<SwerveModuleConfig, 4> | modules | The modules | SwerveModule |
wom::Gyro | gyro | The gyro | Gyro |
units::kilogram_t | mass | The mass of the robot | |
wpi::array<double, 3> | stateStdDevs | The standard deviations of the state | |
wpi::array<double, 3> | visionMeasurementStdDevs | The standard deviations of the vision measurements |
Example
SwerveDriveState
An enum of states for the swervedrive.
Name | Value | Description |
---|---|---|
kZeroing | 0 | The drivetrain is zeroing |
kIdle | 1 | The drivetrain is idle |
kVelocity | 2 | The drivetrain is driving in velocity mode |
kFieldRelativeVelocity | 3 | The drivetrain is driving in field relative velocity mode |
kPose | 4 | The drivetrain is driving in pose mode |
kIndividualTuning | 5 | The drivetrain is tuning individual modules |
kTuning | 6 | The drivetrain is tuning |
kXWheels | 7 | The drivetrain is driving in x wheels mode |
kModuleTurn | 8 | The drivetrain is turning a module |
kFRVelocityRotationLock | 9 | The drivetrain is driving in field relative velocity rotation lock mode |
Example
FieldRelativeSpeeds
A struct of speeds for the swervedrive.
Type | Name | Description | See Also |
---|---|---|---|
units::meters_per_second_t | vx | The x speed | |
units::meters_per_second_t | vy | The y speed | |
units::radians_per_second_t | omega | The omega speed |
Example
Methods
RotateMatchJoystick
Switches the state to handle the robot’s rotation matching that of the joystick.
Usage
SetIdle
Switches the state to idle.
Usage
SetZeroing
Switches the state to zeroing.
Usage
SetVelocity
Switches the state to velocity.
Usage
SetFieldRelativeVelocity
Switches the state to field relative velocity.
Usage
SetPose
Switches the state to pose.
Usage
IsAtSetPose
Checks if the robot is at the set pose.
Usage
SetIndividualTuning
Switches the state to individual tuning.
Usage
SetTuning
Switches the state to tuning.
Usage
SetZero
Sets PID setpoints to zero.
Usage
SetVoltageLimit
Sets the voltage limit.
Usage
OnResetMode
Resets the intergral value of the PID controllers.
Usage
SetXWheelState
Switches the state to x wheels.
Usage
SetIsFieldRelative
Sets whether the drivetrain is field relative.
Usage
GetIsFieldRelative
Gets whether the drivetrain is field relative.
Usage
SetAccelerationLimit
Sets the acceleration limit.
Usage
ResetPose
Resets the pose.
Usage
GetPose
Gets the pose.
Usage
AddVisionMeasurement
Adds a vision measurement.
Usage
GetConfig
Gets the config of the drivetrain.
Returns SwerveDriveConfig
(see above)
Usage
Swerve Modules
Constructor
Example
Config
Type | Name | Description | See Also |
---|---|---|---|
frc::Translation2d | position | The position of the module | |
wom::utils::Gearbox | driveMotor | The drive gearbox | Gearbox |
wom::utils::Gearbox | turnMotor | The turn gearbox | Gearbox |
CANCoder | canEncoder | The CANCoder | |
units::meter_t | wheelRadius | The radius of the wheel |
Example
SwerveModuleState
An enum of states for the swerve module.
Name | Value | Description |
---|---|---|
kZeroing | 0 | The module is zeroing |
kIdle | 1 | The module is idle |
kPID | 2 | The module is driving in PID mode |
Example
Methods
SetZero
Sets PID setpoints to zero.
Usage
SetIdle
Switches the state to idle.
Usage
SetPID
Switches the state to PID and sets the setpoints.
Usage
SetVoltageLimit
Sets the voltage limit.
Usage
SetAccelerationLimit
Sets the acceleration limit.
Usage
GetPosition
Gets the position of the module.
Usage
GetSpeed
Gets the speed of the module.
Usage
GetDistance
Gets the distance of the module.
Usage
GetConfig
Gets the config of the module.
Returns SwerveModuleConfig
(see above)