diff options
Diffstat (limited to 'src/modules/navigator/mission.h')
-rw-r--r-- | src/modules/navigator/mission.h | 57 |
1 files changed, 21 insertions, 36 deletions
diff --git a/src/modules/navigator/mission.h b/src/modules/navigator/mission.h index 6e4761946..4da6a1155 100644 --- a/src/modules/navigator/mission.h +++ b/src/modules/navigator/mission.h @@ -65,25 +65,15 @@ class Navigator; class Mission : public MissionBlock { public: - /** - * Constructor - */ Mission(Navigator *navigator, const char *name); - /** - * Destructor - */ virtual ~Mission(); - /** - * This function is called while the mode is inactive - */ virtual void on_inactive(); - /** - * This function is called while the mode is active - */ - virtual bool on_active(struct position_setpoint_triplet_s *pos_sp_triplet); + virtual void on_activation(); + + virtual void on_active(); private: /** @@ -102,38 +92,26 @@ private: void advance_mission(); /** - * Set new mission items - */ - void set_mission_items(struct position_setpoint_triplet_s *pos_sp_triplet); - - /** - * Try to set the current position setpoint from an onboard mission item - * @return true if mission item successfully set - */ - bool is_current_onboard_mission_item_set(struct position_setpoint_s *current_pos_sp); - - /** - * Try to set the current position setpoint from an offboard mission item - * @return true if mission item successfully set + * Check distance to first waypoint (with lat/lon) + * @return true only if it's not too far from home (< MIS_DIST_1WP) */ - bool is_current_offboard_mission_item_set(struct position_setpoint_s *current_pos_sp); + bool check_dist_1wp(); /** - * Try to set the next position setpoint from an onboard mission item + * Set new mission items */ - void get_next_onboard_mission_item(struct position_setpoint_s *next_pos_sp); + void set_mission_items(); /** - * Try to set the next position setpoint from an offboard mission item + * Read current or next mission item from the dataman and watch out for DO_JUMPS + * @return true if successful */ - void get_next_offboard_mission_item(struct position_setpoint_s *next_pos_sp); + bool read_mission_item(bool onboard, bool is_current, struct mission_item_s *mission_item); /** - * Read a mission item from the dataman and watch out for DO_JUMPS - * @return true if successful + * Save current offboard mission state to dataman */ - bool read_mission_item(const dm_item_t dm_item, bool is_current, int *mission_index, - struct mission_item_s *new_mission_item); + void save_offboard_mission_state(); /** * Report that a mission item has been reached @@ -155,13 +133,17 @@ private: */ void publish_mission_result(); - control::BlockParamFloat _param_onboard_enabled; + control::BlockParamInt _param_onboard_enabled; + control::BlockParamFloat _param_takeoff_alt; + control::BlockParamFloat _param_dist_1wp; struct mission_s _onboard_mission; struct mission_s _offboard_mission; int _current_onboard_mission_index; int _current_offboard_mission_index; + bool _need_takeoff; + bool _takeoff; orb_advert_t _mission_result_pub; struct mission_result_s _mission_result; @@ -172,6 +154,9 @@ private: MISSION_TYPE_OFFBOARD } _mission_type; + bool _inited; + bool _dist_1wp_ok; + MissionFeasibilityChecker missionFeasiblityChecker; /**< class that checks if a mission is feasible */ }; |