sensors_isa_model.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-2022 RaccoonLab.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, version 3.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Author: Dmitry Ponomarev <ponomarevda96@gmail.com>
17  */
18 
19 #ifndef SENSORS_ISA_MODEL_HPP
20 #define SENSORS_ISA_MODEL_HPP
21 
22 #include <Eigen/Geometry>
23 
24 namespace SensorModelISA
25 {
26 
27  void EstimateAtmosphere(const Eigen::Vector3d& gpsPosition, const Eigen::Vector3d& linVelNed,
28  float& temperatureKelvin, float& absPressureHpa, float& diffPressureHpa){
29  const float PRESSURE_MSL_HPA = 1013.250f;
30  const float TEMPERATURE_MSL_KELVIN = 288.0f;
31  const float RHO_MSL = 1.225f;
32  const float LAPSE_TEMPERATURE_RATE = 1.0f / 152.4f;
33 
34  auto alt_msl = static_cast<float>(gpsPosition.z());
35 
36  temperatureKelvin = TEMPERATURE_MSL_KELVIN - LAPSE_TEMPERATURE_RATE * alt_msl;
37  float pressureRatio = powf((TEMPERATURE_MSL_KELVIN/temperatureKelvin), 5.256f);
38  const float densityRatio = powf((TEMPERATURE_MSL_KELVIN/temperatureKelvin), 4.256f);
39  float rho = RHO_MSL / densityRatio;
40  absPressureHpa = PRESSURE_MSL_HPA / pressureRatio;
41  diffPressureHpa = 0.005f * rho * (float)(linVelNed.norm() * linVelNed.norm());
42  }
43 
44 } // namespace SensorModelISA
45 
46 #endif // SENSORS_ISA_MODEL_HPP
f
void EstimateAtmosphere(const Eigen::Vector3d &gpsPosition, const Eigen::Vector3d &linVelNed, float &temperatureKelvin, float &absPressureHpa, float &diffPressureHpa)


inno_vtol_dynamics
Author(s): Roman Fedorenko, Dmitry Ponomarev, Ezra Tal, Winter Guerra
autogenerated on Sat Jul 1 2023 02:13:44