Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
common_nav.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2007-2009 ENAC, Pascal Brisset, Antoine Drouin
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
24 
25 #ifndef COMMON_NAV_H
26 #define COMMON_NAV_H
27 
28 #include "std.h"
30 
31 extern float max_dist_from_home;
32 extern float dist2_to_home;
33 extern float dist2_to_wp;
34 extern bool_t too_far_from_home;
35 
36 struct point {
37  float x;
38  float y;
39  float a;
40 };
41 
42 #define WaypointX(_wp) (waypoints[_wp].x)
43 #define WaypointY(_wp) (waypoints[_wp].y)
44 #define WaypointAlt(_wp) (waypoints[_wp].a)
45 #define Height(_h) (_h + ground_alt)
46 
47 extern void nav_move_waypoint(uint8_t wp_id, float utm_east, float utm_north, float alt);
48 
49 extern const uint8_t nb_waypoint;
50 extern struct point waypoints[];
53 extern float ground_alt; /* m */
54 
55 extern int32_t nav_utm_east0; /* m */
56 extern int32_t nav_utm_north0; /* m */
57 extern uint8_t nav_utm_zone0;
58 
59 
60 void compute_dist2_to_home(void);
61 unit_t nav_reset_reference( void ) __attribute__ ((unused));
62 unit_t nav_update_waypoints_alt( void ) __attribute__ ((unused));
64 
65 
66 #define NavSetGroundReferenceHere() ({ nav_reset_reference(); nav_update_waypoints_alt(); FALSE; })
67 
68 #define NavSetWaypointHere(_wp) ({ \
69  waypoints[_wp].x = estimator_x; \
70  waypoints[_wp].y = estimator_y; \
71  FALSE; \
72 })
73 
74 #endif /* COMMON_NAV_H */
float max_dist_from_home
Definition: common_nav.c:44
void compute_dist2_to_home(void)
Computes square distance to the HOME waypoint potentially sets too_far_from_home. ...
Definition: common_nav.c:49
const uint8_t nb_waypoint
Definition: navigation.c:38
float dist2_to_home
Definition: common_nav.c:31
float a
Definition: common_nav.h:39
float ground_alt
size == nb_waypoint, waypoint 0 is a dummy waypoint
Definition: navigation.c:49
void common_nav_periodic_task_4Hz(void)
Definition: common_nav.c:97
uint8_t nav_utm_zone0
Definition: common_nav.c:43
int32_t nav_utm_north0
Definition: common_nav.c:42
unit_t nav_reset_reference(void) __attribute__((unused))
Reset the geographic reference to the current GPS fix.
Definition: navigation.c:253
signed long int32_t
Definition: types.h:19
struct point waypoints[]
Definition: navigation.c:40
unsigned char uint8_t
Definition: types.h:14
float y
Definition: common_nav.h:38
void nav_move_waypoint(uint8_t wp_id, float utm_east, float utm_north, float alt)
Definition: common_nav.c:101
float dist2_to_wp
Definition: common_nav.c:32
__attribute__((always_inline))
Definition: i2c_arch.c:35
float x
Definition: common_nav.h:37
bool_t too_far_from_home
Definition: common_nav.c:34
int32_t nav_utm_east0
Definition: common_nav.c:41
unit_t nav_update_waypoints_alt(void) __attribute__((unused))
Shift altitude of the waypoint according to a new ground altitude.
Definition: common_nav.c:89