Team2168 / 2020_SwerveBot

Repo for development of field oriented swerve chassis tests
1 stars 0 forks source link

2020_SwerveBot

Repo for development of code for a field oriented swerve chassis. This repo name is a bit of a misnomer - it's our 2020 Robot code + the code for a swerve chassis.

image

Our swerve code was largely lifted from 2767, don't consider it a reference implementation. We are still learning :)

Steps for zeroing cancoders

Currently loading cancoder offset zeros from a hard coded array inside Drivetrain.java
TODO: clean this up so it's more reliable/robust

  1. Physically orient the swerve modules to their zero positions (bevel to battery)
  2. In Phoenix Tuner, set the zero offset for the cancoder to 0 and save
  3. Query the Absolute Position (in degrees) by performing a self test on the cancoder
  4. Copy the Absolute Position angle (not negated) into the ABSOLUTE_ENCODER_OFFSET array in Drivetrain.java
  5. Deploy the code to the robot. Note: This will set the zero offset on the cancoder, but will not yet cause the corrected zero position to be reflected in the position reported to the TalonFX.
  6. Restart the robot.
  7. Enable the robot code and verify the module zero position is correct.

Subsystems

These are mostly the same as the 2020 robot, see the 2020 repo for a breakdown of subsystem capabilities until we get better documentation added here.

Unit Tests

Unit tests are located below the /src/test directory. They are used to perform automated verifications of our codes functionality.