56 #include <uORB/topics/home_position.h> 57 #include <uORB/topics/mission.h> 58 #include <uORB/topics/mission_result.h> 59 #include <uORB/topics/position_setpoint_triplet.h> 60 #include <uORB/topics/vehicle_global_position.h> 61 #include <uORB/topics/vehicle_status.h> 62 #include <uORB/topics/vehicle_roi.h> 78 enum mission_altitude_mode {
79 MISSION_ALTMODE_ZOH = 0,
80 MISSION_ALTMODE_FOH = 1
83 bool set_current_mission_index(uint16_t index);
88 uint16_t get_land_start_index()
const {
return _land_start_index; }
89 bool get_land_start_available()
const {
return _land_start_available; }
90 bool get_mission_finished()
const {
return _mission_type == MISSION_TYPE_NONE; }
91 bool get_mission_changed()
const {
return _mission_changed ; }
92 bool get_mission_waypoints_changed()
const {
return _mission_waypoints_changed ; }
94 void set_closest_item_as_current();
107 void update_mission();
112 void advance_mission();
117 void set_mission_items();
122 bool do_need_vertical_takeoff();
127 bool do_need_move_to_land();
132 bool do_need_move_to_takeoff();
137 void copy_position_if_valid(
struct mission_item_s *mission_item,
struct position_setpoint_s *setpoint);
147 float calculate_takeoff_altitude(
struct mission_item_s *mission_item);
152 void heading_sp_update();
157 void altitude_sp_foh_update();
162 void cruising_speed_sp_update();
167 void do_abort_landing();
176 mission_item_s *next_position_mission_item,
bool *has_next_position_item);
184 bool read_mission_item(
int offset,
struct mission_item_s *mission_item);
189 void save_mission_state();
194 void report_do_jump_mission_changed(
int index,
int do_jumps_remaining);
199 void set_mission_item_reached();
204 void set_current_mission_item();
209 void check_mission_valid(
bool force);
214 void reset_mission(
struct mission_s &mission);
219 bool need_to_reset_mission(
bool active);
224 void generate_waypoint_from_heading(
struct position_setpoint_s *setpoint,
float yaw);
229 bool find_mission_land_start();
234 int32_t index_closest_mission_item()
const;
236 bool position_setpoint_equal(
const position_setpoint_s *p1,
const position_setpoint_s *p2)
const;
245 struct mission_s _mission {};
247 int32_t _current_mission_index{-1};
250 bool _land_start_available{
false};
251 uint16_t _land_start_index{UINT16_MAX};
253 bool _need_takeoff{
true};
258 } _mission_type{MISSION_TYPE_NONE};
261 bool _home_inited{
false};
262 bool _need_mission_reset{
false};
263 bool _mission_waypoints_changed{
false};
264 bool _mission_changed{
false};
266 float _min_current_sp_distance_xy{FLT_MAX};
268 float _distance_current_previous{0.0f};
271 enum work_item_type {
272 WORK_ITEM_TYPE_DEFAULT,
273 WORK_ITEM_TYPE_TAKEOFF,
274 WORK_ITEM_TYPE_MOVE_TO_LAND,
275 WORK_ITEM_TYPE_ALIGN,
276 WORK_ITEM_TYPE_CMD_BEFORE_MOVE,
277 WORK_ITEM_TYPE_TRANSITON_AFTER_TAKEOFF,
278 WORK_ITEM_TYPE_MOVE_TO_LAND_AFTER_TRANSITION,
279 WORK_ITEM_TYPE_PRECISION_LAND
280 } _work_item_type{WORK_ITEM_TYPE_DEFAULT};
282 uint8_t _mission_execution_mode{mission_result_s::MISSION_EXECUTION_MODE_NORMAL};
283 bool _execution_mode_changed{
false};
Global position setpoint in WGS84 coordinates.
Definition: navigation.h:145
void on_inactive() override
This function is called while the mode is inactive.
Definition: mission.cpp:69
Definition: px4_param.h:313
void on_active() override
This function is called while the mode is active.
Definition: mission.cpp:178
Helper class to use mission items.
Definition: mission_block.h:56
Definition: navigator_main.cpp:80
High-resolution timer with callouts and timekeeping.
Provides checks if mission is feasible given the navigation capabilities.
API for the uORB lightweight object broker.
Definition: px4_param.h:318
C++ base class for modules/classes using configuration parameters.
Definition: px4_module_params.h:46
void on_activation() override
This function is called one time when mode becomes active, pos_sp_triplet must be initialized here...
Definition: mission.cpp:152
void on_inactivation() override
This function is called one time when mode becomes inactive.
Definition: mission.cpp:140
Definition: navigator.h:83
Base class for different modes in navigator.
void set_execution_mode(const uint8_t mode)
Set a new mission mode and handle the switching between the different modes.
Definition: mission.cpp:316