Robot Going Pi Meters forward instead of 1 with Path Planner

GitHub - Ocean-Moist/2022-Robot

We are using path planner this year for our autonomous commands, and we have a command set to go 1 meter forward. We are having a weird issue where it is going Pi meters forward, meaning somewhere it is being multiplied by Pi. This same issue occurs when we use a trajectory without PathPlanner using WPILib’s option.

Any help would be appreciated!

Notable Constants:
ksVolts = 0.49117;
kvVoltSecondsPerMeter = 3.4251;
kaVoltSecondsSquaredPerMeter = 0.091565;
kPDriveVel = 1.9736;
Units per Rotation = 0.4801 meters

1 Like

Does the odometry say it’s went 1m or pi meters?

It says it went Pi meters.

Somewhere in your code you must convert from encoder counts to distance traveled in meters.
You can do that two ways: Simply drive 10 m straight ahead, note the change in encoder counts, and compute counts/m. Or you get the counts per motor axis revolution, the gearing ratio, the circumference of your wheels and compute the counts/m from that. The latter seems more “correct”, but if you mix up wheel diameter and circumference, your result will be off by pi. Also note that the exact circumference will change based on inflation or rubber wear, so simply driving 10 m and noting the counts is usually better.

1 Like

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