28 #include "generated/flight_plan.h"
63 #ifdef InGeofenceSector
78 if (dist_to_home > 1.f) {
85 float wind_to_home = (wind.
x * vect_to_home.
x + wind.
y * vect_to_home.
y) / dist_to_home;
87 float airspeed = NOMINAL_AIRSPEED;
92 float gspeed_to_home = wind_to_home + airspeed;
93 if (gspeed_to_home > 1.) {
94 return dist_to_home / gspeed_to_home;
164 for (i = 0; i < NB_WAYPOINT; i++) {
float get_time_to_home(void)
Compute time to home use wind and airspeed when available.
void common_nav_periodic_task()
void nav_reset_reference(void)
Reset the geographic reference to the current GPS fix.
void nav_send_waypoint(uint8_t wp_id)
Send a waypoint throught default telemetry channel.
void nav_reset_alt(void)
Reset the altitude reference to the current GPS alt.
void compute_dist2_to_home(void)
Computes squared distance to the HOME waypoint.
void nav_move_waypoint_point(uint8_t wp_id, struct point *p)
Move a waypoint from point structure (local frame).
float ground_alt
size == nb_waypoint, waypoint 0 is a dummy waypoint
void nav_move_waypoint_enu(uint8_t wp_id, float x, float y, float alt)
Move a waypoint in local frame.
void nav_reset_utm_zone(void)
Reset the UTM zone to current GPS fix.
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
const uint8_t nb_waypoint
static float previous_ground_alt
void nav_move_waypoint(uint8_t wp_id, float ux, float uy, float alt)
Move a waypoint to given UTM coordinates.
void nav_update_waypoints_alt(void)
Shift altitude of the waypoint according to a new ground altitude.
Common code for AP and FBW telemetry.
struct GpsState gps
global GPS state
Device independent GPS code (interface)
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over MSL)
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
#define GPS_VALID_POS_UTM_BIT
static float float_vect2_norm(struct FloatVect2 *v)
uint8_t zone
UTM zone number.
static struct UtmCoor_f * stateGetUtmOrigin_f(void)
Get the coordinate UTM frame origin (int)
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
static void stateSetLocalUtmOrigin_f(uint16_t id, struct UtmCoor_f *utm_def)
Set the local (flat earth) coordinate frame origin from UTM (float).
float stateGetHmslOrigin_f(void)
Get the HMSL of the frame origin (float)
static bool stateIsWindspeedValid(void)
test if wind speed is available.
static bool stateIsAirspeedValid(void)
test if air speed is available.
static float stateGetAirspeed_f(void)
Get airspeed (float).
static struct FloatVect2 * stateGetHorizontalWindspeed_f(void)
Get horizontal windspeed (float).
Integrated Navigation System interface.
#define INS_RESET_VERTICAL_REF
#define INS_RESET_REF
flags for INS reset
#define NAVIGATION_FREQUENCY
Default fixedwing navigation frequency.
void lla_of_utm_f(struct LlaCoor_f *lla, struct UtmCoor_f *utm)
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)
Paparazzi floating point math for geodetic calculations.
float alt
in meters (normally above WGS84 reference ellipsoid)
float alt
in meters (above WGS84 reference ellipsoid or above MSL)
uint8_t zone
UTM zone number.
vector in East North Up coordinates Units: meters
vector in Latitude, Longitude and Altitude
position in UTM coordinates Units: meters
API to get/set the generic vehicle states.
int int32_t
Typedef defining 32 bit int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.