mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-13 04:03:33 +08:00
MC pos control offb: read altitude sp separately
This commit is contained in:
@@ -652,8 +652,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 */
|
||||
@@ -670,7 +668,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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user