Programmatically Speed Up Trajectories

My team has been using Pathweaver to design our trajectories…which has been great!

However, sometimes we find we want to push our acceleration or speed a little bit faster.

Has anyone found a way to do that programmatically once you have already generated a ‘Trajectory’ object. I’m guessing it would require some manipulation to each state, but I can’t imagine I am the first one to try and do this…


1 Like

Why would want to do this rather than just re-compute a new trajectory with different constraints? The trajectory generation for differential drives is mathematically quite simple and does not take much computation time.

1 Like

It would just be faster to do it the way I want to do it. Do you have any idea how?

Don’t import Pathweaver trajectories and instead copy the waypoints in and generate on the roboRIO. Then all you need to do is manipulate your constraints.

You either have to give up importing a Pathweaver JSON, or regenerate through Pathweaver.

In what way would it be faster? I doubt it would run noticeably faster, or be quicker to implement.

faster to modify haha

1 Like

ah okay. cool! ill do that instead! im assuming i can get a json file for the waypoints as well

1 Like

@Daltz3 Just to be sure I am not missing anything, is there some sort of solution to read in waypoints from pathweaver? I’m assuming I can generate a json file with that as well

        List<Pose2d> waypoints = this.trajectory.getStates().stream().map(state -> state.poseMeters).collect(Collectors.toList());
        TrajectoryConfig config = new TrajectoryConfig(MAX_SPEED, MAX_ACCEL);
        var trajectory = TrajectoryGenerator.generateTrajectory(waypoints, config);

should work just fine

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