We were following this guide for trajectory tracking. Initially we ran into some problems with a very jittery robot. It was trying to correct its heading too aggressively. It wasn’t the same jittery motion as some other teams posted as we were looking for help. I assume their problem might be not feeding the motor safety so it would just shut down the motors periodically. We sort of fixed the problem by playing around with the ramseteB value and the zeta value. We lowered B to 0.1 and increased zeta to 0.8. And it would run a meter straight fairly accurately. Once we were happy with the result we wanted to try a complex path. we tried to run a U-turn.
List.of(
new Pose2d(),
new Pose2d(2, 0, new Rotation2d()),
new Pose2d(2, -1, new Rotation2d(-90)),
new Pose2d(0, -1, new Rotation2d(-180)));
Some iteration of the code above ran, but when it came to the turning it would slow down and simply stop running. We tried to do it differently and then we started getting the MalformedSplineException. We gave up on the U-turn test and tried to do the s-curve motion from that tutorial.
Trajectory exampleTrajectory = TrajectoryGenerator.generateTrajectory(
// Start at the origin facing the +X direction
new Pose2d(0, 0, new Rotation2d(0)),
// Pass through these two interior waypoints, making an 's' curve path
List.of(
new Translation2d(1, 1),
new Translation2d(2, -1)
),
// End 3 meters straight ahead of where we started, facing forward
new Pose2d(3, 0, new Rotation2d(0)),
// Pass config
config
);
And we got the same error. I think its because we tried to simplify that getAutonomousCommand() method so we can pass in a trajectory in the method call, but I don’t know. you can view our code here.