mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-30 09:40:35 +08:00
Fixed offboard_control_pos_sp to be passed to _pos_sp vector. Added checks for position and altitude control modes.
This commit is contained in:
@@ -681,9 +681,16 @@ MulticopterPositionControl::task_main()
|
||||
}
|
||||
|
||||
/* Hopefully no one dies from this */
|
||||
pos(0) = _offboard_control_pos_sp.p1;
|
||||
pos(1) = _offboard_control_pos_sp.p2;
|
||||
pos(2) = _offboard_control_pos_sp.p4;
|
||||
/* Make sure position control is selected i.e. not only velocity control */
|
||||
if (_control_mode.flag_control_position_enabled) {
|
||||
_pos_sp(0) = _offboard_control_pos_sp.p1;
|
||||
_pos_sp(1) = _offboard_control_pos_sp.p2;
|
||||
}
|
||||
|
||||
if (_control_mode.flag_control_altitude_enabled) {
|
||||
_pos_sp(2) = _offboard_control_pos_sp.p4;
|
||||
}
|
||||
|
||||
_att_sp.yaw_body = _offboard_control_pos_sp.p3;
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user