![]() |
Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Rotorcraft navigation functions. More...
#include "std.h"
#include "math/pprz_geodetic_int.h"
#include "math/pprz_geodetic_float.h"
#include "state.h"
#include "modules/nav/waypoints.h"
#include "modules/nav/common_flight_plan.h"
#include "autopilot.h"
#include "generated/airframe.h"
Go to the source code of this file.
Data Structures | |
struct | RotorcraftNavigation |
General Navigation structure. More... | |
Typedefs | |
typedef void(* | navigation_stage_init) (void) |
typedef void(* | navigation_goto) (struct EnuCoor_f *wp) |
typedef void(* | navigation_route) (struct EnuCoor_f *wp_start, struct EnuCoor_f *wp_end) |
typedef bool(* | navigation_approaching) (struct EnuCoor_f *wp_to, struct EnuCoor_f *wp_from, float approaching_time) |
typedef void(* | navigation_circle) (struct EnuCoor_f *wp_center, float radius) |
typedef void(* | navigation_oval_init) (void) |
typedef void(* | navigation_oval) (struct EnuCoor_f *wp1, struct EnuCoor_f *wp2, float radius) |
Variables | |
struct RotorcraftNavigation | nav |
float | flight_altitude |
Dynamically adjustable, reset to nav_altitude when it is changing. | |
Rotorcraft navigation functions.
Definition in file navigation.h.
struct RotorcraftNavigation |
General Navigation structure.
Definition at line 119 of file navigation.h.
Data Fields | ||
---|---|---|
struct EnuCoor_f | accel | accel setpoint (in m/s) |
struct EnuCoor_f | carrot | carrot position (also used for GCS display) |
float | climb | climb setpoint (in m/s) |
float | climb_vspeed | climb speed setting, mostly used in flight plans |
float | descend_vspeed | descend speed setting, mostly used in flight plans |
float | dist2_to_home | squared distance to home waypoint |
float | failsafe_mode_dist2 | maximum squared distance to home wp before going to failsafe mode |
float | fp_altitude | altitude setpoint from flight plan (in meters) |
float | fp_max_speed | maximum speed setpoint from flight plan (in m/s), negative value means unset or invalid, do not use |
float | heading | heading setpoint (in radians) |
uint8_t | horizontal_mode | |
float | nav_altitude | current altitude setpoint (in meters): might differ from fp_altitude depending on altitude shift from operator |
navigation_approaching | nav_approaching | |
navigation_circle | nav_circle | |
navigation_goto | nav_goto | |
navigation_oval | nav_oval | |
navigation_oval_init | nav_oval_init | |
navigation_route | nav_route | |
navigation_stage_init | nav_stage_init | |
float | pitch | pitch angle (in radians) |
struct FloatQuat | quat | quaternion setpoint |
float | radius | radius setpoint (in meters) |
struct FloatRates | rates | rates setpoint (in rad/s) |
float | roll | roll angle (in radians) |
uint8_t | setpoint_mode | |
struct EnuCoor_f | speed | speed setpoint (in m/s) |
struct EnuCoor_f | target | final target position (in meters) |
uint32_t | throttle | throttle command (in pprz_t) |
bool | too_far_from_home | too_far flag |
uint8_t | vertical_mode |
#define ARRIVED_AT_WAYPOINT 3.0f |
minimum horizontal distance to waypoint to mark as arrived
Definition at line 55 of file navigation.h.
#define CARROT 0 |
default approaching_time for a wp
Definition at line 70 of file navigation.h.
default nav_circle_radius in meters
Definition at line 42 of file navigation.h.
#define FAILSAFE_MODE_DISTANCE (1.2*MAX_DIST_FROM_HOME) |
Maximum distance from HOME waypoint before going into failsafe mode.
Definition at line 60 of file navigation.h.
#define GetAltRef | ( | ) | (stateGetHmslOrigin_f()) |
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 192 of file navigation.h.
#define GetPosAlt | ( | ) | (stateGetPositionEnu_f()->z+stateGetHmslOrigin_f()) |
Get current altitude above MSL.
Definition at line 183 of file navigation.h.
#define GetPosHeight | ( | ) | (stateGetPositionEnu_f()->z) |
Get current height above reference.
Definition at line 185 of file navigation.h.
#define GetPosX | ( | ) | (stateGetPositionEnu_f()->x) |
Get current x (east) position in local coordinates.
Definition at line 179 of file navigation.h.
#define GetPosY | ( | ) | (stateGetPositionEnu_f()->y) |
Get current y (north) position in local coordinates.
Definition at line 181 of file navigation.h.
#define NAV_CARROT_DIST 12 |
Carrot distance during navigation.
Definition at line 65 of file navigation.h.
Definition at line 46 of file navigation.h.
Definition at line 50 of file navigation.h.
#define NAV_HORIZONTAL_MODE_ATTITUDE 3 |
Definition at line 88 of file navigation.h.
#define NAV_HORIZONTAL_MODE_CIRCLE 2 |
Definition at line 87 of file navigation.h.
#define NAV_HORIZONTAL_MODE_GUIDED 5 |
Definition at line 90 of file navigation.h.
#define NAV_HORIZONTAL_MODE_NONE 4 |
Definition at line 89 of file navigation.h.
#define NAV_HORIZONTAL_MODE_ROUTE 1 |
Definition at line 86 of file navigation.h.
#define NAV_HORIZONTAL_MODE_WAYPOINT 0 |
Nav modes these modes correspond to the flight plan instructions used to set the high level navigation.
Definition at line 85 of file navigation.h.
#define nav_IncreaseShift | ( | x | ) | {} |
Definition at line 380 of file navigation.h.
#define nav_SetNavRadius | ( | x | ) | {} |
Definition at line 381 of file navigation.h.
#define NAV_SETPOINT_MODE_ACCEL 2 |
Definition at line 102 of file navigation.h.
#define NAV_SETPOINT_MODE_ATTITUDE 3 |
Definition at line 103 of file navigation.h.
#define NAV_SETPOINT_MODE_MANUAL 6 |
Definition at line 106 of file navigation.h.
#define NAV_SETPOINT_MODE_POS 0 |
Nav setpoint modes these modes correspond to submodes defined by navigation routines to tell which setpoint should be considered.
Definition at line 100 of file navigation.h.
#define NAV_SETPOINT_MODE_QUAT 4 |
Definition at line 104 of file navigation.h.
#define NAV_SETPOINT_MODE_RATE 5 |
Definition at line 105 of file navigation.h.
#define NAV_SETPOINT_MODE_SPEED 1 |
Definition at line 101 of file navigation.h.
#define NAV_VERTICAL_MODE_ALT 2 |
Definition at line 94 of file navigation.h.
#define NAV_VERTICAL_MODE_CLIMB 1 |
Definition at line 93 of file navigation.h.
#define NAV_VERTICAL_MODE_GUIDED 3 |
Definition at line 95 of file navigation.h.
#define NAV_VERTICAL_MODE_MANUAL 0 |
Definition at line 92 of file navigation.h.
Definition at line 257 of file navigation.h.
#define NavCheckWaypointTime | ( | wp, | |
time | |||
) | nav_check_wp_time(&waypoints[wp].enu_f, time) |
Definition at line 250 of file navigation.h.
#define NavCopyWaypoint waypoint_copy |
Definition at line 245 of file navigation.h.
#define NavCopyWaypointPositionOnly waypoint_position_copy |
Definition at line 246 of file navigation.h.
#define NavDetectGround | ( | ) | nav_detect_ground() |
Definition at line 226 of file navigation.h.
#define NavHeading nav_set_heading_rad |
Set the heading of the rotorcraft, nothing else.
Definition at line 290 of file navigation.h.
#define NAVIGATION_FREQUENCY 20 |
default navigation frequency
Definition at line 78 of file navigation.h.
#define navigation_SetFlightAltitude | ( | x | ) |
Definition at line 382 of file navigation.h.
#define NavSetAltitudeReferenceHere nav_reset_alt |
Definition at line 242 of file navigation.h.
#define NavSetFailsafe nav_set_failsafe |
Definition at line 239 of file navigation.h.
#define NavSetGroundReferenceHere nav_reset_reference |
Definition at line 241 of file navigation.h.
Set maximum speed.
Definition at line 293 of file navigation.h.
#define NavSetWaypointHere waypoint_set_here_2d |
Definition at line 244 of file navigation.h.
Definition at line 225 of file navigation.h.
#define NavVerticalAltitudeMode | ( | _alt, | |
_pre_climb | |||
) |
Set the vertical mode to altitude control with the specified altitude setpoint and climb pre-command.
Definition at line 271 of file navigation.h.
Unused compat macros.
Definition at line 390 of file navigation.h.
Set the climb control to auto-throttle with the specified pitch pre-command.
Definition at line 265 of file navigation.h.
Set the vertical mode to climb control with the specified climb setpoint.
Definition at line 277 of file navigation.h.
Set the vertical mode to fixed throttle with the specified setpoint.
Definition at line 284 of file navigation.h.
typedef bool(* navigation_approaching) (struct EnuCoor_f *wp_to, struct EnuCoor_f *wp_from, float approaching_time) |
Definition at line 111 of file navigation.h.
Definition at line 112 of file navigation.h.
Definition at line 109 of file navigation.h.
Definition at line 114 of file navigation.h.
Definition at line 113 of file navigation.h.
Definition at line 110 of file navigation.h.
Definition at line 108 of file navigation.h.
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 326 of file navigation.c.
Returns squared horizontal distance to given point.
Definition at line 308 of file navigation.c.
Returns squared horizontal distance to given waypoint.
Definition at line 318 of file navigation.c.
Check the time spent in a radius of 'ARRIVED_AT_WAYPOINT' around a wp
Definition at line 180 of file navigation.c.
References ARRIVED_AT_WAYPOINT, autopilot, ENU_BFP_OF_REAL, pprz_autopilot::flight_time, float_vect2_norm(), foo, INT_VECT3_ZERO, stateGetPositionEnu_f(), and VECT2_DIFF.
Referenced by mission_nav_path(), mission_nav_segment(), and mission_nav_wp().
Definition at line 267 of file navigation.c.
References autopilot, and pprz_autopilot::ground_detected.
Definition at line 282 of file navigation.c.
References float_vect2_norm2(), foo, NavVerticalAltitudeMode, pos_diff, stateGetPositionEnu_f(), VECT2_DIFF, FloatVect2::x, and FloatVect2::y.
Referenced by nav_land_run(), and NavGlide().
Definition at line 277 of file navigation.c.
Definition at line 350 of file navigation.h.
References nav, and RotorcraftNavigation::nav_oval_init.
Definition at line 115 of file navigation.c.
Definition at line 121 of file navigation.c.
|
extern |
Definition at line 399 of file navigation.c.
|
extern |
Register functions.
Definition at line 392 of file navigation.c.
|
extern |
Definition at line 404 of file navigation.c.
|
extern |
Registering functions.
Registering functions.
Definition at line 387 of file navigation.c.
References nav, RotorcraftNavigation::nav_stage_init, and nav_stage_init().
Referenced by nav_rotorcraft_init().
Reset the altitude reference to the current GPS alt.
Definition at line 241 of file navigation.c.
Reset the geographic reference to the current GPS fix.
Definition at line 234 of file navigation.c.
Definition at line 165 of file navigation.c.
Definition at line 380 of file navigation.c.
Set heading to the current yaw angle.
Definition at line 375 of file navigation.c.
Set nav_heading in degrees.
Definition at line 344 of file navigation.c.
Set heading to point towards x,y position in local coordinates.
Definition at line 350 of file navigation.c.
Set heading in the direction of the target.
Definition at line 369 of file navigation.c.
Set heading in the direction of a waypoint.
Definition at line 363 of file navigation.c.
Definition at line 320 of file navigation.h.
References foo, nav, RotorcraftNavigation::nav_approaching, and waypoint_get_enu_f().
Definition at line 329 of file navigation.h.
References foo, nav, RotorcraftNavigation::nav_approaching, and waypoint_get_enu_f().
Definition at line 340 of file navigation.h.
References foo, nav, RotorcraftNavigation::nav_circle, and waypoint_get_enu_f().
Nav glide routine.
Definition at line 367 of file navigation.h.
References foo, nav_glide_points(), and waypoint_get_enu_f().
Definition at line 302 of file navigation.h.
References foo, nav, RotorcraftNavigation::nav_goto, and waypoint_get_enu_f().
Definition at line 229 of file navigation.h.
References AP_MODE_NAV, autopilot_get_mode(), and autopilot_set_motors_on().
Definition at line 233 of file navigation.h.
References AP_MODE_NAV, autopilot_get_mode(), and autopilot_set_motors_on().
Referenced by nav_takeoff_run().
Definition at line 311 of file navigation.h.
References foo, nav, RotorcraftNavigation::nav_route, and waypoint_get_enu_f().
Definition at line 355 of file navigation.h.
References foo, nav, RotorcraftNavigation::nav_oval, and waypoint_get_enu_f().
|
extern |
Dynamically adjustable, reset to nav_altitude when it is changing.
Definition at line 74 of file nav.c.
Referenced by formation_flight(), nav_init(), nav_set_altitude(), and nav_set_altitude().
|
extern |
Definition at line 51 of file navigation.c.
Referenced by nav_oval_init(), NavApproaching(), NavApproachingFrom(), NavCircleWaypoint(), NavGotoWaypoint(), NavSegment(), and Oval().