Skip to content

Commit

Permalink
mc_att_control: fix having high thrust when disarmed
Browse files Browse the repository at this point in the history
After boot the user is in manual mode and if he has an RC
but doesn't switch out the thrust gets set to the throttle stick
position. When he then starts a takeoff from tablet the thrust is still
high while arming and the land detector immediately sees a takeoff
skiping smooth takeoff from the position controller.
  • Loading branch information
MaEtUgR committed May 16, 2019
1 parent c38eda4 commit 0c81a19
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modules/mc_att_control/mc_att_control_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,10 @@ MulticopterAttitudeControl::generate_attitude_setpoint(float dt, bool reset_yaw_
q_sp.copyTo(attitude_setpoint.q_d);
attitude_setpoint.q_d_valid = true;

attitude_setpoint.thrust_body[2] = -throttle_curve(_manual_control_sp.z);
// hotfix: make sure to leave a zero thrust setpoint for position controller to take over after initialization in manual mode
// without this the actuator_controls thrust stays like it was set here when switching to a position controlled mode and the
// land detector will immediately detect takeoff when arming
attitude_setpoint.thrust_body[2] = _v_control_mode.flag_armed ? -throttle_curve(_manual_control_sp.z) : 0.0f;
attitude_setpoint.timestamp = hrt_absolute_time();
if (_attitude_sp_id != nullptr) {
orb_publish_auto(_attitude_sp_id, &_vehicle_attitude_setpoint_pub, &attitude_setpoint, nullptr, ORB_PRIO_DEFAULT);
Expand Down

0 comments on commit 0c81a19

Please sign in to comment.