diff --git a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp index 032310220e..1c03fe7413 100644 --- a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp +++ b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp @@ -43,7 +43,9 @@ using namespace matrix; static constexpr float SIGMA_NORM = 0.001f; FlightTaskAuto::FlightTaskAuto() : - _obstacle_avoidance(this) + _obstacle_avoidance(this), + _sticks(this), + _stick_acceleration_xy(this) { } diff --git a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.hpp b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.hpp index ee4a7c013b..92763c0475 100644 --- a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.hpp +++ b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.hpp @@ -47,6 +47,10 @@ #include #include #include +#include +#include "Sticks.hpp" +#include "StickAccelerationXY.hpp" +#include "StickYaw.hpp" // TODO: make this switchable in the board config, like a module #if CONSTRAINED_FLASH @@ -119,6 +123,17 @@ protected: 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, (ParamFloat) _param_mpc_xy_cruise, (ParamFloat) diff --git a/src/modules/flight_mode_manager/tasks/AutoLineSmoothVel/FlightTaskAutoLineSmoothVel.cpp b/src/modules/flight_mode_manager/tasks/AutoLineSmoothVel/FlightTaskAutoLineSmoothVel.cpp index 2b0ab8a9cd..da1919a1c9 100644 --- a/src/modules/flight_mode_manager/tasks/AutoLineSmoothVel/FlightTaskAutoLineSmoothVel.cpp +++ b/src/modules/flight_mode_manager/tasks/AutoLineSmoothVel/FlightTaskAutoLineSmoothVel.cpp @@ -40,11 +40,6 @@ using namespace matrix; -FlightTaskAutoLineSmoothVel::FlightTaskAutoLineSmoothVel() : - _sticks(this), - _stick_acceleration_xy(this) -{} - bool FlightTaskAutoLineSmoothVel::activate(const vehicle_local_position_setpoint_s &last_setpoint) { bool ret = FlightTaskAuto::activate(last_setpoint); diff --git a/src/modules/flight_mode_manager/tasks/AutoLineSmoothVel/FlightTaskAutoLineSmoothVel.hpp b/src/modules/flight_mode_manager/tasks/AutoLineSmoothVel/FlightTaskAutoLineSmoothVel.hpp index ef16aac990..7c2b36bdd6 100644 --- a/src/modules/flight_mode_manager/tasks/AutoLineSmoothVel/FlightTaskAutoLineSmoothVel.hpp +++ b/src/modules/flight_mode_manager/tasks/AutoLineSmoothVel/FlightTaskAutoLineSmoothVel.hpp @@ -41,25 +41,17 @@ #pragma once #include "FlightTaskAuto.hpp" -#include -#include "Sticks.hpp" -#include "StickAccelerationXY.hpp" -#include "StickYaw.hpp" class FlightTaskAutoLineSmoothVel : public FlightTaskAuto { public: - FlightTaskAutoLineSmoothVel(); + FlightTaskAutoLineSmoothVel() = default; virtual ~FlightTaskAutoLineSmoothVel() = default; bool activate(const vehicle_local_position_setpoint_s &last_setpoint) override; void reActivate() override; bool update() override; -private: - PositionSmoothing _position_smoothing; - Vector3f _unsmoothed_velocity_setpoint; - protected: /** Reset position or velocity setpoints in case of EKF reset event */ @@ -77,14 +69,11 @@ protected: bool isTargetModified() const; - bool _is_emergency_braking_active{false}; - void _prepareSetpoints(); /**< Generate velocity target points for the trajectory generator. */ void _updateTrajConstraints(); /** determines when to trigger a takeoff (ignored in flight) */ bool _checkTakeoff() override { return _want_takeoff; }; - bool _want_takeoff{false}; void _prepareIdleSetpoints(); void _prepareLandSetpoints(); @@ -95,13 +84,6 @@ protected: 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, (ParamFloat) _param_mis_yaw_err, // yaw-error threshold (ParamFloat) _param_mpc_acc_hor, // acceleration in flight