WPIlib does not have a built-in swerve drive object. We should take what we've done and repackage it into a generalized object and donate it to WPIlib.
Met with Matt & Brayden at Tatnuck on July 15. Meeting summary below.
Basic stuff used in our implementation:
- 4 speed controller drive (any)
- 4 speed controller rotation (any)
- 4 rotation sensors (AndyMark/PG71, required)
- 4 PIDs for steering (HW/talon or sw)
- 4 absolute encoders (optional, allow T of rotation sensor to absolute encoder)
- 1 gyro (multiples)
Definitions and enums
- width & length = center to center distance.
- angles = in degrees
- enum LF, RF, RL, RR
Phase 1 - create a swerve drive module tailored for the AndyMark product. Convert our code to use it and prove it works.
- constructor (8 speed controllers, 4 encoder, width, length)
- constructor (4 speed controllers, 4 talons for rotation, width, length)
- swervedrive (3 joystick inputs - fw/bk, l/r, rot)
- swervedrive (3 joystick inputs, gyro)
- getmode(); setmode(fieldcentric | robotcentric)
- resetwheelangle (4 current angles)
- setrotationpid (4 PID values, tolerance)
- setinvertedmotor (speed controller enum, boolean)
- setsafety ( )
Phase 2 - Generalized swerve moduleIn addition to above:
setgearratio ( )
setpulseperrotation ( )
Error reportingif (mode=fieldcentric && using wrong swervedrive command)
default gyro=0, report error