mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
FlightTaskOrbit: fix acceleration limit inverting velocity
The formula only calculated the absolute value of the velocity and the sign (rotation direction) got lost in that case.
This commit is contained in:
parent
12290c27e6
commit
7c068e47ab
@ -60,9 +60,9 @@ bool FlightTaskOrbit::applyCommandParameters(const vehicle_command_s &command)
|
||||
bool FlightTaskOrbit::setRadius(const float r)
|
||||
{
|
||||
if (math::isInRange(r, _radius_min, _radius_max)) {
|
||||
// radius is more important than velocity for safety
|
||||
// small radius is more important than high velocity for safety
|
||||
if (!checkAcceleration(r, _v, _acceleration_max)) {
|
||||
_v = sqrtf(_acceleration_max * r);
|
||||
_v = math::sign(_v) * sqrtf(_acceleration_max * r);
|
||||
}
|
||||
|
||||
_r = r;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user