mc pos ctrl multiplatform: do not publish att sp in offboard && no position/velocity control

This commit is contained in:
Thomas Gubler
2015-03-01 12:32:46 +01:00
parent 2b71bff858
commit f10bcb0377
@@ -1015,13 +1015,20 @@ void MulticopterPositionControl::handle_vehicle_attitude(const px4_vehicle_atti
reset_yaw_sp = true; reset_yaw_sp = true;
} }
/* publish attitude setpoint */ /* publish attitude setpoint
* Do not publish if offboard is enabled but position/velocity control is disabled, in this case the attitude setpoint
* is published by the mavlink app
*/
if (!(_control_mode->data().flag_control_offboard_enabled &&
!(_control_mode->data().flag_control_position_enabled ||
_control_mode->data().flag_control_velocity_enabled))) {
if (_att_sp_pub != nullptr) { if (_att_sp_pub != nullptr) {
_att_sp_pub->publish(_att_sp_msg); _att_sp_pub->publish(_att_sp_msg);
} else { } else {
_att_sp_pub = _n.advertise<px4_vehicle_attitude_setpoint>(); _att_sp_pub = _n.advertise<px4_vehicle_attitude_setpoint>();
} }
}
/* reset altitude controller integral (hovering throttle) to manual throttle after manual throttle control */ /* reset altitude controller integral (hovering throttle) to manual throttle after manual throttle control */
reset_int_z_manual = _control_mode->data().flag_armed && _control_mode->data().flag_control_manual_enabled && !_control_mode->data().flag_control_climb_rate_enabled; reset_int_z_manual = _control_mode->data().flag_armed && _control_mode->data().flag_control_manual_enabled && !_control_mode->data().flag_control_climb_rate_enabled;