MRSL Motion Primitive Library  1.2
A motion primitive library for generating trajectory for mobile robots
Functions
math.h File Reference

Polynomial roots solver. More...

#include <mpl_basis/data_type.h>
#include <iostream>
#include <unsupported/Eigen/Polynomials>

Go to the source code of this file.

Functions

decimal_t normalize_angle (decimal_t angle)
 
std::vector< decimal_tquad (decimal_t b, decimal_t c, decimal_t d)
 Quadratic equation: $b*t^2+c*t+d = 0$.
 
std::vector< decimal_tcubic (decimal_t a, decimal_t b, decimal_t c, decimal_t d)
 Cubic equation: $a*t^3+b*t^2+c*t+d = 0$.
 
std::vector< decimal_tquartic (decimal_t a, decimal_t b, decimal_t c, decimal_t d, decimal_t e)
 Quartic equation: $a*t^4+b*t^3+c*t^2+d*t+e = 0$.
 
std::vector< decimal_tsolve (decimal_t a, decimal_t b, decimal_t c, decimal_t d, decimal_t e)
 General solver for $a*t^4+b*t^3+c*t^2+d*t+e = 0$. More...
 
std::vector< decimal_tsolve (decimal_t a, decimal_t b, decimal_t c, decimal_t d, decimal_t e, decimal_t f)
 General solver for $a*t^5+b*t^4+c*t^3+d*t^2+e*t+f = 0$.
 
std::vector< decimal_tsolve (decimal_t a, decimal_t b, decimal_t c, decimal_t d, decimal_t e, decimal_t f, decimal_t g)
 General solver for $a*t^6+b*t^5+c*t^4+d*t^3+e*t^2+f*t+g = 0$.
 
int factorial (int n)
 Return $n!$.
 
decimal_t power (decimal_t t, int n)
 Return $t^n$.
 
template<typename Derived >
Derived::PlainObject pseudoInverse (Eigen::MatrixBase< Derived > const &m)
 
template<typename Derived >
Derived::PlainObject matrixSquareRoot (Eigen::MatrixBase< Derived > const &mat, bool semidefinite_mat=false)
 

Detailed Description

Polynomial roots solver.

Solving real roots for n-th order polynomial: if n < 5, the closed form solution will be calculated; if n >= 5, using Eigen Polynomials solver which is slower but correct.

Function Documentation

◆ solve()

std::vector<decimal_t> solve ( decimal_t  a,
decimal_t  b,
decimal_t  c,
decimal_t  d,
decimal_t  e 
)
inline

General solver for $a*t^4+b*t^3+c*t^2+d*t+e = 0$.

$a, b, c$ can be zero. The function itself checks the highest order of the polynomial.