move takeoff state machine flight_mode_manager -> mc_pos_control

This commit is contained in:
Daniel Agar
2021-03-03 18:53:56 +01:00
committed by Matthias Grob
parent 823c6078d9
commit 266ea377da
20 changed files with 288 additions and 279 deletions
@@ -56,8 +56,6 @@
#include <uORB/topics/vehicle_local_position_setpoint.h>
#include <uORB/topics/vehicle_status.h>
#include "Takeoff/Takeoff.hpp"
#include <new>
enum class FlightTaskError : int {
@@ -95,7 +93,6 @@ private:
void handleCommand();
void generateTrajectorySetpoint(const float dt, const vehicle_local_position_s &vehicle_local_position);
void limitAltitude(vehicle_local_position_setpoint_s &setpoint, const vehicle_local_position_s &vehicle_local_position);
void reset_setpoint_to_nan(vehicle_local_position_setpoint_s &setpoint);
/**
* Switch to a specific task (for normal usage)
@@ -133,10 +130,9 @@ private:
FlightTaskIndex index{FlightTaskIndex::None};
} _current_task{};
Takeoff _takeoff; ///< state machine and ramp to bring the vehicle off the ground without a jump
WeatherVane *_wv_controller{nullptr};
int8_t _old_landing_gear_position{landing_gear_s::GEAR_KEEP};
uint8_t _old_takeoff_state{0};
uint8_t _takeoff_state{takeoff_status_s::TAKEOFF_STATE_DISARMED};
int _task_failure_count{0};
uint8_t _last_vehicle_nav_state{0};
@@ -145,6 +141,7 @@ private:
uORB::SubscriptionInterval _parameter_update_sub{ORB_ID(parameter_update), 1_s};
uORB::Subscription _takeoff_status_sub{ORB_ID(takeoff_status)};
uORB::Subscription _vehicle_attitude_setpoint_sub{ORB_ID(vehicle_attitude_setpoint)};
uORB::Subscription _vehicle_command_sub{ORB_ID(vehicle_command)};
uORB::Subscription _vehicle_local_position_setpoint_sub{ORB_ID(vehicle_local_position_setpoint)};
@@ -156,19 +153,12 @@ private:
uORB::SubscriptionData<vehicle_status_s> _vehicle_status_sub{ORB_ID(vehicle_status)};
uORB::Publication<landing_gear_s> _landing_gear_pub{ORB_ID(landing_gear)};
uORB::Publication<takeoff_status_s> _takeoff_status_pub{ORB_ID(takeoff_status)};
uORB::Publication<vehicle_local_position_setpoint_s> _trajectory_setpoint_pub{ORB_ID(trajectory_setpoint)};
uORB::Publication<vehicle_command_s> _vehicle_command_pub{ORB_ID(vehicle_command)};
uORB::Publication<vehicle_command_ack_s> _vehicle_command_ack_pub{ORB_ID(vehicle_command_ack)};
uORB::Publication<vehicle_constraints_s> _vehicle_constraints_pub{ORB_ID(vehicle_constraints)};
DEFINE_PARAMETERS(
(ParamInt<px4::params::MPC_POS_MODE>) _param_mpc_pos_mode,
(ParamFloat<px4::params::MPC_TILTMAX_LND>) _param_mpc_tiltmax_lnd,
(ParamFloat<px4::params::MPC_Z_VEL_MAX_UP>) _param_mpc_z_vel_max_up,
(ParamFloat<px4::params::MPC_SPOOLUP_TIME>) _param_mpc_spoolup_time,
(ParamFloat<px4::params::MPC_TKO_RAMP_T>) _param_mpc_tko_ramp_t,
(ParamFloat<px4::params::MPC_Z_VEL_P_ACC>) _param_mpc_z_vel_p_acc,
(ParamFloat<px4::params::MPC_THR_MIN>) _param_mpc_thr_min
(ParamInt<px4::params::MPC_POS_MODE>) _param_mpc_pos_mode
);
};