Skip to content
Snippets Groups Projects
Commit 1454694b authored by Matthias Grob's avatar Matthias Grob Committed by Julian Oes
Browse files

FlightTaskAuto: separate default speed and limit

It wasn't possible to fly faster than cruise speed even if planned
in the mission.

Limiting the planned cruise speed is necessary because
the smoothed trajectory mission plans to the _mc_cruise_speed and
if that's higher than the maximum it gets capped for safety by the
position controller and the result is a jerky flight.
parent 3135f9f0
No related branches found
No related tags found
No related merge requests found
......@@ -128,11 +128,14 @@ bool FlightTaskAuto::_evaluateTriplets()
// Always update cruise speed since that can change without waypoint changes.
_mc_cruise_speed = _sub_triplet_setpoint->get().current.cruising_speed;
if (!PX4_ISFINITE(_mc_cruise_speed) || (_mc_cruise_speed < 0.0f) || (_mc_cruise_speed > _constraints.speed_xy)) {
// Use default limit.
if (!PX4_ISFINITE(_mc_cruise_speed) || (_mc_cruise_speed < 0.0f)) {
// If no speed is planned use the default cruise speed as limit
_mc_cruise_speed = _constraints.speed_xy;
}
// Ensure planned cruise speed is below the maximum such that the smooth trajectory doesn't get capped
_mc_cruise_speed = math::min(_mc_cruise_speed, _param_mpc_xy_vel_max.get());
// Temporary target variable where we save the local reprojection of the latest navigator current triplet.
Vector3f tmp_target;
......
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