mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-18 17:29:08 +08:00
en-/disable mc position controller using explicit control mode flag
This commit is contained in:
parent
17ea92bb54
commit
514845592b
@ -2,6 +2,7 @@ uint64 timestamp # time since system start (microseconds)
|
||||
bool flag_armed # synonym for actuator_armed.armed
|
||||
|
||||
bool flag_external_manual_override_ok # external override non-fatal for system. Only true for fixed wing
|
||||
bool flag_multicopter_position_control_enabled
|
||||
|
||||
bool flag_control_manual_enabled # true if manual input is mixed in
|
||||
bool flag_control_auto_enabled # true if onboard autopilot should act
|
||||
|
||||
@ -3328,6 +3328,14 @@ Commander::update_control_mode()
|
||||
break;
|
||||
}
|
||||
|
||||
_vehicle_control_mode.flag_multicopter_position_control_enabled =
|
||||
(_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING)
|
||||
&& (_vehicle_control_mode.flag_control_altitude_enabled
|
||||
|| _vehicle_control_mode.flag_control_climb_rate_enabled
|
||||
|| _vehicle_control_mode.flag_control_position_enabled
|
||||
|| _vehicle_control_mode.flag_control_velocity_enabled
|
||||
|| _vehicle_control_mode.flag_control_acceleration_enabled);
|
||||
|
||||
_vehicle_control_mode.timestamp = hrt_absolute_time();
|
||||
_control_mode_pub.publish(_vehicle_control_mode);
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ void MulticopterPositionControl::Run()
|
||||
|
||||
PositionControlStates states{set_vehicle_states(local_pos)};
|
||||
|
||||
if (_control_mode.flag_control_acceleration_enabled || _control_mode.flag_control_climb_rate_enabled) {
|
||||
if (_control_mode.flag_multicopter_position_control_enabled) {
|
||||
|
||||
_trajectory_setpoint_sub.update(&_setpoint);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user