common_math.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-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 
20 #ifndef COMMON_MATH_HPP
21 #define COMMON_MATH_HPP
22 
23 #include <Eigen/Geometry>
24 
25 namespace Math
26 {
30  double lerp(double a, double b, double f);
31 
32  double polyval(const Eigen::VectorXd& poly, double val);
33 
39  size_t findPrevRowIdxInMonotonicSequence(const Eigen::MatrixXd& matrix, double key);
40 
46  size_t findPrevRowIdxInIncreasingSequence(const Eigen::MatrixXd& table, double value);
47 
52  double griddata(const Eigen::MatrixXd& x,
53  const Eigen::MatrixXd& y,
54  const Eigen::MatrixXd& z,
55  double x_val,
56  double y_val);
57 
64  bool calculatePolynomial(const Eigen::MatrixXd& table,
65  double airSpeedMod,
66  Eigen::VectorXd& polynomialCoeffs);
67 
68 
69 } // namespace Math
70 
71 #endif // COMMON_MATH_HPP
double lerp(double a, double b, double f)
Definition: common_math.cpp:26
size_t findPrevRowIdxInMonotonicSequence(const Eigen::MatrixXd &matrix, double key)
Given monotonic sequence (increasing or decreasing) and key, return the index of the previous element...
Definition: common_math.cpp:38
double polyval(const Eigen::VectorXd &poly, double val)
Definition: common_math.cpp:30
double griddata(const Eigen::MatrixXd &x, const Eigen::MatrixXd &y, const Eigen::MatrixXd &z, double x_val, double y_val)
Definition: common_math.cpp:68
bool calculatePolynomial(const Eigen::MatrixXd &table, double airSpeedMod, Eigen::VectorXd &polynomialCoeffs)
Definition: common_math.cpp:87
size_t findPrevRowIdxInIncreasingSequence(const Eigen::MatrixXd &table, double value)
Given an increasing sequence and a key, return the index of the previous element closest to the key...
Definition: common_math.cpp:59


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