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