FlightTasksAuto/Line: replace BlockParams with module params

This commit is contained in:
Dennis Mannhart
2018-07-20 09:26:18 +02:00
committed by Lorenz Meier
parent 6cfb89a8e8
commit aef6b9216e
5 changed files with 20 additions and 36 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ int FlightTasks::switchTask(FlightTaskIndex new_task_index)
break;
case FlightTaskIndex::AutoLine:
_current_task = new (&_task_union.autoLine) FlightTaskAutoLine(this, "ALN");
_current_task = new (&_task_union.autoLine) FlightTaskAutoLine();
break;
default:
@@ -40,11 +40,6 @@
using namespace matrix;
FlightTaskAuto::FlightTaskAuto(control::SuperBlock *parent, const char *name) :
FlightTask(parent, name),
_mc_cruise_default(this, "MPC_XY_CRUISE", false)
{}
bool FlightTaskAuto::initializeSubscriptions(SubscriptionArray &subscription_array)
{
if (!FlightTask::initializeSubscriptions(subscription_array)) {
+6 -3
View File
@@ -61,7 +61,7 @@ enum class WaypointType : int {
class FlightTaskAuto : public FlightTask
{
public:
FlightTaskAuto(control::SuperBlock *parent, const char *name);
FlightTaskAuto() = default;
virtual ~FlightTaskAuto() = default;
bool initializeSubscriptions(SubscriptionArray &subscription_array) override;
@@ -78,9 +78,12 @@ protected:
WaypointType _type{WaypointType::idle}; /**< Type of current target triplet. */
private:
control::BlockParamFloat _mc_cruise_default; /**< Default mc cruise speed.*/
map_projection_reference_s _reference; /**< Reference frame from global to local. */
uORB::Subscription<position_setpoint_triplet_s> *_sub_triplet_setpoint{nullptr};
DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTask, (ParamFloat<px4::params::MPC_XY_CRUISE>) _mc_cruise_default); /**< Default mc cruise speed.*/
map_projection_reference_s _reference; /**< Reference frame from global to local. */
map_projection_reference_s _reference_position{}; /**< Structure used to project lat/lon setpoint into local frame. */
float _reference_altitude = 0.0f; /**< Altitude relative to ground. */
hrt_abstime _time_stamp_reference = 0; /**< time stamp when last reference update occured. */
@@ -43,20 +43,6 @@ using namespace matrix;
#define SIGMA_SINGLE_OP 0.000001f
#define SIGMA_NORM 0.001f
FlightTaskAutoLine::FlightTaskAutoLine(control::SuperBlock *parent, const char *name) :
FlightTaskAuto(parent, name),
_land_speed(parent, "MPC_LAND_SPEED", false),
_vel_max_up(parent, "MPC_Z_VEL_MAX_UP", false),
_vel_max_down(parent, "MPC_Z_VEL_MAX_DN", false),
_acc_max_xy(parent, "MPC_ACC_HOR_MAX", false),
_acc_xy(parent, "MPC_ACC_HOR", false),
_acc_max_up(parent, "MPC_ACC_UP_MAX", false),
_acc_max_down(parent, "MPC_ACC_DOWN_MAX", false),
_cruise_speed_90(parent, "MPC_CRUISE_90", false),
_nav_rad(parent, "NAV_ACC_RAD", false),
_mis_yaw_error(parent, "MIS_YAW_ERR", false)
{}
bool FlightTaskAutoLine::activate()
{
bool ret = FlightTaskAuto::activate();
@@ -45,7 +45,7 @@
class FlightTaskAutoLine : public FlightTaskAuto
{
public:
FlightTaskAutoLine(control::SuperBlock *parent, const char *name);
FlightTaskAutoLine() = default;
virtual ~FlightTaskAutoLine() = default;
bool activate() override;
bool update() override;
@@ -64,18 +64,18 @@ protected:
};
State _current_state{State::none};
control::BlockParamFloat _land_speed; /**< Downward speed during landing. */
control::BlockParamFloat _vel_max_up; /**< Maximum upward velocity. */
control::BlockParamFloat _vel_max_down; /**< Maximum downward velocity. */
control::BlockParamFloat _acc_max_xy; /**< Maximum acceleration in hover. */
control::BlockParamFloat _acc_xy; /**< Maximum acceleration from hover to fast forward flight. */
control::BlockParamFloat _acc_max_up; /**< Max acceleration up. */
control::BlockParamFloat _acc_max_down; /**< Max acceleration down. */
control::BlockParamFloat _cruise_speed_90; /**< Speed when angle is 90 degrees between prev-current/current-next. */
/* None-position control params */
control::BlockParamFloat _nav_rad; /**< Radius that is used by navigator that defines when to update triplets */
control::BlockParamFloat _mis_yaw_error; /**< Yaw threshold during mission to consider yaw as accepted */
DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTaskAuto,
(ParamFloat<px4::params::MPC_LAND_SPEED>) _land_speed,
(ParamFloat<px4::params::MPC_Z_VEL_MAX_UP>) _vel_max_up,
(ParamFloat<px4::params::MPC_Z_VEL_MAX_DN>) _vel_max_down,
(ParamFloat<px4::params::MPC_ACC_HOR_MAX>) _acc_max_xy,
(ParamFloat<px4::params::MPC_ACC_HOR>) _acc_xy,
(ParamFloat<px4::params::MPC_ACC_UP_MAX>) _acc_max_up,
(ParamFloat<px4::params::MPC_ACC_DOWN_MAX>) _acc_max_down,
(ParamFloat<px4::params::MPC_CRUISE_90>) _cruise_speed_90,
(ParamFloat<px4::params::NAV_ACC_RAD>) _nav_rad,
(ParamFloat<px4::params::MIS_YAW_ERR>) _mis_yaw_error
)
void _generateIdleSetpoints();
void _generateLandSetpoints();