Skip to content

Commit

Permalink
GCS_MAVLink: support MAV_CMD_EXTERNAL_WIND_ESTIMATE
Browse files Browse the repository at this point in the history
  • Loading branch information
python36 authored and peterbarker committed Sep 4, 2024
1 parent 3344dba commit e74afdf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions libraries/GCS_MAVLink/GCS.h
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ class GCS_MAVLINK

virtual MAV_RESULT handle_command_int_packet(const mavlink_command_int_t &packet, const mavlink_message_t &msg);
MAV_RESULT handle_command_int_external_position_estimate(const mavlink_command_int_t &packet);
MAV_RESULT handle_command_int_external_wind_estimate(const mavlink_command_int_t &packet);

#if AP_HOME_ENABLED
MAV_RESULT handle_command_do_set_home(const mavlink_command_int_t &packet);
Expand Down
19 changes: 19 additions & 0 deletions libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5233,6 +5233,21 @@ MAV_RESULT GCS_MAVLINK::handle_command_int_external_position_estimate(const mavl
}
#endif // AP_AHRS_POSITION_RESET_ENABLED

#if AP_AHRS_EXTERNAL_WIND_ESTIMATE_ENABLED
MAV_RESULT GCS_MAVLINK::handle_command_int_external_wind_estimate(const mavlink_command_int_t &packet)
{
if (packet.param1 < 0) {
return MAV_RESULT_DENIED;
}
if (packet.param3 < 0 || packet.param3 > 360) {
return MAV_RESULT_DENIED;
}

AP::ahrs().set_external_wind_estimate(packet.param1, packet.param3);
return MAV_RESULT_ACCEPTED;
}
#endif // AP_AHRS_EXTERNAL_WIND_ESTIMATE_ENABLED

MAV_RESULT GCS_MAVLINK::handle_command_do_set_roi(const mavlink_command_int_t &packet)
{
// be aware that this method is called for both MAV_CMD_DO_SET_ROI
Expand Down Expand Up @@ -5415,6 +5430,10 @@ MAV_RESULT GCS_MAVLINK::handle_command_int_packet(const mavlink_command_int_t &p
case MAV_CMD_EXTERNAL_POSITION_ESTIMATE:
return handle_command_int_external_position_estimate(packet);
#endif
#if AP_AHRS_EXTERNAL_WIND_ESTIMATE_ENABLED
case MAV_CMD_EXTERNAL_WIND_ESTIMATE:
return handle_command_int_external_wind_estimate(packet);
#endif
#if AP_ARMING_ENABLED
case MAV_CMD_COMPONENT_ARM_DISARM:
return handle_command_component_arm_disarm(packet);
Expand Down

0 comments on commit e74afdf

Please sign in to comment.