Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
vi_datalink.c
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  * 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 
23 
24 void vi_impl_init(void) {
25 }
26 
27 void vi_impl_periodic(void) {
28 }
29 
30 void vi_impl_set_enabled(bool_t enabled __attribute__ ((unused))) {
31 }
32 
33 #define ViMaxHSpeed ((int16_t)SPEED_BFP_OF_REAL(VI_MAX_H_SPEED))
34 #define ViMaxVSpeed ((int16_t)SPEED_BFP_OF_REAL(VI_MAX_V_SPEED))
35 #define ViMaxHeadingRate ((int16_t)RATE_BFP_OF_REAL(VI_MAX_HEADING_RATE))
36 
38 
39 void vi_update_wp(uint8_t wp_id) {
40  struct Int16Vect3 wp_speed;
41  wp_speed.x = ViMaxHSpeed * vi.input.h_sp.speed.x / 128;
42  wp_speed.y = ViMaxHSpeed * vi.input.h_sp.speed.y / 128;
43  wp_speed.z = ViMaxVSpeed * vi.input.v_sp.climb / 128;
44  VECT3_BOUND_BOX(wp_speed, wp_speed, wp_speed_max);
45  int16_t heading_rate = vi.input.h_sp.speed.z;
46  BoundAbs(heading_rate, ViMaxHeadingRate);
47  navigation_update_wp_from_speed(wp_id , wp_speed, heading_rate);
48 
49 }
struct VehicleInterface vi
Definition: vi.c:30
struct Vi_command input
Definition: vi.h:82
#define VECT3_BOUND_BOX(_v, _v_min, _v_max)
Definition: pprz_algebra.h:202
bool_t enabled
Definition: vi.h:78
signed short int16_t
Definition: types.h:17
union Vi_command::@16 v_sp
unsigned char uint8_t
Definition: types.h:14
union Vi_command::@15 h_sp
int32_t climb
Definition: vi.h:70
struct Int32Vect3 speed
Definition: vi.h:65