Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
vi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 The Paparazzi Team
3  *
4  * This file is part of paparazzi.
5  *
6  * This is the "external interface" to the autopilot. It allows an external device to
7  * fetch the vehicle state and input commands at different levels. We should support
8  * different hardware peripherals like i2c, spi or uart.
9  * For now we only have an implementation using datalink messages.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24  */
25 
26 #ifndef VEHICLE_INTERFACE_H
27 #define VEHICLE_INTERFACE_H
28 
29 #include "std.h"
30 #include "math/pprz_algebra_int.h"
35 
36 struct Vi_imu_info {
37  struct Int16Vect3 gyro;
38  struct Int16Vect3 accel;
39  struct Int16Vect3 mag;
40 };
41 
42 struct Vi_gps_info {
43  struct Int32Vect3 pos;
44  struct Int16Vect3 speed;
48 };
49 
50 struct Vi_ahrs_info {
52  struct Int16Eulers rate;
53 };
54 
55 struct Vi_info {
56  struct Vi_imu_info imu;
57  struct Vi_gps_info gps;
59 };
60 
61 struct Vi_command {
62  union {
63  struct Int32Vect3 rate;
65  struct Int32Vect3 speed; //FIXME Warning z is heading rate
66  struct Int32Vect3 pos; //FIXME Warning z is heading
67  } h_sp;
68  union {
72  } v_sp;
75 };
76 
78  bool_t enabled;
79  bool_t timeouted;
81  struct Vi_info info;
82  struct Vi_command input;
84 };
85 
86 extern struct VehicleInterface vi;
87 
88 extern void vi_init(void);
89 extern void vi_set_enabled(bool_t enabled);
90 extern void vi_periodic(void);
91 extern void vi_update_info(void);
92 
93 extern void vi_notify_imu_available(void);
94 extern void vi_notify_mag_available(void);
95 extern void vi_notify_gps_available(void);
96 extern void vi_notify_baro_abs_available(void);
97 
98 /* must be implemented by specific module */
99 extern void vi_impl_init(void);
100 extern void vi_impl_periodic(void);
101 extern void vi_impl_set_enabled(bool_t enabled);
102 
103 
104 #define vi_SetEnabled(_val) { \
105  vi.enabled = _val; \
106  vi_set_enabled(_val); \
107  }
108 
109 #endif /* VI_H */
uint8_t available_sensors
Definition: vi.h:83
struct Int16Vect3 speed
Definition: vi.h:44
void vi_impl_periodic(void)
Definition: vi_datalink.c:27
struct Int16Eulers euler
Definition: vi.h:51
struct Vi_command input
Definition: vi.h:82
void vi_notify_mag_available(void)
Definition: vi_overo_link.c:91
uint8_t fix
Definition: vi.h:47
struct Int16Eulers rate
Definition: vi.h:52
struct Int32Vect3 rate
Definition: vi.h:63
Definition: vi.h:55
void vi_notify_gps_available(void)
Definition: vi_overo_link.c:87
bool_t timeouted
Definition: vi.h:79
struct Int16Vect3 gyro
Definition: vi.h:37
Autopilot modes.
struct Int16Vect3 accel
Definition: vi.h:38
struct Int16Vect3 mag
Definition: vi.h:39
struct Vi_gps_info gps
Definition: vi.h:57
struct VehicleInterface vi
Definition: vi.c:30
void vi_update_info(void)
Definition: vi.c:70
int32_t height
Definition: vi.h:71
Definition: vi.h:61
int32_t pacc
Definition: vi.h:45
bool_t enabled
Definition: vi.h:78
void vi_impl_set_enabled(bool_t enabled)
Definition: vi_datalink.c:30
void vi_init(void)
Definition: vi.c:36
int32_t direct
Definition: vi.h:69
signed long int32_t
Definition: types.h:19
struct Int32Eulers attitude
Definition: vi.h:64
union Vi_command::@16 v_sp
unsigned char uint8_t
Definition: types.h:14
union Vi_command::@15 h_sp
void vi_notify_baro_abs_available(void)
Definition: vi_overo_link.c:95
uint8_t last_msg
Definition: vi.h:80
int32_t climb
Definition: vi.h:70
uint8_t num_sv
Definition: vi.h:46
General stabilization interface for rotorcrafts.
struct Int32Vect3 speed
Definition: vi.h:65
struct Int32Vect3 pos
Definition: vi.h:66
void vi_notify_imu_available(void)
Definition: vi_overo_link.c:83
Definition: vi.h:36
uint8_t h_mode
Definition: vi.h:73
uint8_t v_mode
Definition: vi.h:74
struct Vi_info info
Definition: vi.h:81
Definition: vi.h:42
void vi_impl_init(void)
Definition: vi_datalink.c:24
struct Vi_imu_info imu
Definition: vi.h:56
struct Vi_ahrs_info ahrs
Definition: vi.h:58
void vi_periodic(void)
Definition: vi.c:50
Paparazzi fixed point algebra.
struct Int32Vect3 pos
Definition: vi.h:43
void vi_set_enabled(bool_t enabled)
Definition: vi.c:65
euler angles