Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
nps_sensor_aoa.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2016 Johan Maurin, Gautier Hattenberger
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, see
18
* <http://www.gnu.org/licenses/>.
19
*/
20
28
#include "
nps_sensor_aoa.h
"
29
30
#include "generated/airframe.h"
31
32
#include "
std.h
"
33
#include "
nps_fdm.h
"
34
#include "
nps_random.h
"
35
#include NPS_SENSORS_PARAMS
36
38
#ifndef NPS_AOA_DT
39
#define NPS_AOA_DT 0.01
40
#endif
41
43
#ifndef NPS_AOA_NOISE_STD_DEV
44
#define NPS_AOA_NOISE_STD_DEV 0.001
45
#endif
46
47
#ifndef NPS_AOA_OFFSET
48
#define NPS_AOA_OFFSET 0
49
#endif
50
51
52
void
nps_sensor_aoa_init
(
struct
NpsSensorAngleOfAttack
*aoa,
double
time)
53
{
54
aoa->
value
= 0.;
55
aoa->
offset
=
NPS_AOA_OFFSET
;
56
aoa->
noise_std_dev
=
NPS_AOA_NOISE_STD_DEV
;
57
aoa->
next_update
= time;
58
aoa->
data_available
=
FALSE
;
59
}
60
61
62
void
nps_sensor_aoa_run_step
(
struct
NpsSensorAngleOfAttack
*aoa,
double
time)
63
{
64
65
if
(time < aoa->next_update) {
66
return
;
67
}
68
69
/* equivalent airspeed + sensor offset */
70
aoa->
value
=
fdm
.
aoa
+ aoa->
offset
;
71
/* add noise with std dev rad */
72
aoa->
value
+=
get_gaussian_noise
() * aoa->
noise_std_dev
;
73
74
aoa->
next_update
+=
NPS_AOA_DT
;
75
aoa->
data_available
=
TRUE
;
76
}
77
NpsSensorAngleOfAttack::next_update
double next_update
Definition:
nps_sensor_aoa.h:40
nps_sensor_aoa.h
NpsSensorAngleOfAttack::value
double value
angle of attack reading in radian
Definition:
nps_sensor_aoa.h:37
nps_fdm.h
nps_sensor_aoa_run_step
void nps_sensor_aoa_run_step(struct NpsSensorAngleOfAttack *aoa, double time)
Definition:
nps_sensor_aoa.c:62
fdm
struct NpsFdm fdm
Holds all necessary NPS FDM state information.
Definition:
nps_fdm_crrcsim.c:84
std.h
NpsSensorAngleOfAttack
Definition:
nps_sensor_aoa.h:36
nps_sensor_aoa_init
void nps_sensor_aoa_init(struct NpsSensorAngleOfAttack *aoa, double time)
Definition:
nps_sensor_aoa.c:52
nps_random.h
NPS_AOA_OFFSET
#define NPS_AOA_OFFSET
Definition:
nps_sensor_aoa.c:48
NpsSensorAngleOfAttack::data_available
bool data_available
Definition:
nps_sensor_aoa.h:41
NpsSensorAngleOfAttack::noise_std_dev
double noise_std_dev
noise standard deviation
Definition:
nps_sensor_aoa.h:39
get_gaussian_noise
double get_gaussian_noise(void)
Definition:
nps_random.c:109
NpsFdm::aoa
double aoa
angle of attack in rad
Definition:
nps_fdm.h:115
FALSE
#define FALSE
Definition:
std.h:5
TRUE
#define TRUE
Definition:
std.h:4
NPS_AOA_NOISE_STD_DEV
#define NPS_AOA_NOISE_STD_DEV
standard deviation in radian (default 0.001 rad)
Definition:
nps_sensor_aoa.c:44
NpsSensorAngleOfAttack::offset
double offset
offset in meters/second
Definition:
nps_sensor_aoa.h:38
NPS_AOA_DT
#define NPS_AOA_DT
10Hz default
Definition:
nps_sensor_aoa.c:39
sw
simulator
nps
nps_sensor_aoa.c
Generated on Tue Feb 1 2022 13:51:18 for Paparazzi UAS by
1.8.17