![]() |
Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Rover navigation functions. More...
#include "std.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"
Go to the source code of this file.
Data Structures | |
struct | RoverNavigation |
General Navigation structure. More... | |
Typedefs | |
typedef void(* | nav_rover_goto) (struct EnuCoor_f *wp) |
typedef void(* | nav_rover_route) (struct EnuCoor_f *wp_start, struct EnuCoor_f *wp_end) |
typedef bool(* | nav_rover_approaching) (struct EnuCoor_f *wp_to, struct EnuCoor_f *wp_from, float approaching_time) |
typedef void(* | nav_rover_circle) (struct EnuCoor_f *wp_center, float radius) |
typedef void(* | nav_rover_oval_init) (void) |
typedef void(* | nav_rover_oval) (struct EnuCoor_f *wp1, struct EnuCoor_f *wp2, float radius) |
Variables | |
struct RoverNavigation | nav |
Rover navigation functions.
Definition in file navigation.h.
struct RoverNavigation |
General Navigation structure.
Definition at line 88 of file navigation.h.
Data Fields | ||
---|---|---|
struct EnuCoor_f | carrot | carrot position |
float | dist2_to_home | squared distance to home waypoint |
bool | exception_flag[10] | array of flags that might be used in flight plans |
float | failsafe_mode_dist2 | maximum squared distance to home wp before going to failsafe mode |
float | heading | heading setpoint (in radians) |
struct EnuCoor_f | last_pos | last stage position |
uint8_t | mode | |
nav_rover_approaching | nav_approaching | |
nav_rover_circle | nav_circle | |
nav_rover_goto | nav_goto | |
nav_rover_oval | nav_oval | |
nav_rover_oval_init | nav_oval_init | |
nav_rover_route | nav_route | |
float | radius | radius setpoint |
float | shift | lateral shift (in meters) |
float | speed | speed setpoint |
struct EnuCoor_f | target | final target |
bool | too_far_from_home | too_far flag |
float | turn | turn rate setpoint |
#define ARRIVED_AT_WAYPOINT 3.0f |
minimum horizontal distance to waypoint to mark as arrived
Definition at line 63 of file navigation.h.
default approaching_time for a wp
Definition at line 39 of file navigation.h.
Definition at line 43 of file navigation.h.
#define DEFAULT_CIRCLE_RADIUS 6.0f |
default nav_circle_radius in meters
Definition at line 58 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 68 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 147 of file navigation.h.
#define GetPosAlt | ( | ) | (stateGetPositionEnu_f()->z+stateGetHmslOrigin_f()) |
Get current altitude above MSL.
Definition at line 138 of file navigation.h.
#define GetPosHeight | ( | ) | (stateGetPositionEnu_f()->z) |
Get current height above reference.
Definition at line 140 of file navigation.h.
#define GetPosX | ( | ) | (stateGetPositionEnu_f()->x) |
Get current x (east) position in local coordinates.
Definition at line 134 of file navigation.h.
#define GetPosY | ( | ) | (stateGetPositionEnu_f()->y) |
Get current y (north) position in local coordinates.
Definition at line 136 of file navigation.h.
#define NAV_MODE_CIRCLE 2 |
Definition at line 74 of file navigation.h.
#define NAV_MODE_HEADING 3 |
Definition at line 75 of file navigation.h.
#define NAV_MODE_MANUAL 4 |
Definition at line 76 of file navigation.h.
#define NAV_MODE_ROUTE 1 |
Definition at line 73 of file navigation.h.
#define NAV_MODE_WAYPOINT 0 |
Nav modes.
Definition at line 72 of file navigation.h.
Definition at line 220 of file navigation.h.
#define NavCheckWaypointTime | ( | wp, | |
time | |||
) | nav_check_wp_time(&waypoints[wp].enu_f, time) |
Definition at line 212 of file navigation.h.
#define NavCopyWaypoint waypoint_copy |
Definition at line 206 of file navigation.h.
#define NavCopyWaypointPositionOnly waypoint_position_copy |
Definition at line 207 of file navigation.h.
#define NavFollow nav_follow(_id, _dist, _height) {} |
Definition at line 312 of file navigation.h.
Unused compat macros.
Definition at line 318 of file navigation.h.
#define NavHeading nav_set_heading_rad |
Set the heading of the rover, nothing else.
Definition at line 233 of file navigation.h.
#define NAVIGATION_FREQUENCY 20 |
default navigation frequency
Definition at line 51 of file navigation.h.
Settings handlers.
Definition at line 306 of file navigation.h.
#define navigation_SetNavRadius | ( | x | ) | { if (x==1) nav.radius = DEFAULT_CIRCLE_RADIUS; else if (x==-1) nav.radius = -DEFAULT_CIRCLE_RADIUS; else nav.radius = x; } |
Definition at line 308 of file navigation.h.
#define NavSetAltitudeReferenceHere nav_reset_alt |
Definition at line 203 of file navigation.h.
#define NavSetFailsafe nav_set_failsafe |
Definition at line 200 of file navigation.h.
#define NavSetGroundReferenceHere nav_reset_reference |
Definition at line 202 of file navigation.h.
Definition at line 235 of file navigation.h.
#define NavSetWaypointHere waypoint_set_here_2d |
Definition at line 205 of file navigation.h.
#define NavVerticalAltitudeMode | ( | _alt, | |
_pre_climb | |||
) | {} |
Definition at line 321 of file navigation.h.
Definition at line 320 of file navigation.h.
Definition at line 319 of file navigation.h.
Definition at line 322 of file navigation.h.
#define NormCourse | ( | x | ) |
Normalize a degree angle between 0 and 359.
Definition at line 151 of file navigation.h.
#define NormCourseRad | ( | x | ) |
typedef bool(* nav_rover_approaching) (struct EnuCoor_f *wp_to, struct EnuCoor_f *wp_from, float approaching_time) |
Definition at line 80 of file navigation.h.
Definition at line 81 of file navigation.h.
Definition at line 78 of file navigation.h.
Definition at line 83 of file navigation.h.
Definition at line 82 of file navigation.h.
Definition at line 79 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.
References p, pos_diff, stateGetPositionEnu_f(), FloatVect2::x, EnuCoor_f::x, FloatVect2::y, and EnuCoor_f::y.
Referenced by get_dist2_to_waypoint(), nav_goto(), nav_goto(), nav_hybrid_goto(), nav_hybrid_route(), nav_route(), and nav_route().
Returns squared horizontal distance to given waypoint.
Definition at line 318 of file navigation.c.
References get_dist2_to_point(), and waypoints.
Referenced by compute_dist2_to_home().
Check the time spent in a radius of 'ARRIVED_AT_WAYPOINT' around a wp
Definition at line 135 of file navigation.c.
References foo.
Home mode navigation (circle around HOME)
Home mode navigation (circle around HOME)
Nominal speed
Nominal speed
Nominal speed
Definition at line 424 of file nav.c.
References autopilot, compute_dist2_to_home(), dist2_to_home, dist2_to_wp, FAILSAFE_HOME_RADIUS, foo, ground_alt, RotorcraftNavigation::horizontal_mode, pprz_autopilot::launch, nav, nav_altitude, RotorcraftNavigation::nav_altitude, NAV_HORIZONTAL_MODE_WAYPOINT, NAV_MODE_WAYPOINT, nav_pitch, nav_run(), nav_set_altitude(), NAV_SETPOINT_MODE_POS, NAV_VERTICAL_MODE_ALT, NavCircleWaypoint, RotorcraftNavigation::setpoint_mode, RotorcraftNavigation::target, v_ctl_mode, V_CTL_MODE_AUTO_ALT, V_CTL_MODE_AUTO_THROTTLE, v_ctl_throttle_setpoint, VECT3_COPY, RotorcraftNavigation::vertical_mode, waypoint_get_alt(), and waypoints.
Referenced by autopilot_static_periodic(), and navigation_task().
Navigation Initialisation.
Definition at line 532 of file nav.c.
References RotorcraftNavigation::accel, RotorcraftNavigation::carrot, RotorcraftNavigation::climb, RotorcraftNavigation::climb_vspeed, common_flight_plan_init(), DEFAULT_CIRCLE_RADIUS, DefaultPeriodic, RotorcraftNavigation::descend_vspeed, RotorcraftNavigation::dist2_to_home, empty_approaching(), empty_circle(), empty_goto(), empty_oval(), empty_oval_init(), empty_route(), empty_stage_init(), RotorcraftNavigation::failsafe_mode_dist2, FAILSAFE_MODE_DISTANCE, flight_altitude, float_quat_identity(), FLOAT_RATES_ZERO, FLOAT_VECT3_ZERO, foo, RotorcraftNavigation::fp_altitude, fp_climb, RotorcraftNavigation::fp_max_speed, fp_pitch, fp_throttle, ground_alt, RotorcraftNavigation::heading, RotorcraftNavigation::horizontal_mode, nav, RotorcraftNavigation::nav_altitude, RotorcraftNavigation::nav_approaching, RotorcraftNavigation::nav_circle, NAV_CLIMB_VSPEED, NAV_DESCEND_VSPEED, nav_glide_pitch_trim, NAV_GLIDE_PITCH_TRIM, RotorcraftNavigation::nav_goto, nav_ground_speed_pgain, nav_ground_speed_setpoint, NAV_HORIZONTAL_MODE_WAYPOINT, nav_mode, NAV_MODE_COURSE, NAV_MODE_WAYPOINT, RotorcraftNavigation::nav_oval, RotorcraftNavigation::nav_oval_init, nav_radius, RotorcraftNavigation::nav_route, NAV_SETPOINT_MODE_POS, RotorcraftNavigation::nav_stage_init, nav_survey_shift, NAV_VERTICAL_MODE_ALT, RotorcraftNavigation::pitch, RotorcraftNavigation::quat, RotorcraftNavigation::radius, RotorcraftNavigation::rates, register_periodic_telemetry(), RotorcraftNavigation::roll, send_circle(), send_nav(), send_nav_ref(), send_segment(), send_survey(), send_wp_moved(), send_wp_moved(), RotorcraftNavigation::setpoint_mode, RotorcraftNavigation::speed, RotorcraftNavigation::target, RotorcraftNavigation::throttle, RotorcraftNavigation::too_far_from_home, VECT3_COPY, RotorcraftNavigation::vertical_mode, waypoints, and waypoints_init().
Definition at line 277 of file navigation.c.
References autopilot_in_flight().
Referenced by follow_me(), and nav_land_run().
Definition at line 289 of file navigation.h.
References nav, and RotorcraftNavigation::nav_oval_init.
Definition at line 115 of file navigation.c.
References foo, and nav_goto_block().
Definition at line 121 of file navigation.c.
References LlaCoor_i::alt, foo, LlaCoor_i::lat, LlaCoor_i::lon, stateGetHmslOrigin_i(), stateGetLlaOrigin_i(), stateIsLocalCoordinateValid(), and waypoint_move_lla().
Navigation main: call to the code generated from the XML flight plan.
Definition at line 445 of file nav.c.
References block_time, circle_bank, compute_dist2_to_home(), dist2_to_wp, foo, h_ctl_course_pre_bank, nav_in_circle, nav_run(), nav_set_altitude(), nav_survey_active, NAVIGATION_FREQUENCY, stage_time, V_CTL_AUTO_THROTTLE_STANDARD, v_ctl_auto_throttle_submode, v_ctl_mode, and V_CTL_MODE_AUTO_CLIMB.
Referenced by autopilot_static_periodic(), and navigation_task().
|
extern |
Definition at line 399 of file navigation.c.
References nav, RotorcraftNavigation::nav_circle, and nav_circle().
Referenced by nav_rotorcraft_hybrid_init(), nav_rotorcraft_init(), and nav_rover_init().
|
extern |
Registering functions.
Registering functions.
Definition at line 392 of file navigation.c.
References nav, RotorcraftNavigation::nav_approaching, nav_approaching(), RotorcraftNavigation::nav_goto, nav_goto(), RotorcraftNavigation::nav_route, and nav_route().
Referenced by nav_rotorcraft_hybrid_init(), nav_rotorcraft_init(), and nav_rover_init().
|
extern |
Definition at line 404 of file navigation.c.
References _nav_oval_init(), nav, nav_oval(), RotorcraftNavigation::nav_oval, nav_oval_init(), and RotorcraftNavigation::nav_oval_init.
Referenced by nav_rotorcraft_init(), and nav_rover_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.
References RotorcraftNavigation::carrot, nav, nav_advance_carrot(), nav_set_altitude(), RotorcraftNavigation::target, and VECT2_COPY.
Referenced by nav_home(), and nav_periodic_task().
Definition at line 380 of file navigation.c.
References AP_MODE_FAILSAFE, and autopilot_set_mode().
Set heading to the current yaw angle.
Definition at line 375 of file navigation.c.
References RotorcraftNavigation::heading, nav, FloatEulers::psi, and stateGetNedToBodyEulers_f().
Set nav_heading in degrees.
Definition at line 344 of file navigation.c.
References foo, and nav_set_heading_rad().
Referenced by nav_survey_poly_setup(), and nav_survey_rectangle_rotorcraft_setup().
heading utility functions
heading utility functions
Definition at line 337 of file navigation.c.
References RotorcraftNavigation::heading, nav, and NormCourseRad.
Referenced by nav_set_heading_deg(), and stereocam_droplet_periodic().
Set heading to point towards x,y position in local coordinates.
Definition at line 350 of file navigation.c.
References foo, RotorcraftNavigation::heading, nav, pos_diff, stateGetPositionEnu_f(), target, VECT2_DIFF, VECT2_NORM2, FloatVect2::x, and FloatVect2::y.
Referenced by nav_set_heading_towards_target(), and nav_set_heading_towards_waypoint().
Set heading in the direction of the target.
Definition at line 369 of file navigation.c.
References nav, nav_set_heading_towards(), RotorcraftNavigation::target, EnuCoor_f::x, and EnuCoor_f::y.
Set heading in the direction of a waypoint.
Definition at line 363 of file navigation.c.
References nav_set_heading_towards(), WaypointX, and WaypointY.
Definition at line 259 of file navigation.h.
References foo, nav, RotorcraftNavigation::nav_approaching, and waypoints.
Definition at line 269 of file navigation.h.
References foo, nav, RotorcraftNavigation::nav_approaching, and waypoints.
Definition at line 280 of file navigation.h.
References nav, RotorcraftNavigation::nav_circle, NAV_MODE_CIRCLE, RoverNavigation::radius, and waypoints.
Definition at line 243 of file navigation.h.
References nav, NAV_MODE_WAYPOINT, RotorcraftNavigation::target, VECT3_COPY, and waypoints.
Definition at line 191 of file navigation.h.
References AP_MODE_NAV, autopilot_get_mode(), and autopilot_set_motors_on().
Definition at line 195 of file navigation.h.
References AP_MODE_NAV, autopilot_get_mode(), and autopilot_set_motors_on().
Definition at line 251 of file navigation.h.
References foo, nav, NAV_MODE_ROUTE, RotorcraftNavigation::nav_route, and waypoints.
Definition at line 296 of file navigation.h.
References foo, nav, RotorcraftNavigation::nav_oval, RoverNavigation::radius, and waypoints.
Definition at line 57 of file navigation.c.
|
extern |
Definition at line 51 of file navigation.c.
Referenced by autopilot_static_on_rc_frame(), autopilot_static_periodic(), compute_dist2_to_home(), follow_diagonal_approach(), follow_me(), guidance_h_from_nav(), guidance_h_nav_enter(), guidance_h_update_reference(), guidance_indi_enter(), guidance_pid_h_enter(), guidance_v_from_nav(), gvf_control_2D(), increase_nav_heading(), increase_nav_heading(), ins_ekf2_publish_attitude(), mission_nav_circle(), mission_nav_path(), mission_nav_segment(), mission_nav_wp(), nav_advance_carrot(), nav_circle(), nav_circle(), nav_goto(), nav_goto(), nav_heli_spinup_run(), nav_heli_spinup_setup(), nav_home(), nav_hybrid_circle(), nav_hybrid_goto(), nav_hybrid_route(), nav_init(), nav_init_stage(), nav_land_run(), nav_oval(), nav_register_circle(), nav_register_circle(), nav_register_goto_wp(), nav_register_goto_wp(), nav_register_oval(), nav_register_oval(), nav_register_stage_init(), nav_route(), nav_route(), nav_run(), nav_set_altitude(), nav_set_heading_current(), nav_set_heading_rad(), nav_set_heading_towards(), nav_set_heading_towards_target(), nav_survey_hybrid_run(), nav_survey_poly_run(), nav_survey_rectangle_rotorcraft_run(), nav_survey_rectangle_rotorcraft_setup(), object_tracking_run(), oneloop_from_nav(), rotorcraft_cam_periodic(), run_avoid_navigation_onvision(), send_fp(), send_nav_status(), send_nav_status(), set_exception_flag(), and stereocam_droplet_periodic().