Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces 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;
64  struct Int32Eulers attitude;
65  struct Int32Vect3 speed; //FIXME Warning z is heading rate
66  struct Int32Vect3 pos; //FIXME Warning z is heading
67  } h_sp;
68  union {
69  int32_t direct;
70  int32_t climb;
71  int32_t height;
72  } v_sp;
75 };
76 
78  bool enabled;
79  bool 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 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 enabled);
102 
103 
104 #define vi_SetEnabled(_val) { \
105  vi.enabled = _val; \
106  vi_set_enabled(_val); \
107  }
108 
109 #endif /* VI_H */
struct Int32Vect3 pos
Definition: vi.h:43
struct Int16Vect3 speed
Definition: vi.h:44
void vi_impl_periodic(void)
Definition: vi_datalink.c:28
void vi_notify_mag_available(void)
void vi_notify_gps_available(void)
union Vi_command::@289 h_sp
struct Int16Vect3 accel
Definition: vi.h:38
struct Vi_info info
Definition: vi.h:81
Autopilot modes.
uint8_t fix
Definition: vi.h:47
struct Vi_gps_info gps
Definition: vi.h:57
uint8_t available_sensors
Definition: vi.h:83
Definition: vi.h:42
struct VehicleInterface vi
Definition: vi.c:30
void vi_update_info(void)
Definition: vi.c:73
uint8_t num_sv
Definition: vi.h:46
Definition: vi.h:61
void vi_set_enabled(bool enabled)
Definition: vi.c:67
euler angles
struct Int16Vect3 gyro
Definition: vi.h:37
bool timeouted
Definition: vi.h:79
void vi_init(void)
Definition: vi.c:36
uint8_t v_mode
Definition: vi.h:74
struct Int16Eulers euler
Definition: vi.h:51
bool enabled
Definition: vi.h:78
Definition: vi.h:36
void vi_impl_set_enabled(bool enabled)
Definition: vi_datalink.c:32
struct Vi_ahrs_info ahrs
Definition: vi.h:58
signed long int32_t
Definition: types.h:19
union Vi_command::@290 v_sp
unsigned char uint8_t
Definition: types.h:14
void vi_notify_baro_abs_available(void)
struct Vi_imu_info imu
Definition: vi.h:56
General stabilization interface for rotorcrafts.
uint8_t last_msg
Definition: vi.h:80
void vi_notify_imu_available(void)
struct Int16Eulers rate
Definition: vi.h:52
int32_t pacc
Definition: vi.h:45
struct Vi_command input
Definition: vi.h:82
uint8_t h_mode
Definition: vi.h:73
void vi_impl_init(void)
Definition: vi_datalink.c:24
struct Int16Vect3 mag
Definition: vi.h:39
void vi_periodic(void)
Definition: vi.c:51
Paparazzi fixed point algebra.
Definition: vi.h:55