Paparazzi UAS  v5.15_devel-81-gd13dafb
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 
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
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
union Vi_command::@298 v_sp
union Vi_command::@297 h_sp
#define GUIDANCE_H_MODE_ATTITUDE
Definition: guidance_h.h:58
Device independent GPS code (interface)
#define GUIDANCE_V_MODE_CLIMB
Definition: guidance_v.h:38
bool timeouted
Definition: vi.h:79
uint8_t v_mode
Definition: vi.h:74
#define VI_TIMEOUT
Definition: vi.c:33
bool enabled
Definition: vi.h:78
Inertial Measurement Unit interface.
void vi_impl_set_enabled(bool enabled)
Definition: vi_datalink.c:32
void vi_update_info(void)
Definition: vi.c:73
#define INT_EULERS_ZERO(_e)
uint8_t last_msg
Definition: vi.h:80
struct Vi_command input
Definition: vi.h:82
void vi_set_enabled(bool enabled)
Definition: vi.c:67
uint8_t h_mode
Definition: vi.h:73
void vi_impl_init(void)
Definition: vi_datalink.c:24