mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 02:21:35 +08:00
FlightTaskStraightLine: replace define with parameter
This commit is contained in:
committed by
ChristophTobler
parent
ebceac5fff
commit
37d4f714b2
@@ -39,7 +39,6 @@
|
|||||||
#include <mathlib/mathlib.h>
|
#include <mathlib/mathlib.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#define ACC_RAD_ZERO_VEL 2.0f
|
|
||||||
#define VEL_ZERO_THRESHOLD 0.001f
|
#define VEL_ZERO_THRESHOLD 0.001f
|
||||||
#define DECELERATION_MAX 8.0f
|
#define DECELERATION_MAX 8.0f
|
||||||
|
|
||||||
@@ -56,7 +55,7 @@ void StraightLine::generateSetpoints(matrix::Vector3f &position_setpoint, matrix
|
|||||||
{
|
{
|
||||||
// Check if target position has been reached
|
// Check if target position has been reached
|
||||||
if (_is_target_reached || (_desired_speed_at_target < VEL_ZERO_THRESHOLD &&
|
if (_is_target_reached || (_desired_speed_at_target < VEL_ZERO_THRESHOLD &&
|
||||||
(_pos - _target).length() < ACC_RAD_ZERO_VEL)) {
|
(_pos - _target).length() < NAV_ACC_RAD.get())) {
|
||||||
// Vehicle has reached target. Lock position
|
// Vehicle has reached target. Lock position
|
||||||
position_setpoint = _target;
|
position_setpoint = _target;
|
||||||
velocity_setpoint = Vector3f(0.0f, 0.0f, 0.0f);
|
velocity_setpoint = Vector3f(0.0f, 0.0f, 0.0f);
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ private:
|
|||||||
(ParamFloat<px4::params::MPC_ACC_DOWN_MAX>) MPC_ACC_DOWN_MAX, /**< maximum vertical acceleration downwards*/
|
(ParamFloat<px4::params::MPC_ACC_DOWN_MAX>) MPC_ACC_DOWN_MAX, /**< maximum vertical acceleration downwards*/
|
||||||
(ParamFloat<px4::params::MPC_XY_VEL_MAX>) MPC_XY_VEL_MAX, /**< maximum horizontal velocity */
|
(ParamFloat<px4::params::MPC_XY_VEL_MAX>) MPC_XY_VEL_MAX, /**< maximum horizontal velocity */
|
||||||
(ParamFloat<px4::params::MPC_Z_VEL_MAX_UP>) MPC_Z_VEL_MAX_UP, /**< maximum vertical velocity upwards */
|
(ParamFloat<px4::params::MPC_Z_VEL_MAX_UP>) MPC_Z_VEL_MAX_UP, /**< maximum vertical velocity upwards */
|
||||||
(ParamFloat<px4::params::MPC_Z_VEL_MAX_DN>) MPC_Z_VEL_MAX_DN /**< maximum vertical velocity downwards */
|
(ParamFloat<px4::params::MPC_Z_VEL_MAX_DN>) MPC_Z_VEL_MAX_DN, /**< maximum vertical velocity downwards */
|
||||||
|
(ParamFloat<px4::params::NAV_ACC_RAD>) NAV_ACC_RAD /**< acceptance radius if a waypoint is reached */
|
||||||
)
|
)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user