61 #include <px4_platform_common/module.h> 62 #include <px4_platform_common/module_params.h> 86 #define NAVIGATOR_MODE_ARRAY_SIZE 11 89 class Navigator :
public ModuleBase<Navigator>,
public ModuleParams
108 static int print_usage(
const char *reason =
nullptr);
133 void fake_traffic(
const char *callsign,
float distance,
float direction,
float traffic_heading,
float altitude_diff,
134 float hor_velocity,
float ver_velocity);
298 (ParamFloat<px4::params::NAV_LOITER_RAD>) _param_nav_loiter_rad,
299 (ParamFloat<px4::params::NAV_ACC_RAD>) _param_nav_acc_rad,
300 (ParamFloat<px4::params::NAV_FW_ALT_RAD>)
301 _param_nav_fw_alt_rad,
302 (ParamFloat<px4::params::NAV_FW_ALTL_RAD>)
303 _param_nav_fw_altl_rad,
304 (ParamFloat<px4::params::NAV_MC_ALT_RAD>)
305 _param_nav_mc_alt_rad,
306 (ParamInt<px4::params::NAV_FORCE_VT>) _param_nav_force_vt,
307 (ParamInt<px4::params::NAV_TRAFF_AVOID>) _param_nav_traff_avoid,
311 (ParamFloat<px4::params::MIS_LTRMIN_ALT>) _param_mis_ltrmin_alt,
312 (ParamFloat<px4::params::MIS_TAKEOFF_ALT>) _param_mis_takeoff_alt,
313 (ParamBool<px4::params::MIS_TAKEOFF_REQ>) _param_mis_takeoff_req,
314 (ParamFloat<px4::params::MIS_YAW_TMT>) _param_mis_yaw_tmt,
315 (ParamFloat<px4::params::MIS_YAW_ERR>) _param_mis_yaw_err
318 int _local_pos_sub{-1};
position_setpoint_triplet_s _pos_sp_triplet
triplet of position setpoints
#define PARAM_INVALID
Handle returned when a parameter cannot be found.
geofence_result_s _geofence_result
uORB::Subscription _home_pos_sub
home position subscription
uORB::SubscriptionData< position_controller_status_s > _position_controller_status_sub
bool home_position_valid()
uORB::PublicationQueued< vehicle_command_s > _vehicle_cmd_pub
uORB::Subscription _vehicle_command_sub
vehicle commands (onboard and offboard)
void publish_position_setpoint_triplet()
Publish a new position setpoint triplet for position controllers.
Land _land
class for handling land commands
orb_advert_t _mavlink_log_pub
the uORB advert to send messages over mavlink
float get_default_altitude_acceptance_radius()
Get the default altitude acceptance radius (i.e.
vehicle_gps_position_s _gps_pos
gps position
Definition of a mission consisting of mission items.
Helper class to do precision landing with a landing target.
bool get_mission_start_land_available()
NavigatorMode * _navigation_mode_array[NAVIGATOR_MODE_ARRAY_SIZE]
array of navigation modes
float get_acceptance_radius()
Get the acceptance radius.
API for the uORB lightweight object broker.
#define NAVIGATOR_MODE_ARRAY_SIZE
Number of navigation modes that need on_active/on_inactive calls.
bool is_planned_mission() const
vehicle_local_position_s _local_pos
local vehicle position
float get_loiter_min_alt() const
Helper class to land at the current position.
static int custom_command(int argc, char *argv[])
float get_vtol_back_trans_deceleration() const
bool _geofence_violation_warning_sent
prevents spaming to mavlink
vehicle_global_position_s _global_pos
global vehicle position
void increment_mission_instance_count()
float get_cruising_throttle()
Get the target throttle.
uORB::Subscription _global_pos_sub
global position subscription
param_t _handle_back_trans_dec_mss
struct home_position_s * get_home_position()
Getters.
int print_status() override
double get_mission_landing_lon()
NavigatorMode * _navigation_mode
abstract pointer to current navigation mode class
Navigator operator=(const Navigator &)=delete
struct position_setpoint_triplet_s * get_takeoff_triplet()
bool _pos_sp_triplet_updated
flags if position SP triplet needs to be published
float _param_reverse_delay
uORB::Subscription _pos_ctrl_landing_status_sub
position controller landing status subscription
struct vehicle_land_detected_s * get_land_detected()
home_position_s _home_pos
home position for RTL
float get_yaw_timeout() const
Helper class for Data Link Loss Mode acording to the OBC rules.
bool get_can_loiter_at_sp()
vehicle_roi_s _vroi
vehicle ROI
mission_result_s _mission_result
GpsFailure _gpsFailure
class that handles the OBC gpsfailure loss mode
Geofence _geofence
class that handles the geofence
vehicle_land_detected_s _land_detected
vehicle land_detected
perf_counter_t _loop_perf
loop performance counter
bool mission_landing_required()
Provides functions for handling the geofence.
double get_mission_landing_lat()
bool get_takeoff_required() const
int _vehicle_status_sub
local position subscription
Geofence & get_geofence()
uORB::Publication< mission_result_s > _mission_result_pub
const vehicle_roi_s & get_vroi()
void reset_cruising_speed()
Reset cruising speed to default values.
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
uint16_t get_land_start_index() const
void check_traffic()
Check nearby traffic for potential collisions.
void publish_vehicle_command_ack(const vehicle_command_s &cmd, uint8_t result)
void reset_triplets()
Set triplets to invalid.
bool _mission_result_updated
flags if mission result has seen an update
PrecLand _precland
class for handling precision land commands
struct vehicle_global_position_s * get_global_position()
uORB::Publication< vehicle_roi_s > _vehicle_roi_pub
float get_cruising_speed()
Get the cruising speed.
uORB::Subscription _gps_pos_sub
gps position subscription
constexpr T radians(T degrees)
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
bool in_rtl_state() const
Helper class for RC Loss Mode acording to the OBC rules.
uint8_t _previous_nav_state
nav_state of the previous iteration
static int print_usage(const char *reason=nullptr)
EngineFailure _engineFailure
class that handles the engine failure mode (FW only!)
static Navigator * instantiate(int argc, char *argv[])
vehicle_status_s _vstatus
vehicle status
PrecLand * get_precland()
allow others, e.g.
Helper class for a fixedwing engine failure mode.
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
RCLoss _rcLoss
class that handles RTL according to OBC rules (rc loss mode)
bool get_land_start_available() const
Mission _mission
class that handles the missions
position_setpoint_triplet_s _takeoff_triplet
triplet for non-mission direct takeoff command
FollowTarget _follow_target
uORB::Subscription _parameter_update_sub
param update subscription
Helper class to take off.
uORB::Subscription _traffic_sub
traffic subscription
struct position_setpoint_triplet_s * get_position_setpoint_triplet()
uORB::PublicationQueued< vehicle_command_ack_s > _vehicle_cmd_ack_pub
DataLinkLoss _dataLinkLoss
class that handles the OBC datalink loss mode
param_t _handle_reverse_delay
struct mission_result_s * get_mission_result()
float _mission_cruising_speed_fw
void set_cruising_throttle(float throttle=-1.0f)
Set the target throttle.
static int task_spawn(int argc, char *argv[])
Base class for different modes in navigator.
bool start_mission_landing()
Helper class for Data Link Loss Mode according to the OBC rules.
void load_fence_from_file(const char *filename)
Load fence from file.
void publish_vehicle_cmd(vehicle_command_s *vcmd)
float get_loiter_radius()
Takeoff _takeoff
class for handling takeoff commands
float get_default_acceptance_radius()
Returns the default acceptance radius defined by the parameter.
float get_yaw_acceptance(float mission_item_yaw)
Get the yaw acceptance given the current mission item.
DEFINE_PARAMETERS((ParamFloat< px4::params::NAV_LOITER_RAD >) _param_nav_loiter_rad,(ParamFloat< px4::params::NAV_ACC_RAD >) _param_nav_acc_rad,(ParamFloat< px4::params::NAV_FW_ALT_RAD >) _param_nav_fw_alt_rad,(ParamFloat< px4::params::NAV_FW_ALTL_RAD >) _param_nav_fw_altl_rad,(ParamFloat< px4::params::NAV_MC_ALT_RAD >) _param_nav_mc_alt_rad,(ParamInt< px4::params::NAV_FORCE_VT >) _param_nav_force_vt,(ParamInt< px4::params::NAV_TRAFF_AVOID >) _param_nav_traff_avoid,(ParamFloat< px4::params::MIS_LTRMIN_ALT >) _param_mis_ltrmin_alt,(ParamFloat< px4::params::MIS_TAKEOFF_ALT >) _param_mis_takeoff_alt,(ParamBool< px4::params::MIS_TAKEOFF_REQ >) _param_mis_takeoff_req,(ParamFloat< px4::params::MIS_YAW_TMT >) _param_mis_yaw_tmt,(ParamFloat< px4::params::MIS_YAW_ERR >) _param_mis_yaw_err) int _local_pos_sub
RTL _rtl
class that handles RTL
struct position_setpoint_triplet_s * get_reposition_triplet()
bool on_mission_landing()
bool _pos_sp_triplet_published_invalid_once
flags if position SP triplet has been published once to UORB
orb_advert_t * get_mavlink_log_pub()
uORB::Subscription _land_detected_sub
vehicle land detected subscription
float get_mission_landing_alt()
struct vehicle_status_s * get_vstatus()
void set_mission_result_updated()
float get_takeoff_min_alt() const
uORB::Publication< geofence_result_s > _geofence_result_pub
float _param_back_trans_dec_mss
Loiter _loiter
class that handles loiter
float _mission_cruising_speed_mc
int get_mission_landing_index()
void set_can_loiter_at_sp(bool can_loiter)
Setters.
void set_mission_failure(const char *reason)
void set_position_setpoint_triplet_updated()
void fake_traffic(const char *callsign, float distance, float direction, float traffic_heading, float altitude_diff, float hor_velocity, float ver_velocity)
Generate an artificial traffic indication.
void publish_mission_result()
Publish the mission result so commander and mavlink know what is going on.
bool _can_loiter_at_sp
flags if current position SP can be used to loiter
position_setpoint_triplet_s _reposition_triplet
triplet for non-mission direct position command
float get_altitude_acceptance_radius()
Get the altitude acceptance radius.
float get_yaw_threshold() const
uORB::Publication< position_setpoint_triplet_s > _pos_sp_triplet_pub
uint32_t param_t
Parameter handle.
struct vehicle_local_position_s * get_local_position()
float get_vtol_reverse_delay() const
void set_cruising_speed(float speed=-1.0f)
Set the cruising speed.
Performance measuring tools.