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