JaciBrunning / Pathfinder

Cross-Platform, Multi-Use Motion Profiling and Trajectory Generation
MIT License
255 stars 78 forks source link

Problem with traveling in the Y direction #26

Open Team-811 opened 6 years ago

Team-811 commented 6 years ago

Hello,

First off thanks for this great library, it is going to improve our autonomous for FRC a lot. So the robot accurately in the X direction but the Y direction has been consistently off by a half a meter. I believe that the issue lies in calculating the turn value (the one that sets the speed for the left and right motor). I basically just copied the example code for FRC Java. Could you possibly explain the math behind calculating that turn value? Also if you need to see our code here is the link to our GitHub repo.

Thanks

https://github.com/Team-811/811PracticeBot2018

JaciBrunning commented 6 years ago

Hey there, sorry I took a while to get around to this, it's been a busy week and some things have slipped from under me.

The turn value is mostly dependent on your gyro, robot, as well as your tuning values from the PIDVA configuration. Looking at your code, I would recommend dropping your kA gain and seeing how the tracking goes from there. There's a chief post I wrote here that may shed a bit more light on the tuning aspect.

Team-811 commented 6 years ago

Ok, Thanks

SPCOxion commented 6 years ago

Our team experienced a similar issue when testing out simple curved paths, and after a tiny bit of investigation and a bit of help from vannaka's UI, we found that the problem was being caused by Issue #14. We experimented with a couple of different possible solutions, but the one that seemed to work the best was to simply lower the max velocity used by the path generator (but not by the encoder followers). This results in a slower path, but one that the robot can more accurately follow. However, it'd still be nice to try and speed it up a bit, especially given the time-based nature of this year's game.

rodykon commented 6 years ago

@JacisNonsense First of all, Thanks for the great tool! I just created a thread on Chief Delphi relating to this issue and a few possible solutions. I would love getting some feedback.