My team is currently working on building and coding our first swerve drivetrain. We found that the PathPlanner tool is great for the autonomous path building.
We have a problem with the start point of our paths. When we set a simple path with a starting direction that is different from the starting heading, the first pose in the generated json file has the heading value in its direction key.
see the following example:
the rotation in the resulting json (rotation of the first point):
This problem happens only on the first point.
The start rotation is 45° and the end rotation is 0° (I want them both to be 0°) this is causing the robot to rotate during the movement (even if you don’t want it to).
Because of the false initialized rotation the whole path is rotated by the same angle.
here is the result IRL (excuse me for the video quality and the drawing skills):
did anyone saw this problem before? did you find a way to fix it?
We had this problem. Do you have your code to show how you reset your odometry. Also I found using pathplanners library’s instead of the JSON files work well for us.
this is the code, we already use the “.path” files (simple.path in the shown example), I use the JSON to see the specific values of the trajectory.
I remember that the heading and Rotation in PathPlanner is puzzled. And the only thing you should bare in mind is the the rotation actually controls your swerve’s heading and the Heading only accounts for the shape of your trajectory. If you reset your odometry’s rotation to your trajectory’s Heading, the path does go like this. So, when you reset your odometry, you should take your trajectory’s holonomicRotation as the rotation of your Pose.