FlightTaskAuto: move in members from FlightTaskAutoLineSmoothVel

This commit is contained in:
Matthias Grob
2021-11-15 20:18:09 +01:00
parent 33e349d71e
commit 50e13f132f
4 changed files with 19 additions and 25 deletions
@@ -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)
{
}
@@ -47,6 +47,10 @@
#include <uORB/topics/vehicle_status.h>
#include <lib/geo/geo.h>
#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
#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<px4::params::MPC_XY_CRUISE>) _param_mpc_xy_cruise,
(ParamFloat<px4::params::NAV_MC_ALT_RAD>)
@@ -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);
@@ -41,25 +41,17 @@
#pragma once
#include "FlightTaskAuto.hpp"
#include <motion_planning/PositionSmoothing.hpp>
#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<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