mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 16:58:54 +08:00
FlightTaskOrbit: clip radius to range
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user