test_isa_model.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022-2023 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 #include <gtest/gtest.h>
20 #include <cmath>
21 #include <iostream>
22 #include "sensors_isa_model.hpp"
23 #include <ros/ros.h>
24 
25 
26 TEST(IsaModel, diffPressureHpaMax){
27  Eigen::Vector3d gpsPosition(55.7544426, 48.742684, 0);
28  Eigen::Vector3d linVelNed(100, 0, 0);
29  double expectedDiffPressureHpa = 61.25;
30 
31  float temperatureKelvin, absPressureHpa, diffPressureHpa;
32  SensorModelISA::EstimateAtmosphere(gpsPosition, linVelNed,
33  temperatureKelvin, absPressureHpa, diffPressureHpa);
34  EXPECT_NEAR(diffPressureHpa, expectedDiffPressureHpa, 0.01);
35 }
36 TEST(IsaModel, diffPressureHpaZero){
37  Eigen::Vector3d gpsPosition(55.7544426, 48.742684, 0);
38  Eigen::Vector3d linVelNed(0, 0, 0);
39 
40  double expectedDiffPressureHpa = 0;
41 
42  float temperatureKelvin, absPressureHpa, diffPressureHpa;
43  SensorModelISA::EstimateAtmosphere(gpsPosition, linVelNed,
44  temperatureKelvin, absPressureHpa, diffPressureHpa);
45  EXPECT_NEAR(diffPressureHpa, expectedDiffPressureHpa, 0.01);
46 }
47 TEST(IsaModel, diffPressureHpaMin){
48  Eigen::Vector3d gpsPosition(55.7544426, 48.742684, 0);
49  Eigen::Vector3d linVelNed(-100, 0, 0);
50 
51  double expectedDiffPressureHpa = 61.25;
52 
53  float temperatureKelvin, absPressureHpa, diffPressureHpa;
54  SensorModelISA::EstimateAtmosphere(gpsPosition, linVelNed,
55  temperatureKelvin, absPressureHpa, diffPressureHpa);
56  EXPECT_NEAR(diffPressureHpa, expectedDiffPressureHpa, 0.01);
57 }
58 
59 
60 int main(int argc, char *argv[]){
61  testing::InitGoogleTest(&argc, argv);
62  ros::init(argc, argv, "isa_model_test");
63  return RUN_ALL_TESTS();
64 }
sensors_isa_model.hpp
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ros.h
main
int main(int argc, char *argv[])
Definition: test_isa_model.cpp:60
TEST
TEST(IsaModel, diffPressureHpaMax)
Definition: test_isa_model.cpp:26
SensorModelISA::EstimateAtmosphere
void EstimateAtmosphere(const Eigen::Vector3d &gpsPosition, const Eigen::Vector3d &linVelNed, float &temperatureKelvin, float &absPressureHpa, float &diffPressureHpa)
Definition: sensors_isa_model.hpp:27


inno_vtol_dynamics
Author(s): Roman Fedorenko, Dmitry Ponomarev, Ezra Tal, Winter Guerra
autogenerated on Mon Dec 9 2024 03:13:35