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.
Our swerve code was largely lifted from 2767, don't consider it a reference implementation. We are still learning :)
Currently loading cancoder offset zeros from a hard coded array inside Drivetrain.java
TODO: clean this up so it's more reliable/robust
- Physically orient the swerve modules to their zero positions (bevel to battery)
- In Phoenix Tuner, set the zero offset for the cancoder to 0 and save
- Query the Absolute Position (in degrees) by performing a self test on the cancoder
- Copy the Absolute Position angle (not negated) into the
ABSOLUTE_ENCODER_OFFSET
array inDrivetrain.java
- 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.
- Restart the robot.
- Enable the robot code and verify the module zero position is correct.
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 are located below the /src/test
directory. They are used to
perform automated verifications of our codes functionality.
-
To run all tests from the command line from within the project folder:
$ ./gradlew test
Gradle should download all required packages to support running the tests and display PASS/FAIL results for each test case in the terminal.
-
You can also run tests in a more interactive manner from within vscode using the "Java Test Runner" extension.
- Install/enable the Java Test Runner Extension (vscjava.vscode-java-test)
- Click the "Test" flasky looking icon in the left hand pallet