38 #include "generated/modules.h"
39 #include "generated/flight_plan.h"
44 #include "pprzlink/messages.h"
64 #if PERIODIC_TELEMETRY
72 pprz_msg_send_WP_MOVED_ENU(trans, dev, AC_ID,
100 #if PERIODIC_TELEMETRY
214 return pos_diff.
x * pos_diff.
x + pos_diff.
y * pos_diff.
y;
230 #ifdef InGeofenceSector
281 #ifdef AP_MODE_FAILSAFE
const float max_dist2_from_home
struct RoverNavigation nav
static bool nav_approaching(struct EnuCoor_f *wp, struct EnuCoor_f *from, float approaching_time)
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void nav_reset_reference(void)
Reset the geographic reference to the current GPS fix.
#define FAILSAFE_MODE_DISTANCE
Maximum distance from HOME waypoint before going into failsafe mode.
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
float dist2_to_home
squared distance to home waypoint
Periodic telemetry system header (includes downlink utility and generated code).
void ins_reset_local_origin(void)
local implemetation of the ins_reset functions
void set_exception_flag(uint8_t flag_num)
static void send_wp_moved(struct transport_tx *trans, struct link_device *dev)
vector in East North Up coordinates Units: meters
#define VECT3_COPY(_a, _b)
#define NormCourseRad(x)
Normalize a rad angle between 0 and 2*PI.
struct EnuCoor_f target
final target
#define VECT2_COPY(_a, _b)
void nav_set_heading_towards_target(void)
Set heading in the direction of the target.
#define VECT2_DIFF(_c, _a, _b)
Integrated Navigation System interface.
void nav_home(void)
Home mode navigation.
void(* nav_rover_circle)(struct EnuCoor_f *wp_center, float radius)
#define DEFAULT_CIRCLE_RADIUS
default nav_circle_radius in meters
void nav_set_heading_current(void)
Set heading to the current yaw angle.
void(* nav_rover_goto)(struct EnuCoor_f *wp)
void nav_register_goto_wp(nav_rover_goto nav_goto, nav_rover_route nav_route, nav_rover_approaching nav_approaching)
Register functions.
bool autopilot_set_mode(uint8_t new_autopilot_mode)
set autopilot mode
void(* nav_rover_route)(struct EnuCoor_f *wp_start, struct EnuCoor_f *wp_end)
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
const float max_dist_from_home
General Navigation structure.
float speed
speed setpoint
void nav_periodic_task(void)
Navigation main: call to the code generated from the XML flight plan.
bool(* nav_rover_approaching)(struct EnuCoor_f *wp_to, struct EnuCoor_f *wp_from, float approaching_time)
float radius
radius setpoint
bool autopilot_in_flight(void)
get in_flight flag
uint8_t last_wp
Index of last waypoint.
Device independent GPS code (interface)
static void nav_goto(struct EnuCoor_f *wp)
Implement basic nav function.
#define NAV_MODE_WAYPOINT
Nav modes.
bool exception_flag[10]
array of flags that might be used in flight plans
float get_dist2_to_point(struct EnuCoor_i *p)
Returns squared horizontal distance to given point.
bool nav_is_in_flight(void)
#define DefaultPeriodic
Set default periodic telemetry.
void nav_register_oval(nav_rover_oval_init nav_oval_init, nav_rover_oval nav_oval)
void nav_register_circle(nav_rover_circle nav_circle)
void nav_set_heading_rad(float rad)
Set nav_heading in radians.
float get_dist2_to_waypoint(uint8_t wp_id)
Returns squared horizontal distance to given waypoint.
float shift
lateral shift (in meters)
void compute_dist2_to_home(void)
Computes squared distance to the HOME waypoint potentially sets too_far_from_home.
float heading
heading setpoint (in radians)
const uint8_t nb_waypoint
static const struct usb_device_descriptor dev
float turn
turn rate setpoint
Core autopilot interface common to all firmwares.
struct EnuCoor_f last_pos
last stage position
void(* nav_rover_oval_init)(void)
void nav_oval(uint8_t p1, uint8_t p2, float radius)
Navigation along a figure O.
API to get/set the generic vehicle states.
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
void nav_circle(struct EnuCoor_i *wp_center, int32_t radius)
void nav_set_heading_deg(float deg)
Set nav_heading in degrees.
nav_rover_circle nav_circle
nav_rover_approaching nav_approaching
Common code for AP and FBW telemetry.
void nav_set_heading_towards_waypoint(uint8_t wp)
Set heading in the direction of a waypoint.
bool too_far_from_home
too_far flag
void nav_route(struct EnuCoor_i *wp_start, struct EnuCoor_i *wp_end)
nav_rover_oval_init nav_oval_init
float failsafe_mode_dist2
maximum squared distance to home wp before going to failsafe mode
void waypoints_localize_all(void)
update local ENU coordinates of global waypoints
struct EnuCoor_f carrot
carrot position
void nav_init(void)
Navigation Initialisation.
nav_rover_route nav_route
void nav_set_failsafe(void)
bool nav_check_wp_time(struct EnuCoor_i *wp, uint16_t stay_time)
Check the time spent in a radius of 'ARRIVED_AT_WAYPOINT' around a wp.
void ins_reset_altitude_ref(void)
INS altitude reference reset.
void nav_set_heading_towards(float x, float y)
Set heading to point towards x,y position in local coordinates.
Rover navigation functions.
void waypoints_init(void)
initialize global and local waypoints
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Paparazzi fixed point algebra.
void(* nav_rover_oval)(struct EnuCoor_f *wp1, struct EnuCoor_f *wp2, float radius)
void nav_init_stage(void)
needs to be implemented by fixedwing and rotorcraft seperately