GCS_MAVLink: support MAV_CMD_EXTERNAL_WIND_ESTIMATE

This commit is contained in:
Andrii Fil 2024-09-03 19:12:18 +03:00 committed by Peter Barker
parent 3344dba627
commit e74afdfcea
2 changed files with 20 additions and 0 deletions

View File

@ -525,6 +525,7 @@ protected:
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);

View File

@ -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
@ -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);