Swerve and path planner issues

Hello, I have been working on my team’s swerve drive and came across a bit of an issue. Whenever I run a path, the steering is always off. Not completely off, but partially. Any help would be appreciated. Repo GitHub - Vortex148/SwerveDrive
I will try and upload video later. I am using path planner.

Video: 20240117_195016.mp4 - Google Drive

Can you share what this path was supposed to look like?

1 Like

Pure speculation, but your rotation targets for that path look pretty tight together. It looks to me like the bot is hitting the first rotation target (90 degrees), skipping the second (180 degrees), and going straight to the desired end state (0 degrees). If it’s asking the robot to exceed the rotational velocity limits specified, that could be why it’s skipping that target. Can’t say that for sure though, I’m not well versed on how pathplanner goes about handling that situation.

2 Likes

Here is path 20240117_194951.mp4 - Google Drive

To me it looks like the initial turn (trying to reach 90 degrees) is reaching 45 degrees. Then in the second point when its trying to reach 180, quickly hits 90 degrees and then goes back to 0 degrees. Could this be a /2 error? A degrees to rad error?

Some quick math shows that if you set your goal to 90 rad (instead of 90 degrees) then 180 rad you will get angles of 116 degrees and 232 degrees? All speculation, just two things to check.

1 Like

Thanks for help, but how can I fix this in code, if I can ?

Figured it out. Max velocity was set to 1m/s which prevented it from turning as it would reach max just trying to move