Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
nav.h File Reference

Fixedwing Navigation library. More...

#include "std.h"
#include "paparazzi.h"
#include "state.h"
#include "modules/nav/nav_survey_rectangle.h"
#include "modules/nav/common_flight_plan.h"
#include "modules/nav/common_nav.h"
#include "autopilot.h"
#include "pprzlink/pprzlink_device.h"
#include "pprzlink/pprzlink_transport.h"
Include dependency graph for nav.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NAVIGATION_FREQUENCY   20
 Default fixedwing navigation frequency.
#define NAV_GRAVITY   9.806
#define Square(_x)
#define DistanceSquare(p1_x, p1_y, p2_x, p2_y)
#define PowerVoltage()
#define RcRoll(travel)
#define NAV_MODE_ROLL   1
#define NAV_MODE_COURSE   2
#define HORIZONTAL_MODE_WAYPOINT   0
#define HORIZONTAL_MODE_ROUTE   1
#define HORIZONTAL_MODE_CIRCLE   2
#define NavGotoWaypoint(_wp)
#define NavGotoPoint(_point)
#define Eight(a, b, c)
#define Oval(a, b, c)
#define RCLost()
#define NavFollow(_ac_id, _distance, _height)
#define NavGlide(_start_wp, _wp)
#define NavCircleWaypoint(wp, radius)
#define NavCircleCountNoRewind()
#define NavCircleCount()
#define NavCircleQdr()
#define CloseDegAngles(_c1, _c2)
#define NavQdrCloseTo(x)
 True if x (in degrees) is close to the current QDR (less than 10 degrees).
#define NavCourseCloseTo(x)
#define NavSegment(_start, _end)
#define NavApproaching(wp, time)
#define NavApproachingFrom(wp, from, time)
#define NavVerticalAutoThrottleMode(_pitch)
 Set the climb control to auto-throttle with the specified pitch pre-command.
#define NavVerticalAutoPitchMode(_throttle)
 Set the climb control to auto-pitch with the specified throttle pre-command.
#define NavVerticalAltitudeMode(_alt, _pre_climb)
 Set the vertical mode to altitude control with the specified altitude setpoint and climb pre-command.
#define NavVerticalClimbMode(_climb)
 Set the vertical mode to climb control with the specified climb setpoint.
#define NavVerticalThrottleMode(_throttle)
 Set the vertical mode to fixed throttle with the specified setpoint.
#define NavHeading(_course)
#define NavAttitude(_roll)
#define NavSetMaxSpeed(_speed)
#define nav_IncreaseShift(x)
#define nav_SetNavRadius(x)
#define NavKillThrottle()
#define NavResurrect()
#define GetPosX()
 Get current x (east) position in local coordinates.
#define GetPosY()
 Get current y (north) position in local coordinates.
#define GetPosAlt()
 Get current altitude above MSL.
#define GetPosHeight()
 Get current height above reference.
#define GetAltRef()
 Get current altitude reference for local coordinates.
#define SEND_NAVIGATION(_trans, _dev)

Enumerations

enum  oval_status { OR12 , OC2 , OR21 , OC1 }

Functions

void fly_to_xy (float x, float y)
 Computes desired_x, desired_y and desired_course.
void nav_eight_init (void)
void nav_eight (uint8_t, uint8_t, float)
 Navigation along a figure 8.
void nav_oval_init (void)
void nav_oval (uint8_t, uint8_t, float)
void nav_periodic_task (void)
 Navigation main: call to the code generated from the XML flight plan.
void nav_home (void)
 Home mode navigation (circle around HOME).
void nav_init (void)
 Navigation Initialisation.
void nav_without_gps (void)
 Failsafe navigation without position estimation.
void nav_parse_BLOCK (struct link_device *dev, struct transport_tx *trans, uint8_t *buf)
void nav_parse_MOVE_WP (struct link_device *dev, struct transport_tx *trans, uint8_t *buf)
void nav_circle_XY (float x, float y, float radius)
 Angle from center to mobile.
void nav_compute_baseleg (uint8_t wp_af, uint8_t wp_td, uint8_t wp_baseleg, float radius)
void nav_compute_final_from_glide (uint8_t wp_af, uint8_t wp_td, float glide)
void nav_follow (uint8_t _ac_id, float _distance, float _height)
void nav_glide (uint8_t start_wp, uint8_t wp)
void nav_glide_alt (float start_alt, float final_alt)
void nav_route_xy (float last_wp_x, float last_wp_y, float wp_x, float wp_y)
 Computes the carrot position along the desired segment.
bool nav_approaching_xy (float x, float y, float from_x, float from_y, float approaching_time)
 Decide if the UAV is approaching the current waypoint.
void DownlinkSendWpNr (uint8_t _wp)

Variables

enum oval_status oval_status
float cur_pos_x
float cur_pos_y
float last_x
float last_y
float desired_x
float desired_y
float nav_altitude
float flight_altitude
 Dynamically adjustable, reset to nav_altitude when it is changing.
float nav_glide_pitch_trim
pprz_t nav_throttle_setpoint
float nav_pitch
float rc_pitch
float fp_pitch
float fp_throttle
float fp_climb
float carrot_x
float carrot_y
float nav_circle_radians
 Status on the current circle.
float nav_circle_radians_no_rewind
bool nav_in_circle
bool nav_in_segment
float nav_circle_x
float nav_circle_y
float nav_circle_radius
float nav_segment_x_1
float nav_segment_y_1
float nav_segment_x_2
float nav_segment_y_2
int nav_mode
uint8_t horizontal_mode
uint8_t nav_oval_count
 Navigation along a figure O.
float nav_radius
float nav_course
float nav_climb
float nav_shift
float nav_ground_speed_pgain
float nav_ground_speed_setpoint
float nav_survey_shift
float nav_survey_west
float nav_survey_east
float nav_survey_north
float nav_survey_south
bool nav_survey_active
float nav_circle_trigo_qdr
float baseleg_out_qdr

Detailed Description

Fixedwing Navigation library.

This collection of macros and functions is used by the C code generated from the XML flight plan.

Definition in file nav.h.

Macro Definition Documentation

◆ CloseDegAngles

#define CloseDegAngles ( _c1,
_c2 )
Value:
({ float _diff = _c1 - _c2; NormCourse(_diff); 350 < _diff || _diff < 10; })
#define NormCourse(x)
Normalize a degree angle between 0 and 359.
Definition navigation.h:154

Definition at line 158 of file nav.h.

◆ DistanceSquare

#define DistanceSquare ( p1_x,
p1_y,
p2_x,
p2_y )
Value:
(Square(p1_x-p2_x)+Square(p1_y-p2_y))
#define Square(_x)
Definition nav.h:53

Definition at line 54 of file nav.h.

Referenced by nav_circle_XY().

◆ Eight

#define Eight ( a,
b,
c )
Value:
nav_eight((a), (b), (c))
void nav_eight(uint8_t target, uint8_t c1, float radius)
Navigation along a figure 8.
Definition nav.c:633
float b
Definition wedgebug.c:202

Definition at line 109 of file nav.h.

◆ GetAltRef

#define GetAltRef ( )
Value:
float ground_alt
size == nb_waypoint, waypoint 0 is a dummy waypoint
Definition common_nav.c:46

Get current altitude reference for local coordinates.

This is the ground_alt from the flight plan at first, but might be updated later through a call to NavSetGroundReferenceHere() or NavSetAltitudeReferenceHere(), e.g. in the GeoInit flight plan block.

Definition at line 243 of file nav.h.

Referenced by home_direction(), nav_land_at_loc(), nav_land_at_wp(), and nav_land_run().

◆ GetPosAlt

#define GetPosAlt ( )
Value:
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
Definition state.h:832
float alt
in meters (above WGS84 reference ellipsoid or above MSL)

Get current altitude above MSL.

Definition at line 234 of file nav.h.

Referenced by calculate_wind_no_airspeed(), draw_osd(), and nav_land_run().

◆ GetPosHeight

#define GetPosHeight ( )
Value:
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
Definition state.h:859
float z
in meters

Get current height above reference.

Definition at line 236 of file nav.h.

◆ GetPosX

#define GetPosX ( )
Value:

Get current x (east) position in local coordinates.

Definition at line 230 of file nav.h.

◆ GetPosY

#define GetPosY ( )
Value:

Get current y (north) position in local coordinates.

Definition at line 232 of file nav.h.

◆ HORIZONTAL_MODE_CIRCLE

#define HORIZONTAL_MODE_CIRCLE   2

Definition at line 92 of file nav.h.

Referenced by nav_circle_XY().

◆ HORIZONTAL_MODE_ROUTE

#define HORIZONTAL_MODE_ROUTE   1

Definition at line 91 of file nav.h.

Referenced by nav_route_xy().

◆ HORIZONTAL_MODE_WAYPOINT

#define HORIZONTAL_MODE_WAYPOINT   0

Definition at line 90 of file nav.h.

◆ NAV_GRAVITY

#define NAV_GRAVITY   9.806

Definition at line 52 of file nav.h.

Referenced by nav_circle_XY().

◆ nav_IncreaseShift

#define nav_IncreaseShift ( x)
Value:
{ if (x==0) nav_shift = 0; else nav_shift += x; }
float nav_shift
Definition nav.c:56

Definition at line 222 of file nav.h.

◆ NAV_MODE_COURSE

#define NAV_MODE_COURSE   2

Definition at line 86 of file nav.h.

Referenced by fly_to_xy(), nav_circle_XY(), and nav_init().

◆ NAV_MODE_ROLL

#define NAV_MODE_ROLL   1

Definition at line 85 of file nav.h.

◆ nav_SetNavRadius

#define nav_SetNavRadius ( x)
Value:
{ if (x==1) nav_radius = DEFAULT_CIRCLE_RADIUS; else if (x==-1) nav_radius = -DEFAULT_CIRCLE_RADIUS; else nav_radius = x; }
float nav_radius
Definition nav.c:56
#define DEFAULT_CIRCLE_RADIUS
default nav_circle_radius in meters
Definition navigation.h:42

Definition at line 224 of file nav.h.

◆ NavApproaching

#define NavApproaching ( wp,
time )
Value:
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
Definition common_nav.c:44
bool nav_approaching_xy(float x, float y, float from_x, float from_y, float approaching_time)
Decide if the UAV is approaching the current waypoint.
Definition nav.c:325
float last_y
Definition nav.c:47
float last_x
Definition nav.c:47

Definition at line 171 of file nav.h.

◆ NavApproachingFrom

#define NavApproachingFrom ( wp,
from,
time )
Value:
nav_approaching_xy(waypoints[wp].x, waypoints[wp].y, waypoints[from].x, waypoints[from].y, time)

Definition at line 172 of file nav.h.

Referenced by nav_line_border_run(), nav_line_run(), and nav_vertical_raster_run().

◆ NavAttitude

#define NavAttitude ( _roll)
Value:
{ \
{h_ctl_roll_setpoint = _roll;} \
}
uint8_t autopilot_get_mode(void)
get autopilot mode
Definition autopilot.c:229
uint8_t lateral_mode
#define LATERAL_MODE_ROLL
#define AP_MODE_AUTO1
float h_ctl_roll_setpoint

Definition at line 214 of file nav.h.

Referenced by nav_catapult_run(), nav_launcher_run(), and nav_shakestart_run().

◆ NavCircleCount

#define NavCircleCount ( )
Value:
(fabs(nav_circle_radians) / (2*M_PI))
float nav_circle_radians
Status on the current circle.
Definition nav.c:53

Definition at line 155 of file nav.h.

Referenced by calculate_wind_no_airspeed(), nav_land_run(), nav_line_osam_run(), nav_skid_landing_run(), nav_survey_hybrid_run(), and nav_survey_poly_osam_run().

◆ NavCircleCountNoRewind

#define NavCircleCountNoRewind ( )
Value:
float nav_circle_radians_no_rewind
Definition nav.c:54

Definition at line 154 of file nav.h.

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

◆ NavCircleQdr

#define NavCircleQdr ( )
Value:
({ float qdr = DegOfRad(M_PI_2 - nav_circle_trigo_qdr); NormCourse(qdr); qdr; })
float nav_circle_trigo_qdr
Definition nav.c:55

Definition at line 156 of file nav.h.

◆ NavCircleWaypoint

#define NavCircleWaypoint ( wp,
radius )
Value:
nav_circle_XY(waypoints[wp].x, waypoints[wp].y, radius)
void nav_circle_XY(float x, float y, float radius)
Navigates around (x, y).
Definition nav.c:108

Definition at line 151 of file nav.h.

Referenced by calculate_wind_no_airspeed(), nav_eight(), nav_home(), nav_land_run(), and nav_survey_rectangle().

◆ NavCourseCloseTo

#define NavCourseCloseTo ( x)
Value:
static float stateGetHorizontalSpeedDir_f(void)
Get dir of horizontal ground speed (float).
Definition state.h:1096
#define CloseDegAngles(_c1, _c2)
Definition nav.h:158

Definition at line 163 of file nav.h.

Referenced by nav_gvf_survey_polygon_run(), nav_survey_polygon_run(), nav_survey_rectangle(), and nav_survey_zamboni_run().

◆ NavFollow

#define NavFollow ( _ac_id,
_distance,
_height )
Value:
nav_follow(_ac_id, _distance, _height)
void nav_follow(uint8_t _ac_id, float distance, float height)
Definition nav.c:302

Definition at line 145 of file nav.h.

◆ NavGlide

#define NavGlide ( _start_wp,
_wp )
Value:
nav_glide(_start_wp, _wp)
void nav_glide(uint8_t start_wp, uint8_t wp)
Definition nav.c:158

Definition at line 149 of file nav.h.

◆ NavGotoPoint

#define NavGotoPoint ( _point)
Value:
{ \
fly_to_xy(_point.x, _point.y); \
}
uint8_t horizontal_mode
Definition nav.c:70
#define HORIZONTAL_MODE_WAYPOINT
Definition nav.h:90

Definition at line 101 of file nav.h.

Referenced by nav_takeoff_run().

◆ NavGotoWaypoint

#define NavGotoWaypoint ( _wp)
Value:
{ \
fly_to_xy(waypoints[_wp].x, waypoints[_wp].y); \
}

Definition at line 96 of file nav.h.

Referenced by nav_catapult_run(), and nav_takeoff_run().

◆ NavHeading

#define NavHeading ( _course)
Value:
{ \
h_ctl_course_setpoint = _course; \
}
#define LATERAL_MODE_COURSE
float h_ctl_course_setpoint

Definition at line 209 of file nav.h.

◆ NAVIGATION_FREQUENCY

#define NAVIGATION_FREQUENCY   20

Default fixedwing navigation frequency.

Definition at line 49 of file nav.h.

Referenced by airspeed_consistency_init(), common_nav_periodic_task(), follow_diagonal_approach(), nav_periodic_task(), nav_takeoff_run(), and nav_takeoff_run().

◆ NavKillThrottle

#define NavKillThrottle ( void)
Value:
void autopilot_set_kill_throttle(bool kill)
set kill throttle Kill always kills, also when motors_on is already false (fixedwing in flight).
Definition autopilot.c:312

Definition at line 226 of file nav.h.

Referenced by nav_land_run(), and nav_land_run().

◆ NavQdrCloseTo

#define NavQdrCloseTo ( x)
Value:
#define NavCircleQdr()
Definition nav.h:156

True if x (in degrees) is close to the current QDR (less than 10 degrees).

Definition at line 161 of file nav.h.

Referenced by nav_eight(), nav_line_border_run(), nav_line_osam_run(), nav_line_run(), nav_oval(), nav_oval(), nav_oval(), nav_skid_landing_run(), nav_survey_disc_run(), nav_survey_poly_osam_run(), nav_vertical_raster_run(), snav_circle1(), and snav_circle2().

◆ NavResurrect

#define NavResurrect ( void)
Value:

Definition at line 227 of file nav.h.

Referenced by nav_takeoff_run().

◆ NavSegment

#define NavSegment ( _start,
_end )
Value:
nav_route_xy(waypoints[_start].x, waypoints[_start].y, waypoints[_end].x, waypoints[_end].y)
void nav_route_xy(float last_wp_x, float last_wp_y, float wp_x, float wp_y)
Computes the carrot position along the desired segment.
Definition nav.c:382

Definition at line 167 of file nav.h.

Referenced by gls_run(), nav_line_border_run(), nav_line_run(), and nav_vertical_raster_run().

◆ NavSetMaxSpeed

#define NavSetMaxSpeed ( _speed)
Value:
{}

Definition at line 220 of file nav.h.

◆ NavVerticalAltitudeMode

#define NavVerticalAltitudeMode ( _alt,
_pre_climb )
Value:
{ \
nav_altitude = _alt; \
v_ctl_altitude_pre_climb = _pre_climb; \
}
float v_ctl_altitude_pre_climb
Path Angle.
Definition energy_ctrl.c:89
uint8_t v_ctl_mode
Definition energy_ctrl.c:74
#define V_CTL_MODE_AUTO_ALT
float nav_altitude
Definition nav.c:307

Set the vertical mode to altitude control with the specified altitude setpoint and climb pre-command.

Definition at line 191 of file nav.h.

Referenced by calculate_wind_no_airspeed(), compute_oval_points(), gls_run(), mission_nav_circle(), mission_nav_circle(), mission_nav_path(), mission_nav_path(), mission_nav_segment(), mission_nav_segment(), mission_nav_wp(), mission_nav_wp(), nav_catapult_run(), nav_flower_run(), nav_glide_alt(), nav_glide_points(), nav_gvf_survey_polygon_run(), nav_gvf_survey_polygon_setup(), nav_lace_run(), nav_land_run(), nav_land_run(), nav_launcher_run(), nav_line_border_run(), nav_line_osam_run(), nav_line_run(), nav_rosette_run(), nav_skid_landing_run(), nav_spiral_3D_run(), nav_spiral_run(), nav_survey_disc_run(), nav_survey_hybrid_setup(), nav_survey_poly_osam_run(), nav_survey_poly_setup(), nav_survey_polygon_run(), nav_survey_polygon_setup(), nav_survey_rectangle(), nav_survey_rectangle_rotorcraft_setup(), nav_survey_zamboni_run(), nav_survey_zamboni_setup(), nav_trinity_run(), nav_vertical_raster_run(), snav_circle1(), snav_circle2(), snav_on_time(), and snav_route().

◆ NavVerticalAutoPitchMode

#define NavVerticalAutoPitchMode ( _throttle)
Value:
{ \
nav_throttle_setpoint = _throttle; \
}
uint8_t v_ctl_climb_mode
Definition energy_ctrl.c:75
#define V_CTL_CLIMB_MODE_AUTO_PITCH
pprz_t nav_throttle_setpoint
Definition nav.c:309

Set the climb control to auto-pitch with the specified throttle pre-command.

Definition at line 184 of file nav.h.

◆ NavVerticalAutoThrottleMode

◆ NavVerticalClimbMode

#define NavVerticalClimbMode ( _climb)
Value:
{ \
}
float v_ctl_climb_setpoint
Definition energy_ctrl.c:98
#define V_CTL_MODE_AUTO_CLIMB

Set the vertical mode to climb control with the specified climb setpoint.

Definition at line 198 of file nav.h.

Referenced by nav_land_run(), nav_land_run(), nav_takeoff_run(), and potential_task().

◆ NavVerticalThrottleMode

#define NavVerticalThrottleMode ( _throttle)
Value:
{ \
nav_throttle_setpoint = _throttle; \
}
#define V_CTL_MODE_AUTO_THROTTLE

Set the vertical mode to fixed throttle with the specified setpoint.

Definition at line 204 of file nav.h.

Referenced by calculate_wind_no_airspeed(), nav_bungee_takeoff_run(), nav_catapult_highrate_module(), nav_catapult_run(), nav_land_run(), nav_launcher_run(), nav_shakestart_run(), and nav_takeoff_run().

◆ Oval

#define Oval ( a,
b,
c )
Value:
nav_oval((b), (a), (c))
void nav_oval(uint8_t p1, uint8_t p2, float radius)
Definition nav.c:762

Definition at line 114 of file nav.h.

◆ PowerVoltage

#define PowerVoltage ( )
Value:
(electrical.vsupply)
struct Electrical electrical
Definition electrical.c:92

Definition at line 56 of file nav.h.

Referenced by cloud_sensor_filtering().

◆ RCLost

#define RCLost ( )
Value:
#define RadioControlIsLost()

Definition at line 142 of file nav.h.

◆ RcRoll

#define RcRoll ( travel)
Value:
(radio_control_get(RADIO_ROLL) * (float)travel /(float)MAX_PPRZ)
#define MAX_PPRZ
Definition paparazzi.h:8
static pprz_t radio_control_get(uint8_t idx)
Get a radio control channel value.

Definition at line 57 of file nav.h.

◆ SEND_NAVIGATION

#define SEND_NAVIGATION ( _trans,
_dev )
Value:
{ \
uint8_t _circle_count = NavCircleCount(); \
struct EnuCoor_f* pos = stateGetPositionEnu_f(); \
float dist_wp = sqrtf(dist2_to_wp); \
float dist_home = sqrtf(dist2_to_home); \
uint8_t kill = (uint8_t)autopilot.kill_throttle; \
pprz_msg_send_NAVIGATION(_trans, _dev, AC_ID, &nav_block, &nav_stage, &(pos->x), &(pos->y), &dist_wp, &dist_home, &autopilot.flight_time, &block_time, &stage_time, &kill, &_circle_count, &nav_oval_count); \
}
struct pprz_autopilot autopilot
Global autopilot structure.
Definition autopilot.c:50
uint8_t nav_stage
uint8_t nav_block
uint16_t stage_time
In s.
uint16_t block_time
float dist2_to_wp
Definition common_nav.c:39
float dist2_to_home
Definition common_nav.c:38
uint8_t nav_oval_count
Navigation along a figure O.
Definition nav.c:754
#define NavCircleCount()
Definition nav.h:155
vector in East North Up coordinates Units: meters
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.

Definition at line 246 of file nav.h.

Referenced by nav_parse_BLOCK(), navigation_task(), and send_nav().

◆ Square

#define Square ( _x)
Value:
((_x)*(_x))

Definition at line 53 of file nav.h.

Referenced by monitor_task(), and nav_circle_XY().

Enumeration Type Documentation

◆ oval_status

Enumerator
OR12 
OC2 
OR21 
OC1 

Definition at line 60 of file nav.h.

Function Documentation

◆ DownlinkSendWpNr()

void DownlinkSendWpNr ( uint8_t _wp)
extern

Definition at line 497 of file nav.c.

References DefaultChannel, DefaultDevice, DownlinkSendWp(), and nb_waypoint.

Referenced by nav_catapult_run().

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

◆ fly_to_xy()

void fly_to_xy ( float x,
float y )
extern

◆ nav_approaching_xy()

bool nav_approaching_xy ( float x,
float y,
float from_x,
float from_y,
float approaching_time )

Decide if the UAV is approaching the current waypoint.

Computes dist2_to_wp and compare it to square carrot. Return true if it is smaller. Else computes by scalar products if uav has not gone past waypoint. approaching_time can be negative and in this case, the UAV will fly after the waypoint for the given number of seconds.

Returns
true if the position (x, y) is reached

distance to waypoint in x

distance to waypoint in y

Definition at line 325 of file nav.c.

References dist2_to_wp, stateGetHorizontalSpeedNorm_f(), stateGetPositionEnu_f(), EnuCoor_f::x, and EnuCoor_f::y.

Referenced by gvf_nav_approaching(), mission_nav_path(), mission_nav_segment(), mission_nav_wp(), nav_catapult_run(), nav_eight(), nav_gvf_survey_polygon_run(), nav_land_run(), nav_line_osam_run(), nav_oval(), nav_spiral_run(), nav_survey_disc_run(), nav_survey_poly_osam_run(), nav_survey_polygon_run(), nav_survey_zamboni_run(), nav_takeoff_run(), and snav_route().

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

◆ nav_circle_XY()

◆ nav_compute_baseleg()

void nav_compute_baseleg ( uint8_t wp_af,
uint8_t wp_td,
uint8_t wp_baseleg,
float radius )
extern

Definition at line 220 of file nav.c.

References baseleg_out_qdr, nav_radius, and waypoints.

◆ nav_compute_final_from_glide()

void nav_compute_final_from_glide ( uint8_t wp_af,
uint8_t wp_td,
float glide )
extern

Definition at line 241 of file nav.c.

References waypoints.

◆ nav_eight()

void nav_eight ( uint8_t target,
uint8_t c1,
float radius )
extern

Navigation along a figure 8.

The cross center is defined by the waypoint [target], the center of one of the circles is defined by [c1]. Altitude is given by [target]. The navigation goes through 6 states: C1 (circle around [c1]), R1T, RT2 (route from circle 1 to circle 2 over [target]), C2 and R2T, RT1. If necessary, the [c1] waypoint is moved in the direction of [target] to be not far than [2*radius].

Definition at line 633 of file nav.c.

References UtmCoor_f::alt, C1, c1, C2, c2, CARROT, InitStage, nav_approaching_xy(), nav_circle_XY(), nav_route_xy(), NavCircleWaypoint, NavQdrCloseTo, R1T, R2T, RT1, RT2, target, waypoints, point::x, and point::y.

Here is the call graph for this function:

◆ nav_eight_init()

void nav_eight_init ( void )
extern

Definition at line 620 of file nav.c.

References C1.

◆ nav_follow()

void nav_follow ( uint8_t _ac_id,
float _distance,
float _height )
extern

Definition at line 302 of file nav.c.

◆ nav_glide()

void nav_glide ( uint8_t start_wp,
uint8_t wp )
extern

Definition at line 158 of file nav.c.

References nav_glide_alt(), and waypoints.

Here is the call graph for this function:

◆ nav_glide_alt()

void nav_glide_alt ( float start_alt,
float final_alt )
extern

Definition at line 163 of file nav.c.

References nav_leg_length, nav_leg_progress, NavVerticalAltitudeMode, and stateGetHorizontalSpeedNorm_f().

Referenced by nav_glide(), and nav_land_run().

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

◆ nav_home()

void nav_home ( void )
extern

Home mode navigation (circle around HOME).

Home mode navigation (circle around HOME).

Nominal speed

Definition at line 424 of file nav.c.

◆ nav_init()

void nav_init ( void )
extern

Navigation Initialisation.

Definition at line 532 of file nav.c.

◆ nav_oval()

void nav_oval ( uint8_t p1,
uint8_t p2,
float radius )
extern

Definition at line 762 of file nav.c.

References CARROT, InitStage, LINE_START_FUNCTION, LINE_STOP_FUNCTION, nav_approaching_xy(), nav_circle_XY(), nav_oval_count, nav_route_xy(), NavQdrCloseTo, OC1, OC2, OR12, OR21, waypoints, point::x, and point::y.

Referenced by nav_register_oval(), nav_register_oval(), nav_rotorcraft_init(), and nav_rover_init().

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

◆ nav_oval_init()

void nav_oval_init ( void )
extern

Definition at line 756 of file nav.c.

References nav_oval_count, and OC2.

Referenced by nav_register_oval().

Here is the caller graph for this function:

◆ nav_parse_BLOCK()

void nav_parse_BLOCK ( struct link_device * dev,
struct transport_tx * trans,
uint8_t * buf )
extern

Definition at line 585 of file nav.c.

References dev, nav_goto_block(), and SEND_NAVIGATION.

Here is the call graph for this function:

◆ nav_parse_MOVE_WP()

void nav_parse_MOVE_WP ( struct link_device * dev,
struct transport_tx * trans,
uint8_t * buf )
extern

◆ nav_periodic_task()

void nav_periodic_task ( void )
extern

Navigation main: call to the code generated from the XML flight plan.

Definition at line 445 of file nav.c.

◆ nav_route_xy()

◆ nav_without_gps()

void nav_without_gps ( void )
extern

Failsafe navigation without position estimation.

Just set attitude and throttle to FAILSAFE values to prevent the plane from crashing.

Definition at line 569 of file nav.c.

References h_ctl_roll_setpoint, lateral_mode, LATERAL_MODE_ROLL, MAX_PPRZ, nav_pitch, nav_throttle_setpoint, TRIM_UPPRZ, v_ctl_mode, and V_CTL_MODE_AUTO_THROTTLE.

Referenced by navigation_task().

Here is the caller graph for this function:

Variable Documentation

◆ baseleg_out_qdr

float baseleg_out_qdr
extern

Definition at line 219 of file nav.c.

Referenced by nav_compute_baseleg().

◆ carrot_x

float carrot_x
extern

Definition at line 50 of file nav.c.

◆ carrot_y

float carrot_y

Definition at line 75 of file nav.h.

◆ cur_pos_x

float cur_pos_x
extern

◆ cur_pos_y

float cur_pos_y
extern

◆ desired_x

float desired_x
extern

◆ desired_y

float desired_y

Definition at line 66 of file nav.h.

◆ flight_altitude

float flight_altitude

Dynamically adjustable, reset to nav_altitude when it is changing.

Definition at line 66 of file nav.h.

◆ fp_climb

float fp_climb
extern

Definition at line 313 of file nav.c.

Referenced by nav_init().

◆ fp_pitch

float fp_pitch
extern

Definition at line 311 of file nav.c.

Referenced by nav_init().

◆ fp_throttle

float fp_throttle
extern

Definition at line 312 of file nav.c.

Referenced by nav_init().

◆ horizontal_mode

uint8_t horizontal_mode
extern

Definition at line 70 of file nav.c.

Referenced by nav_circle_XY(), nav_route_xy(), and send_mode().

◆ last_x

float last_x
extern

Definition at line 47 of file nav.c.

Referenced by nav_gvf_survey_polygon_run(), nav_init_stage(), and nav_survey_polygon_run().

◆ last_y

float last_y

Definition at line 64 of file nav.h.

◆ nav_altitude

float nav_altitude

Definition at line 66 of file nav.h.

◆ nav_circle_radians

float nav_circle_radians
extern

Status on the current circle.

Definition at line 53 of file nav.c.

Referenced by nav_circle_XY(), and nav_init_stage().

◆ nav_circle_radians_no_rewind

float nav_circle_radians_no_rewind
extern

Definition at line 54 of file nav.c.

Referenced by nav_circle_XY(), and nav_init_stage().

◆ nav_circle_radius

float nav_circle_radius

Definition at line 81 of file nav.h.

◆ nav_circle_trigo_qdr

float nav_circle_trigo_qdr
extern

Definition at line 55 of file nav.c.

Referenced by nav_circle_XY(), and nav_land_run().

◆ nav_circle_x

float nav_circle_x
extern

Definition at line 68 of file nav.c.

Referenced by flight_benchmark_periodic(), nav_circle_XY(), and send_circle().

◆ nav_circle_y

float nav_circle_y

Definition at line 81 of file nav.h.

◆ nav_climb

float nav_climb
extern

Definition at line 56 of file nav.c.

◆ nav_course

float nav_course
extern

Definition at line 56 of file nav.c.

◆ nav_glide_pitch_trim

float nav_glide_pitch_trim

Definition at line 66 of file nav.h.

◆ nav_ground_speed_pgain

float nav_ground_speed_pgain
extern

Definition at line 83 of file nav.c.

Referenced by nav_init().

◆ nav_ground_speed_setpoint

float nav_ground_speed_setpoint

Definition at line 121 of file nav.h.

◆ nav_in_circle

◆ nav_in_segment

bool nav_in_segment
extern

◆ nav_mode

int nav_mode
extern

Definition at line 90 of file nav.c.

Referenced by fly_to_xy(), nav_circle_XY(), and nav_init().

◆ nav_oval_count

uint8_t nav_oval_count
extern

Navigation along a figure O.

One side leg is defined by waypoints [p1] and [p2]. The navigation goes through 4 states: OC1 (half circle next to [p1]), OR21 (route [p2] to [p1], OC2 (half circle next to [p2]) and OR12 (opposite leg).

Initial state is the route along the desired segment (OC2).

Definition at line 754 of file nav.c.

Referenced by nav_oval(), and nav_oval_init().

◆ nav_pitch

◆ nav_radius

float nav_radius
extern

Definition at line 56 of file nav.c.

Referenced by nav_compute_baseleg(), nav_flower_run(), nav_init(), and parachute_compute_approach().

◆ nav_segment_x_1

float nav_segment_x_1
extern

Definition at line 69 of file nav.c.

Referenced by flight_benchmark_periodic(), nav_route_xy(), and send_segment().

◆ nav_segment_x_2

float nav_segment_x_2

Definition at line 82 of file nav.h.

◆ nav_segment_y_1

float nav_segment_y_1

Definition at line 82 of file nav.h.

◆ nav_segment_y_2

float nav_segment_y_2

Definition at line 82 of file nav.h.

◆ nav_shift

float nav_shift
extern

Definition at line 56 of file nav.c.

Referenced by nav_circle_XY(), nav_init_stage(), and nav_route_xy().

◆ nav_survey_active

bool nav_survey_active
extern

Definition at line 88 of file nav.c.

Referenced by nav_periodic_task(), nav_survey_rectangle(), and send_survey().

◆ nav_survey_east

float nav_survey_east

Definition at line 125 of file nav.h.

◆ nav_survey_north

float nav_survey_north

Definition at line 125 of file nav.h.

◆ nav_survey_shift

◆ nav_survey_south

float nav_survey_south

Definition at line 125 of file nav.h.

◆ nav_survey_west

◆ nav_throttle_setpoint

pprz_t nav_throttle_setpoint
extern

Definition at line 309 of file nav.c.

Referenced by attitude_loop(), nav_without_gps(), and v_ctl_guidance_loop().

◆ oval_status

enum oval_status oval_status
extern

Definition at line 45 of file nav.c.

◆ rc_pitch

float rc_pitch
extern

Definition at line 49 of file nav.c.