aboutsummaryrefslogtreecommitdiff
path: root/src/modules/mc_pos_control
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-12-25 09:48:15 +0100
committerThomas Gubler <thomasgubler@gmail.com>2014-12-25 09:48:15 +0100
commit25af4b266ca48b183a1ad375856396f67d6ab30f (patch)
tree64e031ec3747ab706e5ae8ed9fd052e12ee3248b /src/modules/mc_pos_control
parentad189cf7d69b8de16244b90d398e1d84ed6d0f4b (diff)
parent9b535f6553944f3468bbec9203301623412524ad (diff)
downloadpx4-firmware-25af4b266ca48b183a1ad375856396f67d6ab30f.tar.gz
px4-firmware-25af4b266ca48b183a1ad375856396f67d6ab30f.tar.bz2
px4-firmware-25af4b266ca48b183a1ad375856396f67d6ab30f.zip
Merge remote-tracking branch 'upstream/master' into dev_ros
Conflicts: .gitignore src/lib/uavcan
Diffstat (limited to 'src/modules/mc_pos_control')
-rw-r--r--src/modules/mc_pos_control/mc_pos_control_main.cpp7
1 files changed, 4 insertions, 3 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 4ea5fdfb6..bf65d2805 100644
--- a/src/modules/mc_pos_control/mc_pos_control_main.cpp
+++ b/src/modules/mc_pos_control/mc_pos_control_main.cpp
@@ -653,8 +653,6 @@ MulticopterPositionControl::control_offboard(float dt)
/* control position */
_pos_sp(0) = _pos_sp_triplet.current.x;
_pos_sp(1) = _pos_sp_triplet.current.y;
- _pos_sp(2) = _pos_sp_triplet.current.z;
-
} else if (_control_mode.flag_control_velocity_enabled && _pos_sp_triplet.current.velocity_valid) {
/* control velocity */
/* reset position setpoint to current position if needed */
@@ -671,7 +669,10 @@ MulticopterPositionControl::control_offboard(float dt)
_att_sp.yaw_body = _att_sp.yaw_body + _pos_sp_triplet.current.yawspeed * dt;
}
- if (_control_mode.flag_control_altitude_enabled) {
+ if (_control_mode.flag_control_altitude_enabled && _pos_sp_triplet.current.position_valid) {
+ /* Control altitude */
+ _pos_sp(2) = _pos_sp_triplet.current.z;
+ } else if (_control_mode.flag_control_climb_rate_enabled && _pos_sp_triplet.current.velocity_valid) {
/* reset alt setpoint to current altitude if needed */
reset_alt_sp();