Team5830 / 2023-Charged-Up

MIT License
0 stars 0 forks source link

Drivetrain kinematics #11

Closed asteele11 closed 1 year ago

asteele11 commented 1 year ago

In order to plan more complex routes for the robot we need to add more to the drivetrain subsystem to convert the path to left and right wheel speeds. That is described here: https://docs.wpilib.org/en/2022/docs/software/kinematics-and-odometry/differential-drive-kinematics.html

There is a more complete tutorial that includes some of the same kinematics, the first step is to use the sysid tool to figure out the control parameters for the robot, We can have some of the other team members do that, so we just need the code added to the drive train to use the parameters. That is described here: https://docs.wpilib.org/en/2022/docs/software/pathplanning/trajectory-tutorial/entering-constants.html And here: https://docs.wpilib.org/en/2022/docs/software/pathplanning/trajectory-tutorial/creating-drive-subsystem.html

The above link has example code, but uses different motor controllers, encoders and an analog gyro. Our drivetrain already has most of those, but looks like we need methods to tank drive based on voltages, to return a turn rate from the gyro.

asteele11 commented 1 year ago

The complete example code is available here: https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ramsetecommand