FlightTaskAutoMapper: merge activate() into FlightTaskAutoLineSmooth

This commit is contained in:
Matthias Grob
2021-11-10 21:11:47 +01:00
parent e9d50b853a
commit 1cef2ad196
3 changed files with 5 additions and 17 deletions
@@ -42,7 +42,11 @@ using namespace matrix;
bool FlightTaskAutoLineSmoothVel::activate(const vehicle_local_position_setpoint_s &last_setpoint)
{
bool ret = FlightTaskAutoMapper::activate(last_setpoint);
bool ret = FlightTaskAuto::activate(last_setpoint);
// Set setpoints equal current state.
_velocity_setpoint = _velocity;
_position_setpoint = _position;
Vector3f vel_prev{last_setpoint.vx, last_setpoint.vy, last_setpoint.vz};
Vector3f pos_prev{last_setpoint.x, last_setpoint.y, last_setpoint.z};
@@ -45,13 +45,6 @@ FlightTaskAutoMapper::FlightTaskAutoMapper() :
_stick_acceleration_xy(this)
{}
bool FlightTaskAutoMapper::activate(const vehicle_local_position_setpoint_s &last_setpoint)
{
bool ret = FlightTaskAuto::activate(last_setpoint);
_reset();
return ret;
}
bool FlightTaskAutoMapper::update()
{
bool ret = FlightTaskAuto::update();
@@ -116,13 +109,6 @@ bool FlightTaskAutoMapper::update()
return ret;
}
void FlightTaskAutoMapper::_reset()
{
// Set setpoints equal current state.
_velocity_setpoint = _velocity;
_position_setpoint = _position;
}
void FlightTaskAutoMapper::_prepareIdleSetpoints()
{
// Send zero thrust setpoint
@@ -50,7 +50,6 @@ class FlightTaskAutoMapper : public FlightTaskAuto
public:
FlightTaskAutoMapper();
virtual ~FlightTaskAutoMapper() = default;
bool activate(const vehicle_local_position_setpoint_s &last_setpoint) override;
bool update() override;
protected:
@@ -84,7 +83,6 @@ private:
StickYaw _stick_yaw;
matrix::Vector3f _land_position;
float _land_heading;
void _reset(); /**< Resets member variables to current vehicle state */
WaypointType _type_previous{WaypointType::idle}; /**< Previous type of current target triplet. */
bool _highEnoughForLandingGear(); /**< Checks if gears can be lowered. */
};