JaciBrunning / Pathfinder

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

Add sample using EncoderFollower for FRC #23

Closed SUPERCILEX closed 6 years ago

SUPERCILEX commented 6 years ago

Our team is having trouble getting the pathfinding library to work with encoders. We've copied your sample and changed dimensions like wheel size, but the robot only follows the first curve of the path graphed in the README. Would be nice to see a sample using the encoder follower class to make sure we are doing it correctly. Thanks!

PS: the calculate(int) method is returning greater than +-1 values, is that normal?

SUPERCILEX commented 6 years ago

@JacisNonsense So after a day of tinkering around, we've finally managed to get tank drive to generally follow the right path, but at the end of every run regardless of project trajectory, the EncoderFollower method generates a sharp turn that doesn't make sense. Here's a sample graph of the projected trajectory and a video of it taking that wild curve at the end. I know this was taken from the Cheesy Poofs, but still, do you know what's going on?

Otherwise, I think I'll just add an extra meter at the end of the path and then manually chop off the last dozen values to get it working. Not sure if that'll mess up PID though...

JaciBrunning commented 6 years ago

You'll usually find this kind of thing when you incorrectly set the angle of your final waypoint. There isn't much I can say without a code example

SUPERCILEX commented 6 years ago

@JacisNonsense yeah, sorry. Our code is in a pretty embarrassing state right now, so please just close your eyes wherever possible. 😂

SUPERCILEX commented 6 years ago

Nevermind, it started working this morning... maybe low battery? Either way, thanks for the lib!