Robot not following max speed parameters set in pathplanner auto code

I am the programming lead from 7763, and this season I for auto, I tried using pathplanner however I encountered a strange issue. The robot seems to try to follow the auto path, however it does it at maximum speed and acceleration, and doesn’t seem to end. I have attached the link to the GitHub page and it is under the Comp Robot Testing folder. GitHub - mjp0n3/7763-Carrborobotics-22-23-Code: Code for 2022-2023 Season I can’t tell where the issue is as it runs, but my best guess would be that in drivetrainsubsystem.java, somehow the setting of max velocity and max acceleration is not done correctly as it is not being followed. As for the infinite run time, I have no clue. I know I am not giving a lot of information since I really don’t know why it would do this, but I would be happy to answer any questions anyone has as well troubleshoot. Thanks!

Could also be your follower just isn’t obeying the constraints, PID overshoots and such.

You might need to clarify what you mean by “max speed and acceleration”, but my team was having a similar issue where the values being set in pathplanner weren’t being used. It was indeed very confusing, but after searching around in pathplannerlib I found that there is a specific function you need to use in order to access the values set in the gui. We ended up with this code for loading the trajectories with constraints from the gui, or optional default values in case the gui values were not set:

public static final PathConstraints DEFAULT_FOLLOW_CONSTRAINTS =
		new PathConstraints(Constants.TRAJECTORY_MAX_VEL, Constants.TRAJECTORY_MAX_ACC);

public static PathPlannerTrajectory loadFileConstrainedTrajectory(String ppfile, PathConstraints dfault) {
	PathConstraints p = PathPlanner.getConstraintsFromPath(ppfile);
	return PathPlanner.loadPath(ppfile, (p == null ? dfault : p));
}
public static PathPlannerTrajectory loadFileConstrainedTrajectory(String ppfile) {
	return loadFileConstrainedTrajectory(ppfile, DEFAULT_FOLLOW_CONSTRAINTS);
}

It seems that pathplanner treats the values set in gui as optional, and this is why you have to manually fetch and use them.

Another thing to note is that trajectory following is ended based on a timer, so when you say “doesn’t seem to end”, I’m assuming you haven’t let the trajectories run for the full time (possibly because you didn’t want the robot to run into a wall)? You might need to run them somewhere with a lot of space so you can see if they ever actually stop, or just make a really short trajectory. This could be related to the max speed being wrong, or could be a completely different issue - but either way try out the other suggestions and see what happens.

Edit: Another thing my team ran into was resetting the initial pose when pathplanner was transforming the trajectory based on alliance color. Maybe try disabling this feature or ensuring that the blue alliance is set (or whatever the default is) in DriverStation when you test.

Yeah, I am going to try to get new PID values because they dont seem right. Many are rediculously high.

The robot just puts the pedal to the metal if you know what I mean. I will look into this code as well as check on the pose and alliance side code.

I know for our robot it also seemed to be going pedal to the metal, but was actually just following the maximum velocity and maximum acceleration that we had meant for it to ever go at all. Just wanted to point that out in case you can measure what yours is actually going and possibly find a similar correlation.

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