PPRamseteCommand reversed not working

Looking for a little help here. I am trying to implement a simple PathPlanner plan on a differential drive (NEOs and navx). driving forward works as expected. Turning works as expected. I can’t drive it in reverse. I am looking to place the robot facing driverstation and reverse 2 meters.

Code is here

I thought selecting the “Reversed” checkbox in the generator settings would work, but that does not seem to have any impact. Robot always drives forward. Any suggestions would be appreciated.

I checked out the docs, and the “Reversed” button may be a little misleading. It says:

  • Reversed: If enabled, the robot will follow the path reversed, or driving backwards. This setting is unavailable in holonomic mode.

My first instinct was that you maybe weren’t resetting your gyro upon starting the trajectory, but it looks like you’re doing that correctly. And maybe that is what is causing the confusion. Since the gyro resets at the beginning of every auto, pointing the robot towards the driver station is a way to manually “reverse” the trajectory.

In a way, you are double reversing the path (so it ends up going forward again). You pointed the robot 180 degrees offset from normal, and checked the reversed box.

There’s 4 combinations which all give different results (since the robot can be in two starting orientations):

  • Robot pointed away from DS, “Reversed” box unchecked: Robot will move away from DS
  • Robot pointed away from DS, “Reversed” box checked: Robot will move towards DS
  • Robot pointed towards DS, “Reversed” box unchecked: Robot will move towards DS
  • Robot pointed towards DS, “Reversed” box checked: Robot will move away from DS

Checked or unchecked the robot alway moves in the direction it is pointed.

If that’s the case, then I don’t have many ideas. Maybe it is something weird about the gyro. I’m assuming you’ve tried power-cycling the bot once it’s reversed to see if it flips the outcome?

Next thing I would check, just to make sure there’s no funny business is happening with the odometry, is that your encoders increase and decrease as you would expect, and that the pose over time relatively follows the path.

Odometry looks generally correct, on both glass and via the PathPlannerServer, it just always treat my heading as forward per the front of the robot.

I also tried to switch the heading of both the starting point and end point to 180, regardless if I select “Reversed” or not, it turns the robot around and runs the path forward.

What am I doing wrong?

        PathPlannerTrajectory examplePath = PathPlanner.loadPath("ReversePath", new PathConstraints(3, 2));

It appears that reversed is an optional third argument to PathPlanner.loadPath. Have you tried setting that?

Thanks @bovlb ! That is exactly what I was missing.

1 Like