Larus glider flight sensor system 3.9.2024
Software-In-The-Loop test and validation system
Loading...
Searching...
No Matches
navigator.h
Go to the documentation of this file.
1/***********************************************************************/
25#ifndef NAVIGATORT_H_
26#define NAVIGATORT_H_
27
29#include <AHRS.h>
31#include <variometer.h>
32#include "GNSS.h"
33#include "differentiator.h"
34#include "atmosphere.h"
35#include "data_structures.h"
37#include "airborne_detector.h"
38#include "wind_observer.h"
39
42{
43public:
45 :ahrs (0.01f),
47 ahrs_magnetic (0.01f),
48#endif
49 atmosphere (101325.0f),
50 flight_observer(),
51 wind_observer(),
52 airborne_detector(),
53 air_pressure_resampler_100Hz_10Hz(0.04f), // f / fcutoff = 80% * 0.5 * 0.1
54 pitot_pressure(0.0f),
55 TAS( 0.0f),
56 IAS( 0.0f),
57 GNSS_velocity(),
58 GNSS_speed(),
59 GNSS_acceleration(),
60 GNSS_heading(),
61 GNSS_negative_altitude( ZERO),
62 GNSS_fix_type( 0),
63 vario_integrator( configuration( VARIO_INT_TC) < 0.25f
64 ? configuration( VARIO_INT_TC) // normalized stop frequency given, old version
65 : (FAST_SAMPLING_TIME / configuration( VARIO_INT_TC) ) ), // time-constant given, new version
66 TAS_averager(1.0f / 1.0f / 100.0f),
67 IAS_averager(1.0f / 1.0f / 100.0f)
68 {};
69
70 void update_magnetic_induction_data( float declination, float inclination)
71 {
72 ahrs.update_magnetic_induction_data( declination, inclination);
73#if DEVELOPMENT_ADDITIONS
74 ahrs_magnetic.update_magnetic_induction_data( declination, inclination);
75#endif
76 }
77
78 void set_density_data( float temperature, float humidity)
79 {
80 if( ! isnan( temperature) && ! isnan( humidity) )
81 atmosphere.set_ambient_air_data( CLIP( temperature, -40.0f, 50.0f), CLIP( humidity, 0.0f, 1.0f));
82 else
83 atmosphere.disregard_ambient_air_data();
84 }
89
90 void feed_QFF_density_metering( float pressure, float MSL_altitude)
91 {
92 atmosphere.feed_QFF_density_metering( pressure, MSL_altitude);
93 }
94
96 {
97 atmosphere.disregard_ambient_air_data();
98 }
99
101
102 void set_from_add_mag ( const float3vector &acc, const float3vector &mag)
103 {
104 ahrs.attitude_setup(acc, mag);
105 }
106 void set_from_euler ( float r, float n, float y)
107 {
108 ahrs.set_from_euler(r, n, y);
109 }
114 void update_pressure( float pressure)
115 {
116 atmosphere.set_pressure(pressure);
117 air_pressure_resampler_100Hz_10Hz.respond(pressure);
118 }
119
120 void reset_altitude( void)
121 {
122 flight_observer.reset( atmosphere.get_negative_altitude(), GNSS_negative_altitude);
123 }
130 void update_pitot( float pressure)
131 {
132 pitot_pressure = pressure < 0.0f ? 0.0f : pressure;
133 if( pitot_pressure > 4500.0f)
134 return; // ignore implausible spikes
135
136 TAS = atmosphere.get_TAS_from_dynamic_pressure ( pitot_pressure);
137 if( TAS > 5.0f)
138 TAS_averager.respond(TAS);
139 else
140 TAS_averager.settle(0.0f); // avoid underflow on decay
141
142 IAS = atmosphere.get_IAS_from_dynamic_pressure ( pitot_pressure);
143 if( IAS > 5.0f)
144 IAS_averager.respond(IAS);
145 else
146 IAS_averager.settle(0.0f); // avoid underflow on decay
147 }
148
155 void update_at_100Hz( const float3vector &acc, const float3vector &mag, const float3vector &gyro);
156
164 bool update_at_10Hz();
165
172 void update_GNSS_data( const coordinates_t &coordinates);
173
177// const flight_observer_t &get_flight_observer( void) const
178// {
179// return flight_observer;
180// }
181
182 void set_attitude( float roll, float nick, float yaw)
183 {
184 ahrs.set_from_euler(roll, nick, yaw);
185#if DEVELOPMENT_ADDITIONS
186 ahrs_magnetic.set_from_euler(roll, nick, yaw);
187#endif
188 }
189
190 float get_IAS( void) const
191 {
192 return IAS;
193 }
194
195private:
196 AHRS_type ahrs;
197#if DEVELOPMENT_ADDITIONS
199#endif
200 atmosphere_t atmosphere;
201 variometer_t flight_observer;
202 wind_oberserver_t wind_observer;
203 airborne_detector_t airborne_detector;
204
205 pt2<float,float> air_pressure_resampler_100Hz_10Hz;
206 float pitot_pressure;
207 float TAS;
208 float IAS;
209
210 float3vector GNSS_velocity;
211 float GNSS_speed;
212 float3vector GNSS_acceleration;
213 float GNSS_heading;
214 float GNSS_negative_altitude;
215 unsigned GNSS_fix_type;
216
218 pt2<float,float> TAS_averager;
219 pt2<float,float> IAS_averager;
220};
221
222#endif /* NAVIGATORT_H_ */
attitude and heading reference system (interface)
uBlox GNSS + D-GNSS interface
#define FAST_SAMPLING_TIME
computes properties of earth's atmosphere
Attitude and heading reference system.
Definition AHRS.h:50
void update_magnetic_induction_data(float declination, float inclination)
Definition AHRS.h:55
void attitude_setup(const float3vector &acceleration, const float3vector &induction)
initial attitude setup from observables
Definition AHRS.cpp:41
void set_from_euler(float r, float n, float y)
Definition AHRS.h:72
observation of the aircraft state (ground / flying)
Maintenance of atmosphere data like pressure, density etc.
Definition atmosphere.h:46
void disregard_ambient_air_data(void)
Definition atmosphere.h:99
float get_negative_altitude(void) const
Definition atmosphere.h:80
float get_IAS_from_dynamic_pressure(float dynamic_pressure) const
Definition atmosphere.h:89
float get_TAS_from_dynamic_pressure(float dynamic_pressure) const
Definition atmosphere.h:85
void initialize(float altitude)
Definition atmosphere.h:64
void set_pressure(float p_abs)
Definition atmosphere.h:68
void feed_QFF_density_metering(float pressure, float MSL_altitude)
Definition atmosphere.h:109
void set_ambient_air_data(float temperature, float humidity)
Definition atmosphere.h:93
organizes horizontal navigation, wind observation and variometer
Definition navigator.h:42
void reset_altitude(void)
Definition navigator.h:120
void set_density_data(float temperature, float humidity)
Definition navigator.h:78
void update_pressure(float pressure)
update absolute pressure called @ 100 Hz
Definition navigator.h:114
void initialize_QFF_density_metering(float MSL_altitude)
Definition navigator.h:85
bool update_at_10Hz()
slow update flight observer data
Definition navigator.cpp:85
void update_at_100Hz(const float3vector &acc, const float3vector &mag, const float3vector &gyro)
update AHRS from IMU
Definition navigator.cpp:28
void set_from_add_mag(const float3vector &acc, const float3vector &mag)
Definition navigator.h:102
void report_data(output_data_t &d)
copy all navigator data into output_data structure
void feed_QFF_density_metering(float pressure, float MSL_altitude)
Definition navigator.h:90
void update_pitot(float pressure)
update pitot pressure called @ 100 Hz
Definition navigator.h:130
void disregard_density_data(void)
Definition navigator.h:95
void update_magnetic_induction_data(float declination, float inclination)
Definition navigator.h:70
void update_GNSS_data(const coordinates_t &coordinates)
update on new navigation data from GNSS
Definition navigator.cpp:62
void set_from_euler(float r, float n, float y)
Definition navigator.h:106
navigator_t(void)
Definition navigator.h:44
float get_IAS(void) const
Definition navigator.h:190
void set_attitude(float roll, float nick, float yaw)
return aggregate flight observer
Definition navigator.h:182
void settle(const datatype &present_input)
Definition pt2.h:73
datatype respond(const datatype &input)
Definition pt2.h:79
this class is responsible for all glider flight data
Definition variometer.h:49
void reset(float pressure_altitude, float GNSS_altitude)
mathematical vector of arbitrary type and size
Definition vector.h:40
mechanisms to filter wind data
differentiate data (template)
#define ZERO
type CLIP(type x, type min, type max)
float configuration(EEPROM_PARAMETER_ID id)
specialized averager for circling and straight flight
Contains all important data from the GNSS.
Definition GNSS.h:104
combination of all input and output data in one structure
collection of system tuning parameters
#define DEVELOPMENT_ADDITIONS
wind measurement system (interface)