Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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
22
#include "
modules/vehicle_interface/vi_datalink.h
"
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
40
struct
Int16Vect3
wp_speed_max
= {
ViMaxHSpeed
,
ViMaxHSpeed
,
ViMaxVSpeed
};
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
}
VehicleInterface::enabled
bool enabled
Definition:
vi.h:78
Int16Vect3::x
int16_t x
Definition:
pprz_algebra_int.h:63
Int16Vect3
Definition:
pprz_algebra_int.h:62
vi_impl_periodic
void vi_impl_periodic(void)
Definition:
vi_datalink.c:28
ViMaxVSpeed
#define ViMaxVSpeed
Definition:
vi_datalink.c:37
VehicleInterface::input
struct Vi_command input
Definition:
vi.h:82
vi
struct VehicleInterface vi
Definition:
vi.c:30
vi_impl_init
void vi_impl_init(void)
Definition:
vi_datalink.c:24
ViMaxHeadingRate
#define ViMaxHeadingRate
Definition:
vi_datalink.c:38
Vi_command::v_sp
union Vi_command::@303 v_sp
Vi_command::h_sp
union Vi_command::@302 h_sp
navigation_update_wp_from_speed
void navigation_update_wp_from_speed(uint8_t wp, struct Int16Vect3 speed_sp, int16_t heading_rate_sp)
Definition:
navigation.c:389
ViMaxHSpeed
#define ViMaxHSpeed
Definition:
vi_datalink.c:36
Int16Vect3::y
int16_t y
Definition:
pprz_algebra_int.h:64
int16_t
signed short int16_t
Definition:
types.h:17
uint8_t
unsigned char uint8_t
Definition:
types.h:14
VECT3_BOUND_BOX
#define VECT3_BOUND_BOX(_v, _v_min, _v_max)
Definition:
pprz_algebra.h:231
vi_update_wp
void vi_update_wp(uint8_t wp_id)
Definition:
vi_datalink.c:42
vi_impl_set_enabled
void vi_impl_set_enabled(bool enabled)
Definition:
vi_datalink.c:32
Int16Vect3::z
int16_t z
Definition:
pprz_algebra_int.h:65
vi_datalink.h
wp_speed_max
struct Int16Vect3 wp_speed_max
Definition:
vi_datalink.c:40
sw
airborne
modules
vehicle_interface
vi_datalink.c
Generated on Tue Feb 1 2022 13:51:16 for Paparazzi UAS by
1.8.17