FlightTaskOrbit: name member constants start with underscore

This commit is contained in:
Matthias Grob
2018-05-29 14:37:59 +01:00
committed by ChristophTobler
parent 2b6926fe9d
commit 26e3dbec2e
2 changed files with 12 additions and 12 deletions
@@ -59,10 +59,10 @@ bool FlightTaskOrbit::applyCommandParameters(const vehicle_command_s &command)
bool FlightTaskOrbit::setRadius(const float r) bool FlightTaskOrbit::setRadius(const float r)
{ {
if (math::isInRange(r, radius_min, radius_max)) { if (math::isInRange(r, _radius_min, _radius_max)) {
// radius is more important than velocity for safety // radius is more important than velocity for safety
if (!checkAcceleration(r, _v, acceleration_max)) { if (!checkAcceleration(r, _v, _acceleration_max)) {
_v = sqrtf(acceleration_max * r); _v = sqrtf(_acceleration_max * r);
} }
_r = r; _r = r;
@@ -74,8 +74,8 @@ bool FlightTaskOrbit::setRadius(const float r)
bool FlightTaskOrbit::setVelocity(const float v) bool FlightTaskOrbit::setVelocity(const float v)
{ {
if (fabs(v) < velocity_max && if (fabs(v) < _velocity_max &&
checkAcceleration(_r, v, acceleration_max)) { checkAcceleration(_r, v, _acceleration_max)) {
_v = v; _v = v;
return true; return true;
} }
@@ -91,7 +91,7 @@ bool FlightTaskOrbit::checkAcceleration(float r, float v, float a)
bool FlightTaskOrbit::activate() bool FlightTaskOrbit::activate()
{ {
bool ret = FlightTaskManual::activate(); bool ret = FlightTaskManual::activate();
_r = 1.f; _r = _radius_min;
_v = 0.5f; _v = 0.5f;
_z = _position(2); _z = _position(2);
_center = Vector2f(_position.data()); _center = Vector2f(_position.data());
@@ -111,8 +111,8 @@ bool FlightTaskOrbit::activate()
bool FlightTaskOrbit::update() bool FlightTaskOrbit::update()
{ {
// stick input adjusts parameters within a fixed time frame // stick input adjusts parameters within a fixed time frame
const float r = _r + _sticks_expo(0) * _deltatime * (radius_max / 8.f); const float r = _r + _sticks_expo(0) * _deltatime * (_radius_max / 8.f);
const float v = _v - _sticks_expo(1) * _deltatime * (velocity_max / 4.f); const float v = _v - _sticks_expo(1) * _deltatime * (_velocity_max / 4.f);
_z += _sticks_expo(2) * _deltatime; _z += _sticks_expo(2) * _deltatime;
setRadius(r); setRadius(r);
@@ -86,8 +86,8 @@ private:
matrix::Vector2f _center; matrix::Vector2f _center;
// TODO: create/use parameters for limits // TODO: create/use parameters for limits
const float radius_min = 1.f; const float _radius_min = 1.f;
const float radius_max = 20.f; const float _radius_max = 20.f;
const float velocity_max = 10.f; const float _velocity_max = 10.f;
const float acceleration_max = 2.f; const float _acceleration_max = 2.f;
}; };