wpilibsuite / allwpilib

Official Repository of WPILibJ and WPILibC
https://wpilib.org/
Other
1.05k stars 611 forks source link

Swerve Drive Pose Estimator example does not use pose heading for field-relative. #4513

Closed shueja closed 10 months ago

shueja commented 1 year ago

https://github.com/wpilibsuite/allwpilib/blob/023a5989f8bafec69c3650aca868c8b0cc4a6f3b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervedriveposeestimator/Drivetrain.java#L65

MrRedness commented 1 year ago

Is it supposed to use the pose heading? I think it makes more sense relying on the gyro

calcmogul commented 1 year ago

It should use the pose estimate's heading because that includes corrections from computer vision (not that it matters right now because bias in the gyro measurement will pull the heading estimate off-course again).

MrRedness commented 1 year ago

In my experience, gyro has always been more accurate than odometry or vision, at least on a navx2.

-------- Original Message -------- On Nov 9, 2022, 6:49 PM, Tyler Veness wrote:

It should use the pose estimate's heading because that includes corrections from computer vision (not that it matters right now because bias in the gyro measurement will pull it off-course again).

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

calcmogul commented 1 year ago

Depends on how well your vision pipeline is tuned. Retroreflective tape sucks at pose estimation without a lot of work and a high resolution camera.

If your gyroscope really is more accurate, you should be setting the measurement standard deviation low enough relative to your vision that it's the one primarily driving the heading estimate. In that case, you'd still use the pose estimate over the raw measurements.

ElliotScher commented 10 months ago

Should this be changed in both c++ and java examples?