Robot turning and then following path backwards

While running path following, we have been running into an issue where the robot has been turning in a direction and then following the path while driving backwards. A video of this issue can be seen here:

So far, we have tried:

  • Ensuring robot odometry is reset in AutonomousInit
  • Attempting paths of different shapes and directions, all of them lead to this behavior
  • Re-characterizing the robot’s drivetrain

None of these have made any difference.

Any help with this would be appreciated!

Relevant files:


RamseteCommand setup:

Drivetrain Subsystem:

Attempted Path:

This seems like a sensor/drivetrain inversion issue. It seems like the code thinks what you are calling the back of your robot is the front.

Going through these troubleshooting steps is the comprehensive way to solve these issues.

If you face you robot “backwards” what does it do?

  • Are the start and end headings of your trajectory wrong?
    • Potentially? I was under the impression that the robot set its initial heading to the first heading defined by the trajectory and our test path should have an initial heading of zero, but it could definitely be an issue if it’s not.
  • Is your robot’s gyro getting reset to the wrong heading?
    • I’ve checked, it resets to zero unless we’re putting the wrong value on SmartDashboard or somehow sending the compass-based heading to our path following.
  • Do you have the reverse flag set incorrectly?
    • Fairly certain it’s not, unless this is separate from the PathWeaver reverse flag.
  • Are your gyro angles clockwise positive? If so, you should negate them.
    • Potentially. We will check this tonight.
    • Edit: I can confirm gyro angles are going the right way.

Thank you for passing on those troubleshooting steps. Despite the issues we’ve been having, we’re grateful to the WPILib team’s work over the past few years to introduce more advanced controls into FRC over the past few years.

Edit: We got it working, at least at the beginning. We had to flip the left side of the drivetrain in the DriveByVolts function. Still having a strange turning thing happen at the end of the path, but this might be an issue with the path.

Edit 2: it was an issue with the path

1 Like

Awesome to hear! Getting all the sensor/motor directions and units correct can really be a pain but it feels really good IMO when it just all works!


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.