Offset between pathweaver trajectories and drivetrain simulation

So I have a simple trajectory in pathweaver:

but when I import it on the trajectory in the drivetrain simulation, there is a slight offset:

the robot still runs the trajectory and it follows it pretty accurately but I’m not sure this offset is normal behavior.

does anyone know why this might be?

code:https://github.com/FRC-2815/2815_Rapid_React

Thanks Everyone!!!

The field image in the simulation isn’t scaled properly. You’ll note the robot pose at 0,0 is not at the corner of the field. You can import the PathWeaver game config into the simulation to make them match.

2 Likes

is that done in the sim gui or in code?

In the spot where you select what you want to use as the image (in gui) you should select the .json file with the scaling constants instead of the .png

here are the wpilib docs on it: Adding field images to PathWeaver — FIRST Robotics Competition documentation

here’s link to image + json (download both): PathWeaver/src/main/resources/edu/wpi/first/pathweaver at main · wpilibsuite/PathWeaver · GitHub

Hope that helps!

1 Like