PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <mission_block.h>
Public Member Functions | |
MissionBlock (Navigator *navigator) | |
Constructor. More... | |
virtual | ~MissionBlock ()=default |
MissionBlock (const MissionBlock &)=delete | |
MissionBlock & | operator= (const MissionBlock &)=delete |
Public Member Functions inherited from NavigatorMode | |
NavigatorMode (Navigator *navigator) | |
virtual | ~NavigatorMode ()=default |
NavigatorMode (const NavigatorMode &)=delete | |
NavigatorMode | operator= (const NavigatorMode &)=delete |
void | run (bool active) |
virtual void | on_inactive () |
This function is called while the mode is inactive. More... | |
virtual void | on_activation () |
This function is called one time when mode becomes active, pos_sp_triplet must be initialized here. More... | |
virtual void | on_inactivation () |
This function is called one time when mode becomes inactive. More... | |
virtual void | on_active () |
This function is called while the mode is active. More... | |
Static Public Member Functions | |
static bool | item_contains_position (const mission_item_s &item) |
Protected Member Functions | |
bool | is_mission_item_reached () |
Check if mission item has been reached. More... | |
void | reset_mission_item_reached () |
Reset all reached flags. More... | |
bool | mission_item_to_position_setpoint (const mission_item_s &item, position_setpoint_s *sp) |
Convert a mission item to a position setpoint. More... | |
void | set_loiter_item (struct mission_item_s *item, float min_clearance=-1.0f) |
Set a loiter mission item, if possible reuse the position setpoint, otherwise take the current position. More... | |
void | set_takeoff_item (struct mission_item_s *item, float abs_altitude, float min_pitch=0.0f) |
Set a takeoff mission item. More... | |
void | set_land_item (struct mission_item_s *item, bool at_current_location) |
Set a land mission item. More... | |
void | set_idle_item (struct mission_item_s *item) |
Set idle mission item. More... | |
void | set_vtol_transition_item (struct mission_item_s *item, const uint8_t new_mode) |
Set vtol transition item. More... | |
void | mission_apply_limitation (mission_item_s &item) |
General function used to adjust the mission item based on vehicle specific limitations. More... | |
void | issue_command (const mission_item_s &item) |
float | get_time_inside (const mission_item_s &item) const |
float | get_absolute_altitude_for_item (const mission_item_s &mission_item) const |
Protected Attributes | |
mission_item_s | _mission_item {} |
bool | _waypoint_position_reached {false} |
bool | _waypoint_yaw_reached {false} |
bool | _waypoint_position_reached_previously {false} |
hrt_abstime | _time_first_inside_orbit {0} |
hrt_abstime | _action_start {0} |
hrt_abstime | _time_wp_reached {0} |
uORB::Publication< actuator_controls_s > | _actuator_pub {ORB_ID(actuator_controls_2)} |
Protected Attributes inherited from NavigatorMode | |
Navigator * | _navigator {nullptr} |
Definition at line 58 of file mission_block.h.
MissionBlock::MissionBlock | ( | Navigator * | navigator | ) |
Constructor.
Definition at line 59 of file mission_block.cpp.
References _mission_item, NavigatorMode::_navigator, mission_item_s::acceptance_radius, mission_item_s::autocontinue, Navigator::get_acceptance_radius(), Navigator::get_loiter_radius(), mission_item_s::lat, mission_item_s::loiter_radius, mission_item_s::lon, mission_item_s::origin, ORIGIN_ONBOARD, mission_item_s::time_inside, and mission_item_s::yaw.
|
virtualdefault |
|
delete |
|
protected |
Definition at line 748 of file mission_block.cpp.
References NavigatorMode::_navigator, home_position_s::alt, mission_item_s::altitude, mission_item_s::altitude_is_relative, and Navigator::get_home_position().
Referenced by Mission::altitude_sp_foh_update(), Mission::calculate_takeoff_altitude(), Mission::do_abort_landing(), Mission::index_closest_mission_item(), and mission_item_to_position_setpoint().
|
protected |
Definition at line 483 of file mission_block.cpp.
References NavigatorMode::_navigator, Navigator::get_vstatus(), math::max(), mission_item_s::nav_cmd, NAV_CMD_DELAY, NAV_CMD_LOITER_TIME_LIMIT, NAV_CMD_WAYPOINT, mission_item_s::time_inside, and vehicle_status_s::vehicle_type.
Referenced by is_mission_item_reached(), Mission::set_mission_items(), and RTL::set_rtl_item().
|
protected |
Check if mission item has been reached.
Definition at line 73 of file mission_block.cpp.
References _action_start, _mission_item, NavigatorMode::_navigator, _time_first_inside_orbit, _time_wp_reached, _waypoint_position_reached, _waypoint_position_reached_previously, _waypoint_yaw_reached, mission_item_s::acceptance_radius, home_position_s::alt, vehicle_global_position_s::alt, position_setpoint_s::alt, mission_item_s::altitude, mission_item_s::altitude_is_relative, math::constrain(), position_setpoint_triplet_s::current, f(), FLT_EPSILON, mission_item_s::force_heading, Navigator::get_acceptance_radius(), Navigator::get_altitude_acceptance_radius(), get_bearing_to_next_waypoint(), Navigator::get_default_altitude_acceptance_radius(), get_distance_to_next_waypoint(), get_distance_to_point_global_wgs84(), Navigator::get_global_position(), Navigator::get_home_position(), Navigator::get_land_detected(), Navigator::get_local_position(), Navigator::get_loiter_radius(), Navigator::get_position_setpoint_triplet(), get_time_inside(), Navigator::get_vstatus(), Navigator::get_vtol_back_trans_deceleration(), Navigator::get_vtol_reverse_delay(), Navigator::get_yaw_acceptance(), Navigator::get_yaw_threshold(), Navigator::get_yaw_timeout(), hrt_absolute_time(), hrt_abstime, vehicle_status_s::in_transition_mode, vehicle_land_detected_s::landed, vehicle_global_position_s::lat, position_setpoint_s::lat, mission_item_s::lat, position_setpoint_s::loiter_direction, mission_item_s::loiter_exit_xtrack, position_setpoint_s::loiter_radius, mission_item_s::loiter_radius, vehicle_global_position_s::lon, position_setpoint_s::lon, mission_item_s::lon, mission_item_s::nav_cmd, NAV_CMD_DELAY, NAV_CMD_DO_CHANGE_SPEED, NAV_CMD_DO_DIGICAM_CONTROL, NAV_CMD_DO_LAND_START, NAV_CMD_DO_MOUNT_CONFIGURE, NAV_CMD_DO_MOUNT_CONTROL, NAV_CMD_DO_SET_CAM_TRIGG_DIST, NAV_CMD_DO_SET_CAM_TRIGG_INTERVAL, NAV_CMD_DO_SET_HOME, NAV_CMD_DO_SET_ROI, NAV_CMD_DO_SET_ROI_LOCATION, NAV_CMD_DO_SET_ROI_NONE, NAV_CMD_DO_SET_ROI_WPNEXT_OFFSET, NAV_CMD_DO_SET_SERVO, NAV_CMD_DO_TRIGGER_CONTROL, NAV_CMD_DO_VTOL_TRANSITION, NAV_CMD_IDLE, NAV_CMD_IMAGE_START_CAPTURE, NAV_CMD_IMAGE_STOP_CAPTURE, NAV_CMD_LAND, NAV_CMD_LOITER_TIME_LIMIT, NAV_CMD_LOITER_TO_ALT, NAV_CMD_LOITER_UNLIMITED, NAV_CMD_SET_CAMERA_MODE, NAV_CMD_TAKEOFF, NAV_CMD_VIDEO_START_CAPTURE, NAV_CMD_VIDEO_STOP_CAPTURE, NAV_CMD_VTOL_LAND, NAV_CMD_VTOL_TAKEOFF, NAV_CMD_WAYPOINT, NAV_EPSILON_POSITION, position_setpoint_triplet_s::next, Navigator::set_mission_failure(), Navigator::set_position_setpoint_triplet_updated(), position_setpoint_s::type, position_setpoint_s::valid, vehicle_status_s::vehicle_type, VEHICLE_TYPE_FIXED_WING, vehicle_global_position_s::vel_e, vehicle_global_position_s::vel_n, velocity, mission_item_s::vtol_back_transition, vehicle_local_position_s::vx, vehicle_local_position_s::vy, waypoint_from_heading_and_distance(), matrix::wrap_pi(), vehicle_global_position_s::yaw, and mission_item_s::yaw.
Referenced by Takeoff::on_active(), EngineFailure::on_active(), RCLoss::on_active(), DataLinkLoss::on_active(), FollowTarget::on_active(), RTL::on_active(), and Mission::on_active().
|
protected |
Definition at line 429 of file mission_block.cpp.
References _action_start, _actuator_pub, NavigatorMode::_navigator, home_position_s::alt, mission_item_s::altitude, mission_item_s::altitude_is_relative, vehicle_command_s::command, actuator_controls_s::control, Navigator::get_home_position(), hrt_absolute_time(), item_contains_position(), mission_item_s::lat, mission_item_s::lon, mission_item_s::nav_cmd, NAV_CMD_DO_LAND_START, NAV_CMD_DO_SET_ROI_LOCATION, NAV_CMD_DO_SET_SERVO, vehicle_command_s::param1, vehicle_command_s::param2, vehicle_command_s::param3, vehicle_command_s::param4, vehicle_command_s::param5, vehicle_command_s::param6, vehicle_command_s::param7, mission_item_s::params, uORB::Publication< T >::publish(), Navigator::publish_vehicle_cmd(), and actuator_controls_s::timestamp.
Referenced by Mission::set_execution_mode(), Mission::set_mission_items(), and RTL::set_rtl_item().
|
static |
Definition at line 498 of file mission_block.cpp.
References mission_item_s::nav_cmd, NAV_CMD_DO_FOLLOW_REPOSITION, NAV_CMD_LAND, NAV_CMD_LOITER_TIME_LIMIT, NAV_CMD_LOITER_TO_ALT, NAV_CMD_LOITER_UNLIMITED, NAV_CMD_TAKEOFF, NAV_CMD_VTOL_LAND, NAV_CMD_VTOL_TAKEOFF, and NAV_CMD_WAYPOINT.
Referenced by Mission::advance_mission(), MissionFeasibilityChecker::checkDistancesBetweenWaypoints(), MissionFeasibilityChecker::checkDistanceToFirstWaypoint(), MissionFeasibilityChecker::checkFixedWingLanding(), MissionFeasibilityChecker::checkGeofence(), MissionFeasibilityChecker::checkHomePositionAltitude(), Mission::index_closest_mission_item(), issue_command(), mission_item_to_position_setpoint(), Mission::prepare_mission_items(), Mission::set_mission_items(), and RTL::set_rtl_item().
|
protected |
General function used to adjust the mission item based on vehicle specific limitations.
Definition at line 719 of file mission_block.cpp.
References NavigatorMode::_navigator, home_position_s::alt, vehicle_land_detected_s::alt_max, mission_item_s::altitude, mission_item_s::altitude_is_relative, Navigator::get_home_position(), and Navigator::get_land_detected().
Referenced by Mission::do_abort_landing(), Land::on_activation(), Takeoff::on_active(), EngineFailure::set_ef_item(), Loiter::set_loiter_position(), Mission::set_mission_items(), RCLoss::set_rcl_item(), RTL::set_rtl_item(), Takeoff::set_takeoff_position(), and FollowTarget::update_position_sp().
|
protected |
Convert a mission item to a position setpoint.
the | mission item to convert |
the | position setpoint that needs to be set |
Definition at line 512 of file mission_block.cpp.
References NavigatorMode::_navigator, position_setpoint_s::acceptance_radius, mission_item_s::acceptance_radius, vehicle_global_position_s::alt, home_position_s::alt, position_setpoint_s::alt, vehicle_status_s::arming_state, position_setpoint_s::cruising_speed, position_setpoint_s::cruising_throttle, get_absolute_altitude_for_item(), Navigator::get_cruising_speed(), Navigator::get_cruising_throttle(), Navigator::get_default_acceptance_radius(), Navigator::get_global_position(), Navigator::get_home_position(), Navigator::get_land_detected(), Navigator::get_loiter_min_alt(), Navigator::get_loiter_radius(), Navigator::get_vstatus(), hrt_absolute_time(), item_contains_position(), vehicle_land_detected_s::landed, position_setpoint_s::lat, mission_item_s::lat, position_setpoint_s::loiter_direction, position_setpoint_s::loiter_radius, mission_item_s::loiter_radius, position_setpoint_s::lon, mission_item_s::lon, math::max(), vehicle_land_detected_s::maybe_landed, mission_item_s::nav_cmd, NAV_CMD_IDLE, NAV_CMD_LAND, NAV_CMD_LOITER_TIME_LIMIT, NAV_CMD_LOITER_TO_ALT, NAV_CMD_LOITER_UNLIMITED, NAV_CMD_TAKEOFF, NAV_CMD_VTOL_LAND, NAV_CMD_VTOL_TAKEOFF, NAV_EPSILON_POSITION, position_setpoint_s::pitch_min, mission_item_s::pitch_min, position_setpoint_s::timestamp, position_setpoint_s::type, position_setpoint_s::valid, position_setpoint_s::yaw, mission_item_s::yaw, and position_setpoint_s::yaw_valid.
Referenced by Mission::do_abort_landing(), Land::on_activation(), Land::on_active(), Takeoff::on_active(), DataLinkLoss::set_dll_item(), EngineFailure::set_ef_item(), Loiter::set_loiter_position(), Mission::set_mission_items(), RCLoss::set_rcl_item(), RTL::set_rtl_item(), Takeoff::set_takeoff_position(), and FollowTarget::update_position_sp().
|
delete |
|
protected |
Reset all reached flags.
Definition at line 420 of file mission_block.cpp.
References _time_first_inside_orbit, _time_wp_reached, _waypoint_position_reached, and _waypoint_yaw_reached.
Referenced by DataLinkLoss::advance_dll(), RCLoss::advance_rcl(), Land::on_activation(), FollowTarget::reset_target_validity(), DataLinkLoss::set_dll_item(), EngineFailure::set_ef_item(), Mission::set_mission_item_reached(), Mission::set_mission_items(), RCLoss::set_rcl_item(), RTL::set_rtl_item(), and Takeoff::set_takeoff_position().
|
protected |
Set idle mission item.
Definition at line 694 of file mission_block.cpp.
References NavigatorMode::_navigator, mission_item_s::acceptance_radius, home_position_s::alt, mission_item_s::altitude, mission_item_s::altitude_is_relative, mission_item_s::autocontinue, Navigator::get_acceptance_radius(), Navigator::get_home_position(), Navigator::get_loiter_radius(), home_position_s::lat, mission_item_s::lat, mission_item_s::loiter_radius, home_position_s::lon, mission_item_s::lon, mission_item_s::nav_cmd, NAV_CMD_IDLE, mission_item_s::origin, ORIGIN_ONBOARD, mission_item_s::time_inside, and mission_item_s::yaw.
Referenced by Land::on_active(), and RTL::set_rtl_item().
|
protected |
Set a land mission item.
Definition at line 657 of file mission_block.cpp.
References NavigatorMode::_navigator, mission_item_s::acceptance_radius, mission_item_s::altitude, mission_item_s::altitude_is_relative, mission_item_s::autocontinue, vehicle_command_s::command, Navigator::force_vtol(), Navigator::get_acceptance_radius(), Navigator::get_home_position(), Navigator::get_local_position(), Navigator::get_loiter_radius(), home_position_s::lat, mission_item_s::lat, mission_item_s::loiter_radius, home_position_s::lon, mission_item_s::lon, mission_item_s::nav_cmd, NAV_CMD_DO_VTOL_TRANSITION, NAV_CMD_LAND, mission_item_s::origin, ORIGIN_ONBOARD, vehicle_command_s::param1, Navigator::publish_vehicle_cmd(), mission_item_s::time_inside, home_position_s::yaw, vehicle_local_position_s::yaw, and mission_item_s::yaw.
Referenced by Land::on_activation().
|
protected |
Set a loiter mission item, if possible reuse the position setpoint, otherwise take the current position.
Definition at line 599 of file mission_block.cpp.
References NavigatorMode::_navigator, mission_item_s::acceptance_radius, vehicle_global_position_s::alt, home_position_s::alt, position_setpoint_s::alt, mission_item_s::altitude, mission_item_s::altitude_is_relative, mission_item_s::autocontinue, position_setpoint_triplet_s::current, f(), Navigator::get_acceptance_radius(), Navigator::get_can_loiter_at_sp(), Navigator::get_global_position(), Navigator::get_home_position(), Navigator::get_land_detected(), Navigator::get_loiter_radius(), Navigator::get_position_setpoint_triplet(), vehicle_land_detected_s::landed, vehicle_global_position_s::lat, position_setpoint_s::lat, mission_item_s::lat, mission_item_s::loiter_radius, vehicle_global_position_s::lon, position_setpoint_s::lon, mission_item_s::lon, mission_item_s::nav_cmd, NAV_CMD_IDLE, NAV_CMD_LOITER_UNLIMITED, mission_item_s::origin, ORIGIN_ONBOARD, mission_item_s::time_inside, position_setpoint_s::valid, and mission_item_s::yaw.
Referenced by Takeoff::on_active(), Loiter::set_loiter_position(), and Mission::set_mission_items().
|
protected |
Set a takeoff mission item.
Definition at line 638 of file mission_block.cpp.
References NavigatorMode::_navigator, mission_item_s::altitude, mission_item_s::altitude_is_relative, mission_item_s::autocontinue, Navigator::get_global_position(), Navigator::get_loiter_radius(), vehicle_global_position_s::lat, mission_item_s::lat, mission_item_s::loiter_radius, vehicle_global_position_s::lon, mission_item_s::lon, mission_item_s::nav_cmd, NAV_CMD_TAKEOFF, mission_item_s::origin, ORIGIN_ONBOARD, mission_item_s::pitch_min, vehicle_global_position_s::yaw, and mission_item_s::yaw.
Referenced by Takeoff::set_takeoff_position().
|
protected |
Set vtol transition item.
Definition at line 710 of file mission_block.cpp.
References NavigatorMode::_navigator, mission_item_s::autocontinue, Navigator::get_global_position(), mission_item_s::nav_cmd, NAV_CMD_DO_VTOL_TRANSITION, mission_item_s::params, vehicle_global_position_s::yaw, and mission_item_s::yaw.
Referenced by Mission::set_execution_mode(), Mission::set_mission_items(), and RTL::set_rtl_item().
|
protected |
Definition at line 135 of file mission_block.h.
Referenced by is_mission_item_reached(), and issue_command().
|
protected |
Definition at line 138 of file mission_block.h.
Referenced by issue_command().
|
protected |
Definition at line 128 of file mission_block.h.
Referenced by Mission::altitude_sp_foh_update(), Mission::do_abort_landing(), Mission::do_need_move_to_land(), Mission::do_need_move_to_takeoff(), Mission::do_need_vertical_takeoff(), Mission::heading_sp_update(), is_mission_item_reached(), MissionBlock(), Land::on_activation(), Land::on_active(), Takeoff::on_active(), FollowTarget::on_active(), Mission::on_active(), DataLinkLoss::set_dll_item(), EngineFailure::set_ef_item(), Mission::set_execution_mode(), Loiter::set_loiter_position(), Mission::set_mission_items(), RCLoss::set_rcl_item(), RTL::set_rtl_item(), Takeoff::set_takeoff_position(), and FollowTarget::update_position_sp().
|
protected |
Definition at line 134 of file mission_block.h.
Referenced by is_mission_item_reached(), and reset_mission_item_reached().
|
protected |
Definition at line 136 of file mission_block.h.
Referenced by is_mission_item_reached(), and reset_mission_item_reached().
|
protected |
Definition at line 130 of file mission_block.h.
Referenced by is_mission_item_reached(), Mission::on_active(), and reset_mission_item_reached().
|
protected |
Definition at line 132 of file mission_block.h.
Referenced by is_mission_item_reached().
|
protected |
Definition at line 131 of file mission_block.h.
Referenced by is_mission_item_reached(), and reset_mission_item_reached().