mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 00:33:33 +08:00
Support gliding setpoints for autonomous soaring (#14643)
* Enable offboard gliding position setpoints Adds a capability to make the vehicle glide when given position setpoints. Gliding setpoints are enabled by setting POSITION_TARGET_TYPEMASK_Z_IGNORE, POSITION_TARGET_TYPEMASK_VZ_IGNORE, POSITION_TARGET_TYPEMASK_AZ_IGNORE on the typemask of position setpoints. Include zero cruising throttle Invalid setpoints with nan * Handle nans for curise_throttle
This commit is contained in:
@@ -811,6 +811,10 @@ MavlinkReceiver::handle_message_set_position_target_local_ned(mavlink_message_t
|
||||
bool is_land_sp = (bool)(set_position_target_local_ned.type_mask & 0x2000);
|
||||
bool is_loiter_sp = (bool)(set_position_target_local_ned.type_mask & 0x3000);
|
||||
bool is_idle_sp = (bool)(set_position_target_local_ned.type_mask & 0x4000);
|
||||
bool is_gliding_sp = (bool)(set_position_target_local_ned.type_mask &
|
||||
(POSITION_TARGET_TYPEMASK::POSITION_TARGET_TYPEMASK_Z_IGNORE
|
||||
| POSITION_TARGET_TYPEMASK::POSITION_TARGET_TYPEMASK_VZ_IGNORE
|
||||
| POSITION_TARGET_TYPEMASK::POSITION_TARGET_TYPEMASK_AZ_IGNORE));
|
||||
|
||||
offboard_control_mode.timestamp = hrt_absolute_time();
|
||||
_offboard_control_mode_pub.publish(offboard_control_mode);
|
||||
@@ -851,6 +855,9 @@ MavlinkReceiver::handle_message_set_position_target_local_ned(mavlink_message_t
|
||||
} else if (is_idle_sp) {
|
||||
pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_IDLE;
|
||||
|
||||
} else if (is_gliding_sp) {
|
||||
pos_sp_triplet.current.cruising_throttle = 0.0f;
|
||||
|
||||
} else {
|
||||
pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_POSITION;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user