Swerve Drive - FrcTeam4919/Robot2021 GitHub Wiki
The 2021 swerve drive is based on this write up. https://jacobmisirian.gitbooks.io/frc-swerve-drive-programming/content/
The swerve drive module - https://www.andymark.com/products/swerve-and-steer?Assembled%20or%20Kit=Kit&quantity=1&Drive%20Motor=CIM&Rotation%20Encoder=PG%20Encoder&Steer%20Motor=PG
This is the swerve drive module team 4019 purchased with the default configuration.
- CIM drive motor
- PG Encoder
- PG Steer motor
Another write up on Pivot Drive (another name for swerve drive) from Andymark. https://team1640.com/wiki/index.php/DEWBOT_VII_Drive_Train
Here is an example swerve drive simulation from 2021 in Java!
Encoders
The Andymark swerve module has 3 options for encoders.
1. PG incremental encoder is installed on backside of the PG motor. This encoder can be used to determine the steering angle provided that all the modules start facing forward.
- Must keep track of rotations based on starting position
- 7 pulses per revolution of the drive shaft.
- https://www.andymark.com/products/hall-effect-two-channel-encoder
2. MA3 absolute encoder. The user has the option of 5 mounting locations for this encoder. The absolute encoder outputs the absolute position of the drive shaft. This is recommended in many swerve drive examples
- reports the shaft position over 360 with no stops or gaps
- Analog encoder where a half turn (180*) = 2.5V
- https://www.andymark.com/products/ma3-absolute-encoder-with-cable
3. "Lamprey" large bore absolute encoder. Can directly measure your output without being at the shaft end.
- Default output is degrees
- Requires advanced calibration for more precise degree measurements
- https://www.andymark.com/products/lamprey-absolute-encoder
- More info is available on Team 221 site http://www.team221.com/viewproduct.php?id=155
Next Steps
Never assume that you know what the output is. The robot code should display outputs on the smart dashboard continuously updating for the needed sensors. For swerve drive this includes
- gyro - needs to accurately show degrees from 0 - 360 when the robot is rotated.
- Steering encoders - display 4 encoder outputs for the 4 wheels between -180 to +180 when a wheel is rotated 180 degrees in either direction.
If these outputs are not displayed accurately then sensor calibration or other troubleshooting is required before implementing the swerve drive logic.