Skip to content
Snippets Groups Projects
Commit 3d42c495 authored by Matthias Grob's avatar Matthias Grob
Browse files

FlightTaskOrbit: clip radius to range

parent f8171f99
No related branches found
No related tags found
No related merge requests found
......@@ -117,19 +117,18 @@ bool FlightTaskOrbit::sendTelemetry()
return true;
}
bool FlightTaskOrbit::setRadius(const float r)
bool FlightTaskOrbit::setRadius(float r)
{
if (math::isInRange(r, _radius_min, _radius_max)) {
// small radius is more important than high velocity for safety
if (!checkAcceleration(r, _v, _acceleration_max)) {
_v = math::sign(_v) * sqrtf(_acceleration_max * r);
}
// clip the radius to be within range
r = math::constrain(r, _radius_min, _radius_max);
_r = r;
return true;
// small radius is more important than high velocity for safety
if (!checkAcceleration(r, _v, _acceleration_max)) {
_v = math::sign(_v) * sqrtf(_acceleration_max * r);
}
return false;
_r = r;
return true;
}
bool FlightTaskOrbit::setVelocity(const float v)
......
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