mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 10:53:34 +08:00
FlightTaskManualAcceleration: horizontal velocity limit interface
This commit is contained in:
+1
-8
@@ -31,13 +31,6 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file FlightTaskManualPosition.hpp
|
|
||||||
*
|
|
||||||
* Flight task for manual position controlled mode.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "FlightTaskManualAltitudeSmoothVel.hpp"
|
#include "FlightTaskManualAltitudeSmoothVel.hpp"
|
||||||
@@ -53,7 +46,7 @@ public:
|
|||||||
bool activate(const trajectory_setpoint_s &last_setpoint) override;
|
bool activate(const trajectory_setpoint_s &last_setpoint) override;
|
||||||
bool update() override;
|
bool update() override;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
void _ekfResetHandlerPositionXY(const matrix::Vector2f &delta_xy) override;
|
void _ekfResetHandlerPositionXY(const matrix::Vector2f &delta_xy) override;
|
||||||
void _ekfResetHandlerVelocityXY(const matrix::Vector2f &delta_vxy) override;
|
void _ekfResetHandlerVelocityXY(const matrix::Vector2f &delta_vxy) override;
|
||||||
|
|
||||||
|
|||||||
@@ -73,10 +73,12 @@ void StickAccelerationXY::resetAcceleration(const matrix::Vector2f &acceleration
|
|||||||
void StickAccelerationXY::generateSetpoints(Vector2f stick_xy, const float yaw, const float yaw_sp, const Vector3f &pos,
|
void StickAccelerationXY::generateSetpoints(Vector2f stick_xy, const float yaw, const float yaw_sp, const Vector3f &pos,
|
||||||
const matrix::Vector2f &vel_sp_feedback, const float dt)
|
const matrix::Vector2f &vel_sp_feedback, const float dt)
|
||||||
{
|
{
|
||||||
// maximum commanded acceleration and velocity
|
// maximum commanded velocity can be constrained dynamically
|
||||||
Vector2f acceleration_scale(_param_mpc_acc_hor.get(), _param_mpc_acc_hor.get());
|
|
||||||
const float velocity_sc = fminf(_param_mpc_vel_manual.get(), _velocity_constraint);
|
const float velocity_sc = fminf(_param_mpc_vel_manual.get(), _velocity_constraint);
|
||||||
Vector2f velocity_scale(velocity_sc, velocity_sc);
|
Vector2f velocity_scale(velocity_sc, velocity_sc);
|
||||||
|
// maximum commanded acceleration is scaled down with velocity
|
||||||
|
const float acceleration_sc = _param_mpc_acc_hor.get() * (velocity_sc / _param_mpc_vel_manual.get());
|
||||||
|
Vector2f acceleration_scale(acceleration_sc, acceleration_sc);
|
||||||
|
|
||||||
acceleration_scale *= 2.f; // because of drag the average acceleration is half
|
acceleration_scale *= 2.f; // because of drag the average acceleration is half
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user