mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 17:31:36 +08:00
FlightTaskOrbit: add acceleration limit & unify checks
This commit is contained in:
committed by
ChristophTobler
parent
79aaa59715
commit
c2223030d9
@@ -47,19 +47,47 @@ class FlightTaskOrbit : public FlightTaskManual
|
||||
{
|
||||
public:
|
||||
FlightTaskOrbit();
|
||||
|
||||
virtual ~FlightTaskOrbit() = default;
|
||||
|
||||
bool applyCommandParameters(const vehicle_command_s &command) override;
|
||||
|
||||
bool activate() override;
|
||||
|
||||
bool update() override;
|
||||
|
||||
/**
|
||||
* Check the feasibility of orbit parameters with respect to
|
||||
* centripetal acceleration a = v^2 / r
|
||||
* @param r desired radius
|
||||
* @param v desired velocity
|
||||
* @param a maximal allowed acceleration
|
||||
* @return true on success, false if value not accepted
|
||||
*/
|
||||
bool checkAcceleration(float r, float v, float a);
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Change the radius of the circle.
|
||||
* @param r desired new radius
|
||||
* @return true on success, false if value not accepted
|
||||
*/
|
||||
bool setRadius(const float r);
|
||||
|
||||
/**
|
||||
* Change the velocity of the vehicle on the circle.
|
||||
* @param v desired new velocity
|
||||
* @return true on success, false if value not accepted
|
||||
*/
|
||||
bool setVelocity(const float v);
|
||||
|
||||
private:
|
||||
float _r = 0.f; /**< radius with which to orbit the target */
|
||||
float _v = 0.f; /**< linear velocity for orbiting in m/s */
|
||||
float _z = 0.f; /**< local z coordinate in meters */
|
||||
matrix::Vector2f _center;
|
||||
|
||||
// TODO: create/use parameters for limits
|
||||
const float radius_min = 1.f;
|
||||
const float radius_max = 20.f;
|
||||
const float velocity_max = 10.f;
|
||||
const float acceleration_max = 2.f;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user