Skyward boardcore
Loading...
Searching...
No Matches
AeroUtils.h
Go to the documentation of this file.
1/* Copyright (c) 2019-2023 Skyward Experimental Rocketry
2 * Authors: Luca Erbetta, Emilio Corigliano
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23#pragma once
24
25#include <utils/Constants.h>
26
27#include <Eigen/Core>
28#include <cmath>
29
30namespace Boardcore
31{
32
33namespace Aeroutils
34{
35
57float relAltitude(float pressure, float pressureRef = Constants::MSL_PRESSURE,
58 float temperatureRef = Constants::MSL_TEMPERATURE);
59
82float relPressure(float altitude, float pressureRef = Constants::MSL_PRESSURE,
83 float temperatureRef = Constants::MSL_TEMPERATURE);
84
107float relTemperature(float altitude,
108 float temperatureRef = Constants::MSL_TEMPERATURE);
109
124float relDensity(float pressure, float pressureRef = Constants::MSL_PRESSURE,
125 float altitudeRef = 0,
126 float temperatureRef = Constants::MSL_TEMPERATURE);
127
141float mslPressure(float pressureRef, float temperatureRef, float altitudeRef);
142
155float mslTemperature(float temperatureRef, float altitudeRef);
156
170float verticalSpeed(float p, float dpDt, float pRef, float tRef);
171
181Eigen::Vector2f geodetic2NED(const Eigen::Vector2f& target,
182 const Eigen::Vector2f& origin);
183
191float computeRho(float d, float t0);
192
200float computeSoundSpeed(float d, float t0);
201
210float computeMach(float d, float vtot, float t0);
211
220float computePitotMach(float pressureTotal, float pressureStatic);
221
231float computePitotAirspeed(float pressureTotal, float pressureStatic, float d,
232 float t0);
233
235{
237};
238
246float computeCd(const AerodynamicCoeff& coeff, float mach);
247
248} // namespace Aeroutils
249
250} // namespace Boardcore
float computePitotMach(float pressureTotal, float pressureStatic)
Computes the mach from total and static pressure measures from a pitot tube.
float computePitotAirspeed(float pressureTotal, float pressureStatic, float d, float t0)
Computes air speed relative to the pitot tube.
float computeMach(float d, float vtot, float t0)
Computes the mach relative to the speed at a certain altitude.
float verticalSpeed(float p, float dpDt, float pRef, float tRef)
Definition AeroUtils.cpp:69
float mslPressure(float pressureRef, float temperatureRef, float altitudeRef)
Returns the expected pressure at mean sea level based on temperature and pressure at a reference alti...
Definition AeroUtils.cpp:58
float relDensity(float pressure, float pressureRef, float altitudeRef, float temperatureRef)
Returns the air density given the pressure with respect to a reference pressure, altitude and tempera...
Definition AeroUtils.cpp:51
Vector2f geodetic2NED(const Vector2f &target, const Vector2f &origin)
Definition AeroUtils.cpp:74
float computeCd(const AerodynamicCoeff &coeff, float mach)
Computes the CD from aerodynamic coefficients and mach.
float mslTemperature(float temperatureRef, float altitudeRef)
Returns the expected temperature at mean sea level based on temperature at a reference altitude,...
Definition AeroUtils.cpp:64
float relAltitude(float pressure, float pressureRef, float temperatureRef)
Returns the altitude given the pressure with respect to a reference pressure and temperature,...
Definition AeroUtils.cpp:36
float relPressure(float altitude, float pressureRef, float temperatureRef)
Returns the pressure given the altitude with respect to a reference pressure and temperature,...
Definition AeroUtils.cpp:41
float computeSoundSpeed(float d, float t0)
Computes the speed of sound at the given altitude.
Definition AeroUtils.cpp:94
float relTemperature(float altitude, float temperatureRef)
Returns the temperature at the given altitude with respect to the reference temperature.
Definition AeroUtils.cpp:46
float computeRho(float d, float t0)
Computes the rho (air density) of air at the given altitude.
Definition AeroUtils.cpp:86
This file includes all the types the logdecoder script will decode.