acmerobotics / road-runner-quickstart

FTC quickstart for https://github.com/acmerobotics/road-runner
BSD 3-Clause Clear License
168 stars 855 forks source link

NavX IMU: Localization is off. #349

Open SAK-20744 opened 5 months ago

SAK-20744 commented 5 months ago

getting correct values from the NavX, but the localization is jerky. Not sure if it is because of an incorrect parallel odo pod placement, or navX heading velocity. (Manually calculated, as the NavX does not give heading velocity normally.) In this clip, the robot is just spinning in a circle.

https://github.com/acmerobotics/road-runner-quickstart/assets/121530772/f5cbad89-0274-4ffb-ba1e-d65cc5d7a5b6

I believe it has something to do with the way I calculated external heading, but I am not 100% sure.

public Double getExternalHeadingVelocity() { double velInitial = Math.toRadians(-navx_device.getYaw()); double timeInitial = System.nanoTime(); double velFinal = Math.toRadians(-navx_device.getYaw()); double timeFinal = System.nanoTime(); double deltaV = velFinal - velInitial; double deltaT = timeFinal - timeInitial; double headingVel = deltaV/deltaT; return headingVel; }

rbrott commented 5 months ago

Heading velocity does not affect localization. Looks like your parallel odo pod positions are off.

SAK-20744 commented 5 months ago

thats a relief. Thanks.