mpc: use xy stick limiting function from library

This commit is contained in:
bresch 2022-02-24 14:27:10 +01:00 committed by Mathieu Bresciani
parent 7e9a45a01a
commit 1de38c88d9
1 changed files with 1 additions and 5 deletions

View File

@ -73,11 +73,7 @@ void FlightTaskManualPosition::_scaleSticks()
/* Constrain length of stick inputs to 1 for xy*/
Vector2f stick_xy = _sticks.getPositionExpo().slice<2, 1>(0, 0);
const float mag = math::constrain(stick_xy.length(), 0.0f, 1.0f);
if (mag > FLT_EPSILON) {
stick_xy = stick_xy.normalized() * mag;
}
Sticks::limitStickUnitLengthXY(stick_xy);
const float max_speed_from_estimator = _sub_vehicle_local_position.get().vxy_max;