Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
common_nav.h File Reference
#include "std.h"
#include "state.h"
#include "modules/nav/common_flight_plan.h"
+ Include dependency graph for common_nav.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  point
 

Macros

#define WaypointX(_wp)   (waypoints[_wp].x)
 
#define WaypointY(_wp)   (waypoints[_wp].y)
 
#define WaypointAlt(_wp)   (waypoints[_wp].a)
 waypoint altitude in m above MSL More...
 
#define Height(_h)   (_h + ground_alt)
 
#define NavSetGroundReferenceHere()   ({ nav_reset_reference(); nav_update_waypoints_alt(); false; })
 
#define NavSetAltitudeReferenceHere()   ({ nav_reset_alt(); nav_update_waypoints_alt(); false; })
 
#define NavSetWaypointHere(_wp)
 
#define NavSetWaypointPosAndAltHere(_wp)
 

Functions

void nav_move_waypoint (uint8_t wp_id, float utm_east, float utm_north, float alt)
 Move a waypoint to given UTM coordinates. More...
 
void nav_move_waypoint_enu (uint8_t wp_id, float x, float y, float alt)
 Move a waypoint in local frame. More...
 
void nav_move_waypoint_point (uint8_t wp_id, struct point *p)
 Move a waypoint from point structure (local frame). More...
 
void nav_send_waypoint (uint8_t wp_id)
 Send a waypoint throught default telemetry channel. More...
 
void compute_dist2_to_home (void)
 Computes squared distance to the HOME waypoint potentially sets too_far_from_home. 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 (void)
 
float get_time_to_home (void)
 Compute time to home use wind and airspeed when available. More...
 

Variables

float max_dist_from_home
 
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
 
struct point waypoints []
 
float ground_alt
 size == nb_waypoint, waypoint 0 is a dummy waypoint More...
 
int32_t nav_utm_east0
 
int32_t nav_utm_north0
 
uint8_t nav_utm_zone0
 

Data Structure Documentation

◆ point

struct point

Definition at line 39 of file common_nav.h.

Data Fields
float a
float x
float y

Macro Definition Documentation

◆ Height

#define Height (   _h)    (_h + ground_alt)

Definition at line 49 of file common_nav.h.

◆ NavSetAltitudeReferenceHere

#define NavSetAltitudeReferenceHere ( )    ({ nav_reset_alt(); nav_update_waypoints_alt(); false; })

Definition at line 79 of file common_nav.h.

◆ NavSetGroundReferenceHere

#define NavSetGroundReferenceHere ( )    ({ nav_reset_reference(); nav_update_waypoints_alt(); false; })

Definition at line 77 of file common_nav.h.

◆ NavSetWaypointHere

#define NavSetWaypointHere (   _wp)
Value:
({ \
waypoints[_wp].x = stateGetPositionEnu_f()->x; \
waypoints[_wp].y = stateGetPositionEnu_f()->y; \
false; \
})

Definition at line 81 of file common_nav.h.

◆ NavSetWaypointPosAndAltHere

#define NavSetWaypointPosAndAltHere (   _wp)
Value:
({ \
waypoints[_wp].x = stateGetPositionEnu_f()->x; \
waypoints[_wp].y = stateGetPositionEnu_f()->y; \
waypoints[_wp].a = stateGetPositionEnu_f()->z + ground_alt; \
false; \
})

Definition at line 87 of file common_nav.h.

◆ WaypointAlt

#define WaypointAlt (   _wp)    (waypoints[_wp].a)

waypoint altitude in m above MSL

Definition at line 48 of file common_nav.h.

◆ WaypointX

#define WaypointX (   _wp)    (waypoints[_wp].x)

Definition at line 45 of file common_nav.h.

◆ WaypointY

#define WaypointY (   _wp)    (waypoints[_wp].y)

Definition at line 46 of file common_nav.h.

Function Documentation

◆ common_nav_periodic_task()

void common_nav_periodic_task ( void  )

Definition at line 153 of file common_nav.c.

References block_time, NAVIGATION_FREQUENCY, and stage_time.

Referenced by navigation_task().

+ Here is the caller graph for this function:

◆ compute_dist2_to_home()

void compute_dist2_to_home ( void  )

Computes squared distance to the HOME waypoint potentially sets too_far_from_home.

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 483 of file navigation.c.

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

Referenced by autopilot_static_periodic(), nav_home(), and nav_periodic_task().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_time_to_home()

float get_time_to_home ( void  )

Compute time to home use wind and airspeed when available.

Definition at line 66 of file common_nav.c.

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

+ Here is the call graph for this function:

◆ nav_move_waypoint()

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 164 of file common_nav.c.

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

Referenced by nav_parse_MOVE_WP().

+ Here is the caller graph for this function:

◆ nav_move_waypoint_enu()

void nav_move_waypoint_enu ( uint8_t  wp_id,
float  x,
float  y,
float  alt 
)

Move a waypoint in local frame.

Parameters
[in]wp_idWaypoint ID
[in]uxx (east) coordinate
[in]uyy (north) coordinate
[in]altAltitude above MSL.

Definition at line 184 of file common_nav.c.

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

Referenced by nav_lace_run(), nav_move_waypoint_point(), nav_rosette_run(), and nav_trinity_run().

+ Here is the caller graph for this function:

◆ nav_move_waypoint_point()

void nav_move_waypoint_point ( uint8_t  wp_id,
struct point p 
)

Move a waypoint from point structure (local frame).

Parameters
[in]wp_idWaypoint ID
[in]pnew point

Definition at line 202 of file common_nav.c.

References nav_move_waypoint_enu(), and p.

Referenced by cloud_sim_move(), and cloud_sim_reset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nav_reset_alt()

void nav_reset_alt ( void  )

Reset the altitude reference to the current GPS alt.

Definition at line 389 of file navigation.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:

◆ nav_reset_reference()

void nav_reset_reference ( void  )

Reset the geographic reference to the current GPS fix.

Definition at line 382 of file navigation.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:

◆ nav_reset_utm_zone()

void nav_reset_utm_zone ( void  )

Reset the UTM zone to current GPS fix.

Definition at line 102 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:

◆ nav_send_waypoint()

void nav_send_waypoint ( uint8_t  wp_id)

Send a waypoint throught default telemetry channel.

Parameters
[in]wp_idWaypoint ID

Definition at line 210 of file common_nav.c.

References point::a, UtmCoor_f::alt, DefaultChannel, DefaultDevice, UtmCoor_f::east, nav_utm_east0, nav_utm_north0, nav_utm_zone0, nb_waypoint, UtmCoor_f::north, waypoints, point::x, point::y, and UtmCoor_f::zone.

Referenced by cloud_sim_move(), cloud_sim_reset(), nav_lace_run(), nav_rosette_run(), and nav_trinity_run().

+ Here is the caller graph for this function:

◆ nav_update_waypoints_alt()

void nav_update_waypoints_alt ( void  )

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

Definition at line 145 of file common_nav.c.

References point::a, ground_alt, previous_ground_alt, and waypoints.

Variable Documentation

◆ dist2_to_home

float dist2_to_home

squared distance to home waypoint

Definition at line 91 of file navigation.c.

Referenced by autopilot_static_periodic(), compute_dist2_to_home(), monitor_task(), nav_home(), nav_init(), and send_nav_status().

◆ dist2_to_wp

float dist2_to_wp

squared distance to next waypoint

Definition at line 94 of file navigation.c.

Referenced by nav_approaching_xy(), nav_circle(), nav_home(), nav_init(), nav_periodic_task(), nav_route(), and send_nav_status().

◆ ground_alt

◆ max_dist_from_home

float max_dist_from_home

Definition at line 88 of file navigation.c.

Referenced by mission_point_of_lla(), nav_move_waypoint(), and nav_move_waypoint_enu().

◆ nav_utm_east0

◆ nav_utm_north0

◆ nav_utm_zone0

◆ nb_waypoint

const uint8_t nb_waypoint

Definition at line 38 of file common_nav.c.

◆ too_far_from_home

◆ waypoints

struct point waypoints[]

Definition at line 39 of file common_nav.c.

stateGetPositionEnu_f
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
Definition: state.h:719
EnuCoor_f::y
float y
in meters
Definition: pprz_geodetic_float.h:74
EnuCoor_f::z
float z
in meters
Definition: pprz_geodetic_float.h:75
EnuCoor_f::x
float x
in meters
Definition: pprz_geodetic_float.h:73
ground_alt
float ground_alt
size == nb_waypoint, waypoint 0 is a dummy waypoint
Definition: common_nav.c:41