mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 18:06:39 +08:00
FlightTaskAuto: move in members from FlightTaskAutoLineSmoothVel
This commit is contained in:
@@ -43,7 +43,9 @@ using namespace matrix;
|
|||||||
static constexpr float SIGMA_NORM = 0.001f;
|
static constexpr float SIGMA_NORM = 0.001f;
|
||||||
|
|
||||||
FlightTaskAuto::FlightTaskAuto() :
|
FlightTaskAuto::FlightTaskAuto() :
|
||||||
_obstacle_avoidance(this)
|
_obstacle_avoidance(this),
|
||||||
|
_sticks(this),
|
||||||
|
_stick_acceleration_xy(this)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,10 @@
|
|||||||
#include <uORB/topics/vehicle_status.h>
|
#include <uORB/topics/vehicle_status.h>
|
||||||
#include <lib/geo/geo.h>
|
#include <lib/geo/geo.h>
|
||||||
#include <lib/mathlib/math/filter/AlphaFilter.hpp>
|
#include <lib/mathlib/math/filter/AlphaFilter.hpp>
|
||||||
|
#include <lib/motion_planning/PositionSmoothing.hpp>
|
||||||
|
#include "Sticks.hpp"
|
||||||
|
#include "StickAccelerationXY.hpp"
|
||||||
|
#include "StickYaw.hpp"
|
||||||
|
|
||||||
// TODO: make this switchable in the board config, like a module
|
// TODO: make this switchable in the board config, like a module
|
||||||
#if CONSTRAINED_FLASH
|
#if CONSTRAINED_FLASH
|
||||||
@@ -119,6 +123,17 @@ protected:
|
|||||||
|
|
||||||
ObstacleAvoidance _obstacle_avoidance; /**< class adjusting setpoints according to external avoidance module's input */
|
ObstacleAvoidance _obstacle_avoidance; /**< class adjusting setpoints according to external avoidance module's input */
|
||||||
|
|
||||||
|
PositionSmoothing _position_smoothing;
|
||||||
|
Vector3f _unsmoothed_velocity_setpoint;
|
||||||
|
Sticks _sticks;
|
||||||
|
StickAccelerationXY _stick_acceleration_xy;
|
||||||
|
StickYaw _stick_yaw;
|
||||||
|
matrix::Vector3f _land_position;
|
||||||
|
float _land_heading;
|
||||||
|
WaypointType _type_previous{WaypointType::idle}; /**< Previous type of current target triplet. */
|
||||||
|
bool _is_emergency_braking_active{false};
|
||||||
|
bool _want_takeoff{false};
|
||||||
|
|
||||||
DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTask,
|
DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTask,
|
||||||
(ParamFloat<px4::params::MPC_XY_CRUISE>) _param_mpc_xy_cruise,
|
(ParamFloat<px4::params::MPC_XY_CRUISE>) _param_mpc_xy_cruise,
|
||||||
(ParamFloat<px4::params::NAV_MC_ALT_RAD>)
|
(ParamFloat<px4::params::NAV_MC_ALT_RAD>)
|
||||||
|
|||||||
-5
@@ -40,11 +40,6 @@
|
|||||||
|
|
||||||
using namespace matrix;
|
using namespace matrix;
|
||||||
|
|
||||||
FlightTaskAutoLineSmoothVel::FlightTaskAutoLineSmoothVel() :
|
|
||||||
_sticks(this),
|
|
||||||
_stick_acceleration_xy(this)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool FlightTaskAutoLineSmoothVel::activate(const vehicle_local_position_setpoint_s &last_setpoint)
|
bool FlightTaskAutoLineSmoothVel::activate(const vehicle_local_position_setpoint_s &last_setpoint)
|
||||||
{
|
{
|
||||||
bool ret = FlightTaskAuto::activate(last_setpoint);
|
bool ret = FlightTaskAuto::activate(last_setpoint);
|
||||||
|
|||||||
+1
-19
@@ -41,25 +41,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "FlightTaskAuto.hpp"
|
#include "FlightTaskAuto.hpp"
|
||||||
#include <motion_planning/PositionSmoothing.hpp>
|
|
||||||
#include "Sticks.hpp"
|
|
||||||
#include "StickAccelerationXY.hpp"
|
|
||||||
#include "StickYaw.hpp"
|
|
||||||
|
|
||||||
class FlightTaskAutoLineSmoothVel : public FlightTaskAuto
|
class FlightTaskAutoLineSmoothVel : public FlightTaskAuto
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FlightTaskAutoLineSmoothVel();
|
FlightTaskAutoLineSmoothVel() = default;
|
||||||
virtual ~FlightTaskAutoLineSmoothVel() = default;
|
virtual ~FlightTaskAutoLineSmoothVel() = default;
|
||||||
|
|
||||||
bool activate(const vehicle_local_position_setpoint_s &last_setpoint) override;
|
bool activate(const vehicle_local_position_setpoint_s &last_setpoint) override;
|
||||||
void reActivate() override;
|
void reActivate() override;
|
||||||
bool update() override;
|
bool update() override;
|
||||||
|
|
||||||
private:
|
|
||||||
PositionSmoothing _position_smoothing;
|
|
||||||
Vector3f _unsmoothed_velocity_setpoint;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** Reset position or velocity setpoints in case of EKF reset event */
|
/** Reset position or velocity setpoints in case of EKF reset event */
|
||||||
@@ -77,14 +69,11 @@ protected:
|
|||||||
|
|
||||||
bool isTargetModified() const;
|
bool isTargetModified() const;
|
||||||
|
|
||||||
bool _is_emergency_braking_active{false};
|
|
||||||
|
|
||||||
void _prepareSetpoints(); /**< Generate velocity target points for the trajectory generator. */
|
void _prepareSetpoints(); /**< Generate velocity target points for the trajectory generator. */
|
||||||
void _updateTrajConstraints();
|
void _updateTrajConstraints();
|
||||||
|
|
||||||
/** determines when to trigger a takeoff (ignored in flight) */
|
/** determines when to trigger a takeoff (ignored in flight) */
|
||||||
bool _checkTakeoff() override { return _want_takeoff; };
|
bool _checkTakeoff() override { return _want_takeoff; };
|
||||||
bool _want_takeoff{false};
|
|
||||||
|
|
||||||
void _prepareIdleSetpoints();
|
void _prepareIdleSetpoints();
|
||||||
void _prepareLandSetpoints();
|
void _prepareLandSetpoints();
|
||||||
@@ -95,13 +84,6 @@ protected:
|
|||||||
|
|
||||||
void updateParams() override; /**< See ModuleParam class */
|
void updateParams() override; /**< See ModuleParam class */
|
||||||
|
|
||||||
Sticks _sticks;
|
|
||||||
StickAccelerationXY _stick_acceleration_xy;
|
|
||||||
StickYaw _stick_yaw;
|
|
||||||
matrix::Vector3f _land_position;
|
|
||||||
float _land_heading;
|
|
||||||
WaypointType _type_previous{WaypointType::idle}; /**< Previous type of current target triplet. */
|
|
||||||
|
|
||||||
DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTaskAuto,
|
DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTaskAuto,
|
||||||
(ParamFloat<px4::params::MIS_YAW_ERR>) _param_mis_yaw_err, // yaw-error threshold
|
(ParamFloat<px4::params::MIS_YAW_ERR>) _param_mis_yaw_err, // yaw-error threshold
|
||||||
(ParamFloat<px4::params::MPC_ACC_HOR>) _param_mpc_acc_hor, // acceleration in flight
|
(ParamFloat<px4::params::MPC_ACC_HOR>) _param_mpc_acc_hor, // acceleration in flight
|
||||||
|
|||||||
Reference in New Issue
Block a user