Our Features
Documentation
Easy installation
Just download all of the vendordeps from WPILib online from this list: Vendor URLs following the process at:
Hardware Support
Motors
Brushed Motors Controlled by SparkMAX with an attached encoder. Angle motors do not require quadrature encoders and should use duty cycle encoders attached to the dataport of the spark max.
Absolute Encoders
Throughbore (via PWM)
Thrifty Absolute Magnetic Encoder (via AnalogInput)
Any PWM Absolute Encoder!
Any Anolog Absolute Encoder
IMUs (Gyroscopes)
ALL GYROSCOPES MUST BE COUNTER-CLOCKWISE POSITIVE!
Any analog gyroscope
Simulation
There is full simulation support out of the box in
YAGSl-Example.
Control
PathPlanner is supported and there is a example in
YAGSL-ExampleControl can be based entirely off of desired angle compared to current angle (
SwerveController.getTargetSpeeds) or passed directly to theSwerveDrivein the correct units.The function
SwerveDrive.lockPosemoves all of the wheels to face inwards making the robot nearly impossible to move.Drive motors can be set to coast or brake using the function
SwerveDrive.setMotorIdleModeSwerve Module drive motor feedforwards can be replaced using the function
SwerveDrive.replaceSwerveModuleFeedforwardSlew rate limiters can be added to
SwerveController.getTargetSpeedswithSwerveController.addSlewRateLimitersto improve control of the robot.Momentum calculator using objects in space represented by
Matterclass to limit velocity of the robot and prevent tipping.CAN frames are limited to updated angles and velocities which differ from the previous angle and velocity.
Ability to overwrite maximum speeds via
SwerveDrive.setMaximumSpeedandSwerveController.setMaximumAngularVelocityor utility functionsSwerveDrive.setMaximumSpeeds.Ability to use Chassis Velocity Correction using
SwerveDrive.chassisVelocityCorrectiononly affecting theSwerveDrive.drivefunctions.Ability to control using different center of rotation with
SwerveDrive.drive.Push the offsets to the motor controllers via
SwerveDrive.pushOffsetsToControllersControl over
ChassisSpeeds.discretizeviaSwerveDrive.setChassisSpeedsDisctretizationCosine compensation via
SwerveDrive.setCosineCompensatorHeading correction with
SwerveDrive.setHeadingCorrectionAuto-centering modules allows for modules to center to 0 whenever no input is given. This can be controlled by
SwerveDrive.setAutoCenteringModules
Safety Features
The absolute encoder readings fall back to the relative encoder readings if the absolute encoder encountered a resolvable reading error.
Angle motors are default in coast mode to help take care of the motors.
Motor angle's are optimized to turn to the closest equivalent angle.
You can limit your velocity given your robot weight and center of gravity in
SwerveMath.limitVelocity.Current limits in the JSON configuration.
Ramp rate limits in the JSON configuration.
Closed-loop PID on motor controllers exclusively for SparkMAX's and TalonFX's.
The absolute encoders and relative encoders are synchronized when the robot is not moving for 100ms.
PID inputs are continuous or emulated to be continuous from -180 to 180.
Odometry
SwerveDrive.updateOdometryis called every 20ms, the period can be changed viaSwerveDrive.setOdometryPeriod.To stop the odometry thread use
SwerveDrive.stopOdometryThreadand update odometry in a periodic.To zero the gyroscope call
SwerveDrive.zeroGyroRobot centric velocity can be fetched via
SwerveDrive.getRobotVelocityand field-centric isSwerveDrive.getFieldVelocity.Robot pose can be fetched via
SwerveDrive.getPoseRobot gyroscope readings can be fetched via
SwerveDrive.getGyroRotation3dorSwerveDrive.getYaw,SwerveDrive.getPitch,SwerveDrive.getRoll.Robot pose can be updated with vision inputs through
SwerveDrive.addVisionMeasurementoptional standard deviation pass through.Gyroscope offset can be configured via
SwerveDrive.setGyroOffsetand should be used for pathplanner.If your translational odometry is off but controls are correct you can invert you translational odometry with the attribute
SwerveDrive.invertOdometry
Telemetry
Swerve telemetry is updated to work with frc-web-components app.
Every module angle is reported for both relative and absolute encoders.
Every module velocity is reported.
The desired chassis speed is reported.
There is a Field2d which is created and updated continuously to represent the robots current position and orientation on the field.
You can add trajectories to the field with
SwerveDrive.postTrajectorywhen testing.
Last updated
Was this helpful?
