mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 16:03:33 +08:00
Offboard control (#5816)
* Fix jmavsim HITL simulation of MAV_CMD_DO_REPOSITION in the case where you have no radio attached to the PX4 and so you have disabled RC link loss for that reason (set NAV_RCL_ACT = 0) but you still want the jmavsimulation to work. The line of code changed here causes failsafe RTL to kick in without this fix. * Add altitude hold option using Z position control, while doing velocity control on vx and vy. * Fix style and rebase issues
This commit is contained in:
@@ -937,9 +937,15 @@ 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 && _pos_sp_triplet.current.position_valid) {
|
||||
/* Control altitude */
|
||||
if (_control_mode.flag_control_altitude_enabled && _pos_sp_triplet.current.alt_valid) {
|
||||
/* control altitude as it is enabled */
|
||||
_pos_sp(2) = _pos_sp_triplet.current.z;
|
||||
_run_alt_control = true;
|
||||
|
||||
} else if (_control_mode.flag_control_altitude_enabled && _pos_sp_triplet.current.position_valid) {
|
||||
/* control altitude because full position control is enabled */
|
||||
_pos_sp(2) = _pos_sp_triplet.current.z;
|
||||
_run_alt_control = true;
|
||||
|
||||
} else if (_control_mode.flag_control_climb_rate_enabled && _pos_sp_triplet.current.velocity_valid) {
|
||||
/* reset alt setpoint to current altitude if needed */
|
||||
|
||||
Reference in New Issue
Block a user