From c39fef6c562822121ceb855aaf34e5b433463144 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Fri, 10 Apr 2020 13:38:59 +0900 Subject: [PATCH] GCS_MAVLink: pass vision-position-estimate reset_counter to AP_VisualOdom handler --- libraries/GCS_MAVLink/GCS.h | 1 + libraries/GCS_MAVLink/GCS_Common.cpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index 205517e2b8..3611c9a15b 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -740,6 +740,7 @@ private: const float roll, const float pitch, const float yaw, + const uint8_t reset_counter, const uint16_t payload_size); void lock_channel(const mavlink_channel_t chan, bool lock); diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index 0f6e0c4daa..795ab4ab31 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -2943,7 +2943,7 @@ void GCS_MAVLINK::handle_vision_position_estimate(const mavlink_message_t &msg) mavlink_vision_position_estimate_t m; mavlink_msg_vision_position_estimate_decode(&msg, &m); - handle_common_vision_position_estimate_data(m.usec, m.x, m.y, m.z, m.roll, m.pitch, m.yaw, + handle_common_vision_position_estimate_data(m.usec, m.x, m.y, m.z, m.roll, m.pitch, m.yaw, m.reset_counter, PAYLOAD_SIZE(chan, VISION_POSITION_ESTIMATE)); } @@ -2952,7 +2952,7 @@ void GCS_MAVLINK::handle_global_vision_position_estimate(const mavlink_message_t mavlink_global_vision_position_estimate_t m; mavlink_msg_global_vision_position_estimate_decode(&msg, &m); - handle_common_vision_position_estimate_data(m.usec, m.x, m.y, m.z, m.roll, m.pitch, m.yaw, + handle_common_vision_position_estimate_data(m.usec, m.x, m.y, m.z, m.roll, m.pitch, m.yaw, m.reset_counter, PAYLOAD_SIZE(chan, GLOBAL_VISION_POSITION_ESTIMATE)); } @@ -2961,7 +2961,8 @@ void GCS_MAVLINK::handle_vicon_position_estimate(const mavlink_message_t &msg) mavlink_vicon_position_estimate_t m; mavlink_msg_vicon_position_estimate_decode(&msg, &m); - handle_common_vision_position_estimate_data(m.usec, m.x, m.y, m.z, m.roll, m.pitch, m.yaw, + // vicon position estimate does not include reset counter + handle_common_vision_position_estimate_data(m.usec, m.x, m.y, m.z, m.roll, m.pitch, m.yaw, 0, PAYLOAD_SIZE(chan, VICON_POSITION_ESTIMATE)); } @@ -2975,6 +2976,7 @@ void GCS_MAVLINK::handle_common_vision_position_estimate_data(const uint64_t use const float roll, const float pitch, const float yaw, + const uint8_t reset_counter, const uint16_t payload_size) { #if HAL_VISUALODOM_ENABLED @@ -2985,7 +2987,7 @@ void GCS_MAVLINK::handle_common_vision_position_estimate_data(const uint64_t use if (visual_odom == nullptr) { return; } - visual_odom->handle_vision_position_estimate(usec, timestamp_ms, x, y, z, roll, pitch, yaw); + visual_odom->handle_vision_position_estimate(usec, timestamp_ms, x, y, z, roll, pitch, yaw, reset_counter); #endif } @@ -3002,7 +3004,8 @@ void GCS_MAVLINK::handle_att_pos_mocap(const mavlink_message_t &msg) if (visual_odom == nullptr) { return; } - visual_odom->handle_vision_position_estimate(m.time_usec, timestamp_ms, m.x, m.y, m.z, m.q); + // note: att_pos_mocap does not include reset counter + visual_odom->handle_vision_position_estimate(m.time_usec, timestamp_ms, m.x, m.y, m.z, m.q, 0); #endif }