aboutsummaryrefslogtreecommitdiff
path: root/src/modules/mc_pos_control/mc_pos_control_main.cpp
diff options
context:
space:
mode:
authorAnton Babushkin <anton.babushkin@me.com>2014-02-01 10:32:46 +0100
committerAnton Babushkin <anton.babushkin@me.com>2014-02-01 10:32:46 +0100
commitf835980b468fe44c49051df0b58f830bafb256f5 (patch)
tree489c87b7ec35b4afb4d1b35346ef3ee0b823d9ba /src/modules/mc_pos_control/mc_pos_control_main.cpp
parent8a203951594282a297b2af402a82b85f0f927619 (diff)
downloadpx4-firmware-f835980b468fe44c49051df0b58f830bafb256f5.tar.gz
px4-firmware-f835980b468fe44c49051df0b58f830bafb256f5.tar.bz2
px4-firmware-f835980b468fe44c49051df0b58f830bafb256f5.zip
mc_pos_control: more correct control flags usage
Diffstat (limited to 'src/modules/mc_pos_control/mc_pos_control_main.cpp')
-rw-r--r--src/modules/mc_pos_control/mc_pos_control_main.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/modules/mc_pos_control/mc_pos_control_main.cpp b/src/modules/mc_pos_control/mc_pos_control_main.cpp
index 0d65b5b03..4fb9bd663 100644
--- a/src/modules/mc_pos_control/mc_pos_control_main.cpp
+++ b/src/modules/mc_pos_control/mc_pos_control_main.cpp
@@ -672,7 +672,7 @@ MulticopterPositionControl::task_main()
_pos_sp_triplet_pub = orb_advertise(ORB_ID(position_setpoint_triplet), &_pos_sp_triplet);
}
- } else if (_control_mode.flag_control_auto_enabled) {
+ } else {
/* always use AMSL altitude for AUTO */
select_alt(true);
@@ -703,13 +703,9 @@ MulticopterPositionControl::task_main()
reset_lat_lon_sp();
reset_alt_sp();
}
- } else {
- /* no control, reset setpoint */
- reset_lat_lon_sp();
- reset_alt_sp();
}
- if (_control_mode.flag_control_auto_enabled && _pos_sp_triplet.current.valid && _pos_sp_triplet.current.type == SETPOINT_TYPE_IDLE) {
+ if (!_control_mode.flag_control_manual_enabled && _pos_sp_triplet.current.valid && _pos_sp_triplet.current.type == SETPOINT_TYPE_IDLE) {
/* idle state, don't run controller and set zero thrust */
R.identity();
memcpy(&_att_sp.R_body[0][0], R.data, sizeof(_att_sp.R_body));
@@ -751,7 +747,7 @@ MulticopterPositionControl::task_main()
}
/* use constant descend rate when landing, ignore altitude setpoint */
- if (_control_mode.flag_control_auto_enabled && _pos_sp_triplet.current.valid && _pos_sp_triplet.current.type == SETPOINT_TYPE_LAND) {
+ if (!_control_mode.flag_control_manual_enabled && _pos_sp_triplet.current.valid && _pos_sp_triplet.current.type == SETPOINT_TYPE_LAND) {
_vel_sp(2) = _params.land_speed;
}
@@ -848,7 +844,7 @@ MulticopterPositionControl::task_main()
float tilt_max = _params.tilt_max;
/* adjust limits for landing mode */
- if (_control_mode.flag_control_auto_enabled && _pos_sp_triplet.current.valid &&
+ if (!_control_mode.flag_control_manual_enabled && _pos_sp_triplet.current.valid &&
_pos_sp_triplet.current.type == SETPOINT_TYPE_LAND) {
/* limit max tilt and min lift when landing */
tilt_max = _params.land_tilt_max;