Ramsete issues

I am trying to learn how to use and modify the ramsete example code to create custom trajectories.

I seem to be able to run the code without issue if my start end end rotation is zero or very small 45 degrees or less. It seems that if I try to make larger turns when I try to run the code I get an error that kills my robot code.

The following is the error that appears in the log.

It acts like the error is with motor safety, but it doesn’t show up when I have paths that start and end with 0 rotation.

This works fine.
Rotation2d startRot = new Rotation2d(0);

        Rotation2d endRot = Rotation2d.fromDegrees(0);//positive turns left

        // An example trajectory to follow. All units in meters.

        final Trajectory exampleTrajectory = TrajectoryGenerator.generateTrajectory(

                // Start at the origin facing the +X direction

                new Pose2d(0, 0, startRot),

                // Pass through these two interior waypoints, making an 's' curve path

                List.of(new Translation2d(0.1, 0.0)

              
                ),

                // End 3 meters straight ahead of where we started, facing forward

                new Pose2d(0.5, 0, endRot),

                // Pass config

                config);

But if I change the trajectory to this it will crash.

        Rotation2d startRot = new Rotation2d(0);

        Rotation2d endRot = Rotation2d.fromDegrees(90);//positive turns left

Any help would be appreciated.

Also if anyone has examples of how to implement this and place the command where it is not in the robotContainer like the example I would like to see how that works.

Thanks,

What version of wpilib are you running? There was a bug causing this that was fixed in the most recent update.

1 Like

Is it possible that you are actually getting a Malformed Spline Exception that is later causing the motor watchdog to not be fed? I see that you only have 0.5 units between the start waypoint and end waypoint (though you say that is 3 meters?) and it is possible that the trajectory generator is very unhappy drawing such a short spline that also has to turn sharply.

This seems to have cured the major issues I was having. Now I am curious how people are determining the points for the splines? Is there an a good program? Do people just pull up the game field in cad and measure various points? Is it all just test and see what happens?

Also, if anyone has an example they would like to share where they have the ramsete commands and paths located in a different class than RobotContainer I would like to see a good example. It is probably intuitive to someone that is a little better versed in programming, but I cannot seem to get it to work correctly and once I start getting a few paths my RobotContainer becomes very bloated.

PathWeaver

1 Like

Thank you. I thought PathWeaver was a completely separate pathing library. I will take a deeper look.

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