mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 07:23:33 +08:00
fw pos control: better check for control mode
This commit is contained in:
@@ -909,10 +909,8 @@ FixedwingPositionControl::control_position(const math::Vector<2> ¤t_positi
|
|||||||
float throttle_max = 1.0f;
|
float throttle_max = 1.0f;
|
||||||
|
|
||||||
/* AUTONOMOUS FLIGHT */
|
/* AUTONOMOUS FLIGHT */
|
||||||
|
if (_control_mode.flag_control_auto_enabled &&
|
||||||
// XXX this should only execute if auto AND safety off (actuators active),
|
pos_sp_triplet.current.valid) {
|
||||||
// else integrators should be constantly reset.
|
|
||||||
if (pos_sp_triplet.current.valid) {
|
|
||||||
|
|
||||||
if (!_was_pos_control_mode) {
|
if (!_was_pos_control_mode) {
|
||||||
/* reset integrators */
|
/* reset integrators */
|
||||||
@@ -1248,7 +1246,8 @@ FixedwingPositionControl::control_position(const math::Vector<2> ¤t_positi
|
|||||||
_att_sp.roll_reset_integral = true;
|
_att_sp.roll_reset_integral = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (_control_mode.flag_control_velocity_enabled) {
|
} else if (_control_mode.flag_control_velocity_enabled &&
|
||||||
|
_control_mode.flag_control_altitude_enabled) {
|
||||||
const float deadBand = (60.0f/1000.0f);
|
const float deadBand = (60.0f/1000.0f);
|
||||||
const float factor = 1.0f - deadBand;
|
const float factor = 1.0f - deadBand;
|
||||||
if (!_was_velocity_control_mode) {
|
if (!_was_velocity_control_mode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user