Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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"
31 #include "autopilot.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 */
VehicleInterface::enabled
bool enabled
Definition: vi.h:78
Int16Vect3
Definition: pprz_algebra_int.h:62
Vi_info
Definition: vi.h:55
Vi_imu_info::gyro
struct Int16Vect3 gyro
Definition: vi.h:37
Vi_ahrs_info::euler
struct Int16Eulers euler
Definition: vi.h:51
Vi_gps_info::speed
struct Int16Vect3 speed
Definition: vi.h:44
vi_impl_periodic
void vi_impl_periodic(void)
Definition: vi_datalink.c:28
Vi_info::ahrs
struct Vi_ahrs_info ahrs
Definition: vi.h:58
VehicleInterface::input
struct Vi_command input
Definition: vi.h:82
Vi_ahrs_info::rate
struct Int16Eulers rate
Definition: vi.h:52
Int16Eulers
Definition: pprz_algebra_int.h:137
Vi_command::v_sp
union Vi_command::@303 v_sp
Vi_command::h_sp
union Vi_command::@302 h_sp
vi_init
void vi_init(void)
Definition: vi.c:36
vi_impl_init
void vi_impl_init(void)
Definition: vi_datalink.c:24
VehicleInterface::last_msg
uint8_t last_msg
Definition: vi.h:80
attitude
#define attitude
Definition: cc2500_compat.h:79
pprz_algebra_int.h
Paparazzi fixed point algebra.
VehicleInterface
Definition: vi.h:77
VehicleInterface::info
struct Vi_info info
Definition: vi.h:81
VehicleInterface::available_sensors
uint8_t available_sensors
Definition: vi.h:83
std.h
vi_update_info
void vi_update_info(void)
Definition: vi.c:73
Vi_command::v_mode
uint8_t v_mode
Definition: vi.h:74
Vi_imu_info::mag
struct Int16Vect3 mag
Definition: vi.h:39
Vi_imu_info
Definition: vi.h:36
vi_periodic
void vi_periodic(void)
Definition: vi.c:51
Vi_gps_info
Definition: vi.h:42
Int32Vect3
Definition: pprz_algebra_int.h:88
uint8_t
unsigned char uint8_t
Definition: types.h:14
vi_notify_imu_available
void vi_notify_imu_available(void)
vi
struct VehicleInterface vi
Definition: vi.c:30
vi_impl_set_enabled
void vi_impl_set_enabled(bool enabled)
Definition: vi_datalink.c:32
Int32Eulers
euler angles
Definition: pprz_algebra_int.h:146
guidance.h
Vi_command
Definition: vi.h:61
autopilot.h
Vi_info::imu
struct Vi_imu_info imu
Definition: vi.h:56
Vi_gps_info::pacc
int32_t pacc
Definition: vi.h:45
vi_notify_gps_available
void vi_notify_gps_available(void)
vi_notify_baro_abs_available
void vi_notify_baro_abs_available(void)
Vi_imu_info::accel
struct Int16Vect3 accel
Definition: vi.h:38
int32_t
signed long int32_t
Definition: types.h:19
Vi_gps_info::fix
uint8_t fix
Definition: vi.h:47
Vi_gps_info::pos
struct Int32Vect3 pos
Definition: vi.h:43
navigation.h
Vi_info::gps
struct Vi_gps_info gps
Definition: vi.h:57
Vi_command::h_mode
uint8_t h_mode
Definition: vi.h:73
stabilization.h
vi_notify_mag_available
void vi_notify_mag_available(void)
Vi_ahrs_info
Definition: vi.h:50
Vi_gps_info::num_sv
uint8_t num_sv
Definition: vi.h:46
VehicleInterface::timeouted
bool timeouted
Definition: vi.h:79
vi_set_enabled
void vi_set_enabled(bool enabled)
Definition: vi.c:67