Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
common_nav.c File Reference
#include "subsystems/navigation/common_nav.h"
#include "generated/flight_plan.h"
#include "subsystems/ins.h"
#include "math/pprz_geodetic_float.h"
+ Include dependency graph for common_nav.c:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void compute_dist2_to_home (void)
 Computes squared distance to the HOME waypoint. More...
 
float get_time_to_home (void)
 Compute time to home use wind and airspeed when available. More...
 
void nav_reset_utm_zone (void)
 Reset the UTM zone to current GPS fix. More...
 
void nav_reset_reference (void)
 Reset the geographic reference to the current GPS fix. More...
 
void nav_reset_alt (void)
 Reset the altitude reference to the current GPS alt. More...
 
void nav_update_waypoints_alt (void)
 Shift altitude of the waypoint according to a new ground altitude. More...
 
void common_nav_periodic_task_4Hz ()
 
void nav_move_waypoint (uint8_t wp_id, float ux, float uy, float alt)
 Move a waypoint to given UTM coordinates. More...
 

Variables

float dist2_to_home
 squared distance to home waypoint More...
 
float dist2_to_wp
 squared distance to next waypoint More...
 
bool too_far_from_home
 
const uint8_t nb_waypoint = NB_WAYPOINT
 
struct point waypoints [NB_WAYPOINT] = WAYPOINTS_UTM
 size == nb_waypoint, waypoint 0 is a dummy waypoint More...
 
float ground_alt
 size == nb_waypoint, waypoint 0 is a dummy waypoint More...
 
int32_t nav_utm_east0 = NAV_UTM_EAST0
 
int32_t nav_utm_north0 = NAV_UTM_NORTH0
 
uint8_t nav_utm_zone0 = NAV_UTM_ZONE0
 
float max_dist_from_home = MAX_DIST_FROM_HOME
 
static float previous_ground_alt
 

Function Documentation

void common_nav_periodic_task_4Hz ( void  )

Definition at line 152 of file common_nav.c.

References block_time, and stage_time.

Referenced by navigation_task().

+ Here is the caller graph for this function:

void compute_dist2_to_home ( void  )

Computes squared distance to the HOME waypoint.

Computes squared distance to the HOME waypoint potentially sets too_far_from_home.

Updates dist2_to_home and potentially sets too_far_from_home

Definition at line 50 of file common_nav.c.

References dist2_to_home, get_dist2_to_waypoint(), max_dist2_from_home, stateGetPositionEnu_f(), too_far_from_home, point::x, EnuCoor_f::x, point::y, and EnuCoor_f::y.

+ Here is the call graph for this function:

float get_time_to_home ( void  )

Compute time to home use wind and airspeed when available.

Definition at line 65 of file common_nav.c.

References float_vect2_norm(), stateGetAirspeed_f(), stateGetHorizontalWindspeed_f(), stateGetPositionEnu_f(), stateIsAirspeedValid(), stateIsWindspeedValid(), point::x, FloatVect2::x, EnuCoor_f::x, point::y, FloatVect2::y, and EnuCoor_f::y.

+ Here is the call graph for this function:

void nav_move_waypoint ( uint8_t  wp_id,
float  ux,
float  uy,
float  alt 
)

Move a waypoint to given UTM coordinates.

Parameters
[in]wp_idWaypoint ID
[in]uxUTM x (east) coordinate
[in]uyUTM y (north) coordinate
[in]altAltitude above MSL.

Definition at line 163 of file common_nav.c.

References point::a, UtmCoor_f::alt, max_dist_from_home, nav_utm_east0, nav_utm_north0, nb_waypoint, point::x, and point::y.

Referenced by firmware_parse_msg().

+ Here is the caller graph for this function:

void nav_reset_alt ( void  )

Reset the altitude reference to the current GPS alt.

Definition at line 134 of file common_nav.c.

References UtmCoor_f::alt, ground_alt, ins_reset_altitude_ref(), previous_ground_alt, state, State::utm_origin_f, and waypoints_localize_all().

+ Here is the call graph for this function:

void nav_reset_reference ( void  )

Reset the geographic reference to the current GPS fix.

Definition at line 118 of file common_nav.c.

References UtmCoor_f::alt, UtmCoor_f::east, ground_alt, ins_reset_local_origin(), nav_utm_east0, nav_utm_north0, nav_utm_zone0, UtmCoor_f::north, previous_ground_alt, state, State::utm_origin_f, waypoints_localize_all(), and UtmCoor_f::zone.

+ Here is the call graph for this function:

void nav_reset_utm_zone ( void  )

Reset the UTM zone to current GPS fix.

Definition at line 101 of file common_nav.c.

References UtmCoor_f::alt, UtmCoor_f::east, ground_alt, ins_reset_utm_zone(), nav_utm_east0, nav_utm_north0, nav_utm_zone0, UtmCoor_f::north, and UtmCoor_f::zone.

+ Here is the call graph for this function:

void nav_update_waypoints_alt ( void  )

Shift altitude of the waypoint according to a new ground altitude.

Definition at line 144 of file common_nav.c.

References point::a, ground_alt, and previous_ground_alt.

Variable Documentation

float dist2_to_home

squared distance to home waypoint

Definition at line 32 of file common_nav.c.

Referenced by compute_dist2_to_home().

float dist2_to_wp

squared distance to next waypoint

Definition at line 33 of file common_nav.c.

float max_dist_from_home = MAX_DIST_FROM_HOME

Definition at line 45 of file common_nav.c.

Referenced by nav_move_waypoint().

const uint8_t nb_waypoint = NB_WAYPOINT
float previous_ground_alt
static

Definition at line 98 of file common_nav.c.

Referenced by nav_reset_alt(), nav_reset_reference(), and nav_update_waypoints_alt().

bool too_far_from_home

Definition at line 35 of file common_nav.c.

Referenced by compute_dist2_to_home().

struct point waypoints[NB_WAYPOINT] = WAYPOINTS_UTM

size == nb_waypoint, waypoint 0 is a dummy waypoint

Definition at line 38 of file common_nav.c.

Referenced by collective_tracking_waypoint(), copilot_parse_move_wp_dl(), distributed_circular(), DownlinkSendWp(), firmware_parse_msg(), get_dist2_to_waypoint(), get_two_intersects(), gvf_ellipse_wp(), gvf_get_two_intersects(), gvf_line_wp1_wp2(), gvf_line_wp_heading(), gvf_nav_survey_polygon_setup(), gvf_segment_loop_wp1_wp2(), gvf_segment_wp1_wp2(), gvf_sin_wp1_wp2(), gvf_sin_wp_alpha(), mission_point_of_lla(), nav_compute_baseleg(), nav_compute_final_from_glide(), nav_cube_run(), nav_cube_setup(), nav_eight(), nav_flower_run(), nav_glide(), nav_home(), nav_init(), nav_line_border_run(), nav_line_osam_run(), nav_line_run(), nav_oval(), nav_skid_landing_glide(), nav_skid_landing_run(), nav_skid_landing_setup(), nav_spiral_setup(), nav_survey_computefourth_corner(), nav_survey_disc_run(), nav_survey_losange_carto(), nav_survey_losange_carto_init(), nav_survey_poly_osam_run(), nav_survey_poly_osam_setup(), nav_survey_poly_osam_setup_towards(), nav_survey_poly_run(), nav_survey_poly_setup(), nav_survey_poly_setup_towards(), nav_survey_polygon_setup(), nav_survey_rectangle(), nav_survey_rectangle_rotorcraft_run(), nav_survey_rectangle_rotorcraft_setup(), nav_survey_zamboni_setup(), nav_vertical_raster_run(), NavApproaching(), NavApproachingFrom(), NavCircleWaypoint(), NavGlide(), NavGotoWaypoint(), NavGotoWaypointHeading(), navigation_update_wp_from_speed(), NavSegment(), Oval(), put_lat_lon_home(), rotorcraft_cam_periodic(), send_wp_moved(), and vPoint().