Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
vi.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2010 The Paparazzi Team
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 #include "vehicle_interface/vi.h"
23 
24 #include "subsystems/imu.h"
25 #include "subsystems/ahrs.h"
26 #include "subsystems/gps.h"
27 
28 #include "generated/airframe.h"
29 
31 
32 #ifndef VI_TIMEOUT
33 #define VI_TIMEOUT 100
34 #endif
35 
36 void vi_init(void)
37 {
38 
39  vi.enabled = FALSE;
40  vi.timeouted = TRUE;
42 
44  INT_EULERS_ZERO(vi.input.h_sp.attitude);
46  vi.input.v_sp.climb = 0;
47  vi_impl_init();
48 
49 }
50 
51 void vi_periodic(void)
52 {
53 #if (VI_TIMEOUT != 0)
54  if (vi.last_msg < VI_TIMEOUT) {
55  vi.last_msg++;
56  } else {
57  vi.timeouted = TRUE;
59  INT_EULERS_ZERO(vi.input.h_sp.attitude);
61  vi.input.v_sp.climb = 0;
62  }
63 #endif
65 }
66 
67 void vi_set_enabled(bool_t enabled)
68 {
69  vi_impl_set_enabled(enabled);
70 
71 }
72 
73 void vi_update_info(void)
74 {
75 
76 }
void vi_periodic(void)
Definition: vi.c:51
union Vi_command::@22 h_sp
void vi_impl_periodic(void)
Definition: vi_datalink.c:28
struct VehicleInterface vi
Definition: vi.c:30
Dispatcher to register actual AHRS implementations.
void vi_init(void)
Definition: vi.c:36
#define GUIDANCE_H_MODE_ATTITUDE
Definition: guidance_h.h:54
void vi_set_enabled(bool_t enabled)
Definition: vi.c:67
bool_t enabled
Definition: vi.h:78
union Vi_command::@23 v_sp
#define FALSE
Definition: std.h:5
#define TRUE
Definition: std.h:4
Device independent GPS code (interface)
#define GUIDANCE_V_MODE_CLIMB
Definition: guidance_v.h:38
void vi_impl_set_enabled(bool_t enabled)
Definition: vi_datalink.c:32
uint8_t v_mode
Definition: vi.h:74
#define VI_TIMEOUT
Definition: vi.c:33
Inertial Measurement Unit interface.
void vi_update_info(void)
Definition: vi.c:73
#define INT_EULERS_ZERO(_e)
uint8_t last_msg
Definition: vi.h:80
bool_t timeouted
Definition: vi.h:79
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