Can't get Pathweaver Working

I have watched countless videos and have gotten the robot to only shift. All it will do is shift forward an inch and move back to the starting position. I have researched this problem and have realized that it could only be going through the first waypoint that my path weaver outputs to WPILIB. If anyone can help I would greatly appreciate it. sorry if the code is somewhat crude, this is only my second year coding in Java.

Here is my code:

It looks like your PathweaverTest path has 0s for the x and y tangents. I’ve had issues in the past with loading in paths without any tangent. If that’s the one you’re trying to use, I’d recommend trying it after adding tangents to the waypoints.

The paths are supposed to be in the deploy directory correct? Because if not then that is one problem with my code.

The trajectory JSONs (testpath.wpilib.json) should be in the deploy directory, which they seem to be.

I think your issue might be coming not from the path itself but from the way the Ramsete command is set up. Your execute method is constructing a new command every 20ms, not executing it.

To fix that you could extend the RamseteCommand class and override the constructor to create the trajectory. You could also construct the Ramsete command at the beginning in initialize() or the auto command’s constructor, and call ramseteCommand.execute() in your command’s execute method

One other thing I am noticing in your autonomous test command is that you’re never zeroing your robot’s odometry to the start of the path (drive.resetOdometry(path.getInitialPose())) or anywhere else on the field.

Where would be the ideal location for this in that command?

That should go in the initialize function

1 Like

Looks to me like in your auto command you creat a new object called command that is tour ramsette command but never call it to excutute that new ramsette command anywhere.

You are creating a command in command. We put our auto routines in sequential and parallel command groups. Create the ramsette command and then add it to the command group. I will post GitHub to our code here shortly

here is our simple follow path and intake for our ramsette command. You can look in at our 4 and five ball autos to see how we are doing it there