icrobotics-team5584 / FRC-2022-Sumsy

Code for 5584's off-season robot project, a swerve bot for the Deep Space game
Other
1 stars 0 forks source link

Tune drive speed PIDF so we actually go at the speed we expect #17

Closed Liam-Stow closed 2 years ago

Liam-Stow commented 2 years ago

When we setup the swerve drive we kinda just plucked some PID and FeedForward constants out of nowhere and it worked alright.

However actually driving the robot is pretty hard, and one thing that might help is properly tuning the drive PIDF constants in SwerveModule.h here https://github.com/icrobotics-team5584/FRC-2022-Sumsy/blob/main/src/main/include/utilities/SwerveModule.h

This can be done by making a couple of commands that attempt to move the drivebase at constant speeds and then playing with the PIDF constants until it the robot moves at the correct speeds. OR A more in-depth option is to use the sysid tool to characterise the drivebase mechanism following these instructions: https://docs.wpilib.org/en/stable/docs/software/pathplanning/trajectory-tutorial/characterizing-drive.html Note that when using sysid we will need to lock the rotation of the swerve modules mechanically somehow since sysid is built for differential (tank) drives. OR Steal the Drop bears values. PID: https://github.com/thedropbears/pyrapidreact/blob/48508348c01b5768ff6670f78fa7ca0096ea846b/components/chassis.py#L87 FF: https://github.com/thedropbears/pyrapidreact/blob/48508348c01b5768ff6670f78fa7ca0096ea846b/components/chassis.py#L81 and https://github.com/thedropbears/pyrapidreact/blob/48508348c01b5768ff6670f78fa7ca0096ea846b/components/chassis.py#L125

Liam-Stow commented 2 years ago

Option chosen: Run in-depth characterisation with sysid. (done) Still todo: Test to make sure we are driving at the speed we expect