Skip to content
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

Merged
merged 4 commits into from
Feb 22, 2019

Conversation

okalachev
Copy link
Contributor

@okalachev okalachev commented Feb 22, 2019

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.

msg/distance_sensor.msg Outdated Show resolved Hide resolved
@okalachev okalachev force-pushed the distance-sensor-fix-cov branch from e567970 to 2112265 Compare February 22, 2019 15:59
@okalachev okalachev force-pushed the distance-sensor-fix-cov branch from 2112265 to 697785e Compare February 22, 2019 16:12
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1e-4f

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah nevermind. Sorry

@hamishwillee
Copy link
Contributor

m^2 (says m in comments, but this must be a mistake)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants