-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mavlink_receiver: fix DISTANCE_SENSOR covariance handling #11520
Conversation
e567970
to
2112265
Compare
2112265
to
697785e
Compare
@@ -4195,7 +4195,7 @@ class MavlinkStreamDistanceSensor : public MavlinkStream | |||
msg.min_distance = dist_sensor.min_distance * 100.0f; /* m to cm */ | |||
msg.max_distance = dist_sensor.max_distance * 100.0f; /* m to cm */ | |||
msg.current_distance = dist_sensor.current_distance * 100.0f; /* m to cm */ | |||
msg.covariance = dist_sensor.covariance; | |||
msg.covariance = dist_sensor.variance * 1e4f; // m^2 to cm^2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1e-4f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To covert from uORB distance_sensor
's meters^2 to MAVLInk's cm^2, we should multiply by 1e4f
, don't we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah nevermind. Sorry
Just FYI, this field documentation was recently changed from cm to cm^2, and even though the field name is covariance, it is the variance. |
MAVLink reference says that
DISTANCE_SENSOR.covariance
field is in cm^2.Currently, this value is getting passed directly to
distance_sensor
uORB message, which has this field in m^2 (says m in comments, but this must be a mistake) without convertation.Fixed these issues.