Paparazzi UAS  v5.15_devel-99-g2ff7410
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces 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 
28 void vi_impl_periodic(void)
29 {
30 }
31 
32 void vi_impl_set_enabled(bool enabled __attribute__((unused)))
33 {
34 }
35 
36 #define ViMaxHSpeed ((int16_t)SPEED_BFP_OF_REAL(VI_MAX_H_SPEED))
37 #define ViMaxVSpeed ((int16_t)SPEED_BFP_OF_REAL(VI_MAX_V_SPEED))
38 #define ViMaxHeadingRate ((int16_t)RATE_BFP_OF_REAL(VI_MAX_HEADING_RATE))
39 
41 
42 void vi_update_wp(uint8_t wp_id)
43 {
44  struct Int16Vect3 wp_speed;
45  wp_speed.x = ViMaxHSpeed * vi.input.h_sp.speed.x / 128;
46  wp_speed.y = ViMaxHSpeed * vi.input.h_sp.speed.y / 128;
47  wp_speed.z = ViMaxVSpeed * vi.input.v_sp.climb / 128;
48  VECT3_BOUND_BOX(wp_speed, wp_speed, wp_speed_max);
49  int16_t heading_rate = vi.input.h_sp.speed.z;
50  BoundAbs(heading_rate, ViMaxHeadingRate);
51  navigation_update_wp_from_speed(wp_id , wp_speed, heading_rate);
52 
53 }
struct VehicleInterface vi
Definition: vi.c:30
union Vi_command::@298 v_sp
union Vi_command::@297 h_sp
signed short int16_t
Definition: types.h:17
#define VECT3_BOUND_BOX(_v, _v_min, _v_max)
Definition: pprz_algebra.h:231
bool enabled
Definition: vi.h:78
unsigned char uint8_t
Definition: types.h:14
void navigation_update_wp_from_speed(uint8_t wp, struct Int16Vect3 speed_sp, int16_t heading_rate_sp)
Definition: navigation.c:384
struct Vi_command input
Definition: vi.h:82