DUNE: Uniform Navigational Environment
2.4.1
|
Math routines and classes.
Namespaces | |
Random | |
Classes | |
class | Angles |
class | Derivative |
struct | LinIntParam |
struct | LineSegParam |
class | Matrix |
class | MovingAverage |
class | MultiMovingAverage |
struct | FuncWrapper |
class | Optimization |
class | tvector |
class | QPSolver |
Functions | |
uint32_t | computeNextPowerOfTwo (uint32_t val) |
template<typename Type > | |
Type | average (Type *a, uint32_t size) |
template<typename Type > | |
Type | norm (const Type &a, const Type &b) |
template<typename Type > | |
void | insertionSort (Type *a, uint16_t size) |
template<typename Type > | |
Type | medianOrdered (Type *a, uint16_t size) |
template<typename Type > | |
Type | median (Type *a, uint16_t size) |
template<typename Type > | |
Type | linearInterpolation (const LinIntParam< Type > &p) |
template<typename Type > | |
Type | piecewiseLI (const std::vector< Type > &x_vec, const std::vector< Type > &t_vec, Type t) |
template<typename Type > | |
bool | lineSegmentIntersect (const LineSegParam< Type > &p, Type *coord_x, Type *coord_y) |
template<typename Ta , typename Tb , typename Tc > | |
Ta | trimValue (Ta v, Tb min, Tc max) |
template<typename Ta , typename Tb , typename Tc > | |
bool | trimValueMod (Ta &value, Tb min, Tc max) |
char | getSignalChar (fp64_t v) |
int | getSignal (float v) |
double | round (double value) |
long int | roundToInteger (double value) |
uint8_t | fromBCD (uint8_t value) |
uint8_t | toBCD (uint8_t value) |
template<typename T > | |
T | gcd (T a, T b) |
Matrix | operator+ (const Matrix &m1, const Matrix &m2) |
Matrix | operator- (const Matrix &m1, const Matrix &m2) |
Matrix | operator* (const Matrix &m1, const Matrix &m2) |
Matrix | operator& (const Matrix &m1, const Matrix &m2) |
Matrix | operator/ (const Matrix &a, const Matrix &b) |
Matrix | operator* (double x, const Matrix &a) |
Matrix | operator* (const Matrix &a, double x) |
Matrix | operator/ (const Matrix &a, double x) |
std::ostream & | operator<< (std::ostream &os, const Matrix &a) |
std::istream & | operator>> (std::istream &is, Matrix &a) |
Matrix | transpose (const Matrix &a) |
Matrix | inverse_pp (const Matrix &a) |
Matrix | inverse_pp (const Matrix &a, const Matrix &b) |
Matrix | inverse (const Matrix &a) |
Matrix | inverse (const Matrix &a, const Matrix &b) |
Matrix | skew (double data[3]) |
Matrix | skew (const Matrix &a) |
Matrix | inverse_lup (const Matrix &a) |
Matrix | abs (const Matrix &a) |
double | max (const Matrix &a) |
double | min (const Matrix &a) |
double | sum (const Matrix &a) |
double | squaresum (const Matrix &a) |
Variables | |
class DUNE_DLL_SYM | Angles |
class DUNE_DLL_SYM | Matrix |
class DUNE_DLL_SYM | Optimization |
class DUNE_DLL_SYM | QPSolver |
Matrix DUNE::Math::abs | ( | const Matrix & | a | ) |
[in] | a | matrix |
Referenced by Sensors::Imagenex881A::Task::setAbsorption().
Type DUNE::Math::average | ( | Type * | a, |
uint32_t | size | ||
) |
Computes the average value of a fixed size array.
a | array with values. |
size | size of the array. |
|
inline |
Compute the next power of two of a value.
val | value. |
Referenced by DUNE::Math::Matrix::expmts(), DUNE::Utils::ByteBuffer::grow(), and DUNE::Utils::RawFifo::RawFifo().
|
inline |
Convert a number in Binary Coded Decimal (BCD) format to decimal.
value | BCD encoded value. |
T DUNE::Math::gcd | ( | T | a, |
T | b | ||
) |
|
inline |
Computes the signal of a number.
v | number. |
|
inline |
Computes the character representing the signal of a number.
v | number. |
void DUNE::Math::insertionSort | ( | Type * | a, |
uint16_t | size | ||
) |
Insertion Sort algorithm.
insertionSort algorithm implementation for zero based vectors better for lists with 8 to 20 elements This method sorts a vector in the ascending order using insertion sort algorithm
Referenced by median().
Matrix DUNE::Math::inverse | ( | const Matrix & | a | ) |
The inverse is calculated using Gauss elimination with total pivoting.
If Matrix 'a' is singular (with current precision) a zero Matrix with the same dimension of 'a' is returned and the variable 'dMatrix::inversionerror' is set to 1. Otherwise it is set to 0.
[in] | a | matrix to be inverted. |
References DUNE::Math::Matrix::upper_triangular_tp().
Referenced by Control::AUV::Attitude::Task::onEstimatedState(), Sensors::Microstrain3DMGX3::Task::onUpdateParameters(), and DUNE::Control::AUVModel::stepInv().
Matrix DUNE::Math::inverse | ( | const Matrix & | a, |
const Matrix & | b | ||
) |
The system is solved using Gauss elimination with total pivoting.
If Matrix 'a' is singular (with current precision) a zero Matrix with the same dimension of 'b' is returned and the variable 'dMatrix::inversionerror' is set to 1. Otherwise it is set to 0.
[in] | a | matrix |
[in] | b | matrix |
References DUNE::Math::Matrix::upper_triangular_tp().
Matrix DUNE::Math::inverse_lup | ( | const Matrix & | a | ) |
[in] | a | reference to matrix to be inverted |
References DUNE::Math::Matrix::lup().
Matrix DUNE::Math::inverse_pp | ( | const Matrix & | a | ) |
The inverse is calculated using Gauss elimination with partial pivoting.
If Matrix is singular (with current precision) a zero Matrix with the same dimension is returned and the variable. 'dMatrix::inversionerror' is set to 1. Otherwise is is set to 0.
[in] | a | reference to matrix to be inverted |
References DUNE::Math::Matrix::upper_triangular_pp().
Matrix DUNE::Math::inverse_pp | ( | const Matrix & | a, |
const Matrix & | b | ||
) |
The system is solved using Gauss elimination with partial pivoting.
If Matrix 'a' is singular (with current precision) a zero Matrix with the same dimension of 'b' is returned and the variable. 'dMatrix::inversionerror' is set to 1. Otherwise it is set to 0.
[in] | a | matrix |
[in] | b | matrix |
References DUNE::Math::Matrix::upper_triangular_pp().
Type DUNE::Math::linearInterpolation | ( | const LinIntParam< Type > & | p | ) |
References DUNE::Math::LinIntParam< Type >::t, DUNE::Math::LinIntParam< Type >::t0, DUNE::Math::LinIntParam< Type >::t1, DUNE::Math::LinIntParam< Type >::x0, and DUNE::Math::LinIntParam< Type >::x1.
Referenced by Maneuver::VehicleFormation::SMC::Task::findXY(), Monitors::FuelLevel::Task::getMergedEstimate(), Maneuver::VehicleFormation::SMC::Task::onPathCompletion(), and piecewiseLI().
bool DUNE::Math::lineSegmentIntersect | ( | const LineSegParam< Type > & | p, |
Type * | coord_x, | ||
Type * | coord_y | ||
) |
References DUNE::Math::LineSegParam< Type >::line_a_x1, DUNE::Math::LineSegParam< Type >::line_a_x2, DUNE::Math::LineSegParam< Type >::line_a_y1, DUNE::Math::LineSegParam< Type >::line_a_y2, DUNE::Math::LineSegParam< Type >::line_b_x1, DUNE::Math::LineSegParam< Type >::line_b_x2, DUNE::Math::LineSegParam< Type >::line_b_y1, and DUNE::Math::LineSegParam< Type >::line_b_y2.
Referenced by Simulators::Environment::Task::bottomIntersection(), and Simulators::Environment::Task::forwardRange().
double DUNE::Math::max | ( | const Matrix & | a | ) |
[in] | a | matrix |
References DUNE::Math::Matrix::size().
Referenced by Maneuver::CoverArea::Task::intersectSegmentPolygon(), Maneuver::CoverArea::Task::longRowsDirection(), trimValue(), and trimValueMod().
Type DUNE::Math::median | ( | Type * | a, |
uint16_t | size | ||
) |
Computes the median value of a fixed size UNORDERED array.
a | array with values. |
size | size of the array. |
References insertionSort(), and medianOrdered().
Referenced by Sensors::Imagenex852::Task::filterRange(), and DUNE::Math::Matrix::median().
Type DUNE::Math::medianOrdered | ( | Type * | a, |
uint16_t | size | ||
) |
double DUNE::Math::min | ( | const Matrix & | a | ) |
[in] | a | matrix |
References DUNE::Math::Matrix::size().
Referenced by Maneuver::CoverArea::Task::getRows(), Maneuver::CoverArea::Task::intersectSegmentPolygon(), Maneuver::CoverArea::Task::longRowsDirection(), Sensors::Imagenex837B::Frame::setGpsData(), Simulators::UAV::Task::Task(), Maneuver::VehicleFormation::FormCollAvoid::Task::Task(), trimValue(), and trimValueMod().
Type DUNE::Math::norm | ( | const Type & | a, |
const Type & | b | ||
) |
Computes the norm between two points.
a | first point. |
b | second point. |
Referenced by DUNE::Navigation::BasicNavigation::consume(), Simulators::USBL::Task::getSensorData(), and DUNE::Maneuvers::StationKeep::updatePathControl().
Matrix DUNE::Math::operator& | ( | const Matrix & | m1, |
const Matrix & | m2 | ||
) |
[in] | m1 | matrix to be multiplied (element-element). |
[in] | m2 | matrix to be multiplied (element-element). |
References DUNE::Math::Matrix::size().
Matrix DUNE::Math::operator* | ( | const Matrix & | m1, |
const Matrix & | m2 | ||
) |
Applied loop interchange to achieve memory stride 1 (better data locality) in iterations of the innermost loop, This makes for better cache behavior (i.e. less cache misses), particularly as matrix dimensions increase. For those interested, see papers or books by M J Wolfe.
[in] | m1 | matrix to be summed. |
[in] | m2 | matrix to be summed. |
Matrix DUNE::Math::operator* | ( | double | x, |
const Matrix & | a | ||
) |
[in] | x | real number. |
[in] | a | matrix to be multiplied. |
Matrix DUNE::Math::operator* | ( | const Matrix & | a, |
double | x | ||
) |
[in] | a | matrix to be multiplied. |
[in] | x | real number. |
Matrix DUNE::Math::operator+ | ( | const Matrix & | m1, |
const Matrix & | m2 | ||
) |
[in] | m1 | matrix to be summed. |
[in] | m2 | matrix to be summed. |
References DUNE::Math::Matrix::size().
Matrix DUNE::Math::operator- | ( | const Matrix & | m1, |
const Matrix & | m2 | ||
) |
[in] | m1 | matrix to be subtracted. |
[in] | m2 | matrix to subtract. |
References DUNE::Math::Matrix::size().
Matrix DUNE::Math::operator/ | ( | const Matrix & | a, |
const Matrix & | b | ||
) |
[in] | a | matrix for element-element quocient. |
[in] | b | matrix for element-element quocient. |
References DUNE::Math::Matrix::size().
Matrix DUNE::Math::operator/ | ( | const Matrix & | a, |
double | x | ||
) |
[in] | a | matrix to be divided. |
[in] | x | real number. |
std::ostream& DUNE::Math::operator<< | ( | std::ostream & | os, |
const Matrix & | a | ||
) |
Each row of the Matrix is put on a different line.
[in] | os | output stream. |
[in] | a | matrix to be outputted. |
std::istream& DUNE::Math::operator>> | ( | std::istream & | is, |
Matrix & | a | ||
) |
The Matrix is filled row by row.
[in] | is | input stream. |
[in] | a | matrix to be filled. |
References DUNE::Math::Matrix::Matrix(), and DUNE::Math::Matrix::vertCat().
Type DUNE::Math::piecewiseLI | ( | const std::vector< Type > & | x_vec, |
const std::vector< Type > & | t_vec, | ||
Type | t | ||
) |
Interpolates a point for a piecewise linear function If outside of the function's domain, returns the interpolation using closest points.
x_vec | piecewise linear function value for the values of t_vec |
t_vec | read line above. ASSUMED TO BE IN ASCENDING ORDER! |
t | value for which the function is to be interpolated |
References linearInterpolation().
Referenced by Monitors::FuelLevel::Task::computeConfidence(), Monitors::FuelLevel::Task::getInvertedEstimate(), and Monitors::FuelLevel::Task::getModelEstimate().
|
inline |
|
inline |
References round().
Matrix DUNE::Math::skew | ( | double | data[3] | ) |
[in] | data | array with 3 elements |
Matrix DUNE::Math::skew | ( | const Matrix & | a | ) |
[in] | a | row or column vector with 3 elements |
References DUNE::Math::Matrix::skew.
double DUNE::Math::squaresum | ( | const Matrix & | a | ) |
[in] | a | matrix |
References DUNE::Math::Matrix::size().
double DUNE::Math::sum | ( | const Matrix & | a | ) |
[in] | a | matrix |
References DUNE::Math::Matrix::size().
Referenced by Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), Sensors::MTi::Task::sendMessage(), DUNE::Math::QPSolver::solve(), and Sensors::Microstrain3DMGX1::Task::validateCheckSum().
|
inline |
Convert a number in decimal format to Binary Coded Decimal (BCD) format.
value | decimal value. |
Matrix DUNE::Math::transpose | ( | const Matrix & | a | ) |
[in] | a | to be transposed. |
Referenced by Navigation::General::Alignment::Task::calibrate(), Control::PTU::Task::consume(), Navigation::General::LBL::Task::consume(), Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), Simulators::AUV::Task::matrixJ(), Navigation::AUV::Navigation::Task::runKalmanLBL(), Simulators::UAVAutopilot::Task::task(), Sensors::Microstrain3DMGX3::Task::task(), Simulators::UAV::Task::task(), and Maneuver::VehicleFormation::FormCollAvoid::Task::task().
|
inline |
Referenced by Control::ROV::RemoteOperation::Task::actuateThruster(), Control::AUV::Allocator::Task::allocate(), Control::AUV::Allocator::Task::brake(), DUNE::Plans::Progress::compute(), DUNE::Control::PathController::consume(), Simulators::Servos::Task::consume(), Simulators::Docking::Task::consume(), Control::AUV::Speed::Task::dispatchThrust(), Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), Control::UAV::Ardupilot::Task::map2PWM(), Control::AUV::LMI::Task::onEstimatedState(), Control::AUV::Attitude::Task::onEstimatedState(), Maneuver::VehicleFormation::SMC::Task::onPathCompletion(), Maneuver::VehicleFormation::SMC::Task::onUpdate(), Plan::Engine::Plan::parse(), Actuators::Broom::Task::sanitizeRef(), Actuators::Broom::Task::setRefCurrent(), Actuators::Broom::Task::setRefDcycle(), DUNE::Control::DiscretePID::step(), Control::Path::Height::Task::step(), Control::Path::Aerosonde::Task::step(), Maneuver::FollowTrajectory::Task::step(), Control::ROV::HorizontalPlane::Task::tal(), Actuators::SCRT::Task::task(), DUNE::Monitors::ServoPositionMonitor< T >::updateAndTest(), and Simulators::Environment::Task::updateForwardDistance().
|
inline |
class DUNE_DLL_SYM DUNE::Math::Angles |
class DUNE_DLL_SYM DUNE::Math::Matrix |
class DUNE_DLL_SYM DUNE::Math::Optimization |
class DUNE_DLL_SYM DUNE::Math::QPSolver |