Skip to content

Commit

Permalink
mc_pos_control: delta_t needs to be positive
Browse files Browse the repository at this point in the history
  • Loading branch information
Stifael committed Mar 1, 2017
1 parent 2b90224 commit d8ce7ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/mc_pos_control/mc_pos_control_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ MulticopterPositionControl::control_manual(float dt)
float max_acc_z = (_vel(2) < 0.0f ? _params.acc_down_max : -_params.acc_up_max);

/* time to travel from current velocity to zero velocity */
float delta_t = -_vel(2) / max_acc_z;
float delta_t = fabsf(_vel(2) / max_acc_z);

/* set desired position setpoint assuming max acceleraiton */
_pos_sp(2) = _pos(2) + _vel(2) * delta_t + 0.5f * max_acc_z * delta_t *delta_t;
Expand Down

0 comments on commit d8ce7ee

Please sign in to comment.