We’ve been playing around with pathfinder on our tank drive prototype, works great! We’ve recently implemented reverse paths for the tank followers, and knowing that Pathfinder paths shouldn’t go negative, we do the following (thanks to a lot who have been talking about this):
Reverse motor polarity on all drive motors
Reverse encoder polarity on motors
Swap left and right motor commands
Operate/read the gyro the same as forward paths
We’re now also looking at swerve drive, and with Pathfinder we’ll create four independent followers. My question is this: should we handle reverse paths the same way we do in tank drive, or is there a different suggestion? Seems simple to follow the same steps. Example: Should we swap front and rear followers in addition to left and right, to truly orient the modules the opposite direction?
What we did was we subtracted the encoder distance of the last point of the profile from every point in the profile, to reverse it. We also inverted all the velocities to make them negative. Finally, we swapped the trajectory points back to front. I don’t think you need to swap left and right, but it’s very easy to check.
This results in a set of points that starts at 0 and becomes increasingly negative, with the correct feedforwards applied for the velocities. This saves us the trouble of inverting motor output and sensor output. Inverting motor output alone will cause your position-holding PID loop in the motion profile to go out of control as you get more and more negative sensor positions.
If you plan on adding a gyro, I would highly recommend doing the path following on the RIO and manually passing target positions/angles/velocities to the Talon for each point. The way CTRE implements Motion Profile Arc makes it almost worthless compared to doing a non-gyro Motion Profile, and it takes a very long time to set it up correctly.