Skip to content
Snippets Groups Projects
Commit 20a47a1a authored by Dennis Mannhart's avatar Dennis Mannhart
Browse files

mc_pos_control: limit if just xy distance close to target

parent f9551c12
No related branches found
No related tags found
No related merge requests found
......@@ -1500,8 +1500,9 @@ void MulticopterPositionControl::control_auto(float dt)
}
/* set velocity limit if close to current setpoint and no next setpoint available */
math::Vector<3> dist = _curr_pos_sp - _pos;
_limit_vel_xy = (!next_setpoint_valid || (_pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_LOITER))
&& ((_curr_pos_sp - _pos).length() <= _target_threshold_xy.get());
&& (sqrtf(dist(0) * dist(0) + dist(1) * dist(1)) <= _target_threshold_xy.get());
if (current_setpoint_valid &&
(_pos_sp_triplet.current.type != position_setpoint_s::SETPOINT_TYPE_IDLE)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment