JHS-Viking-Robotics / FRC-2022

Code for the 2022 FRC season, now written in Java
Other
2 stars 2 forks source link

Autonomous driving and trajectory following #38

Closed derickson2402 closed 2 years ago

derickson2402 commented 2 years ago

WPILib comes with several awesome tools to help easily create trajectories and trajectory following code. We would like to implement this into our robot.

This will require several steps:

These items should be well documented on the WPILib docs section on path following, but it may still take quite a while to implement.

derickson2402 commented 2 years ago

Update for 2022 season:

I've spent a lot of time trying to get this all to work, and I've been unsuccessful thus far. I managed to run the robot characterization on the 2021 robot, but the path following didn't work. The robot used Talon SRX controllers and CIM motors, which I found out after the fact do not work with this system.

For the 2022 robot, we switched to a Mecanum Drivetrain. Again, we found Pathweaver will not work correctly with this. I tried it anyways, by adding methods which essentially ran the Drivetrain as an H drive, but it still didn't work. I think it had something to do with a bug in the velocity/position getters since the conversion rate changed but the code didn't, but there were many other issues too.

Overall, we are scrapping Pathweaver for right now. There are some other FRC teams out there with custom solutions for path following, and we might try to use their code. For now though, we will be using basic code "blocks" for moving the robot in a straight line or rotating it, so we can still drive complicated paths but without any fancy curves.

derickson2402 commented 2 years ago

@Justice047 found this awesome video series, looks really useful

derickson2402 commented 2 years ago

Check out PathPlanner on GitHub. It integrates into WPILib trajectory following, but the interface is a lot more useful and it works for holonomic drivetrains.

Closing this issue for now, we will probably re-visit trajectory following after the 2022 season.