DUNE: Uniform Navigational Environment
2017.01.0
|
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) |
template<typename T > | |
bool | isNaN (const T &var) |
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 |
References DUNE::Math::Matrix::isEmpty().
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::isEmpty(), and DUNE::Math::Matrix::upper_triangular_tp().
Referenced by Control::AUV::Attitude::Task::onEstimatedState(), 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::isEmpty(), and 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::isEmpty(), and 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::isEmpty(), and 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::isEmpty(), and DUNE::Math::Matrix::upper_triangular_pp().
bool DUNE::Math::isNaN | ( | const T & | var | ) |
Test if a floating point variable holds a value that is not a number.
Referenced by DUNE::Simulation::UAVSimulation::commandAirspeed(), DUNE::Simulation::UAVSimulation::commandAlt(), DUNE::Simulation::UAVSimulation::commandBank(), DUNE::Simulation::UAVSimulation::commandFPA(), and DUNE::Simulation::UAVSimulation::commandPitch().
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(), 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::isEmpty(), and DUNE::Math::Matrix::size().
Referenced by Control::AUV::Allocator::Task::dispatchAllFins(), Maneuver::CoverArea::Task::intersectSegmentPolygon(), Maneuver::CoverArea::Task::longRowsDirection(), Sensors::WifiRSSI::Task::poll(), 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::isEmpty(), and DUNE::Math::Matrix::size().
Referenced by Maneuver::CoverArea::Task::getRows(), Maneuver::CoverArea::Task::intersectSegmentPolygon(), Maneuver::CoverArea::Task::longRowsDirection(), Power::BATMANv2::Task::minutesToTime(), Sensors::Imagenex837B::Frame::setGpsData(), Maneuver::VehicleFormation::Test::Task::Task(), Simulators::UAV::Task::Task(), Maneuver::VehicleFormation::Coordinator::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(), DUNE::Control::PathController::getEta(), Simulators::USBL::Task::getSensorData(), DUNE::Math::Matrix::toEulerAngles(), 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::isEmpty(), and 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. |
References DUNE::Math::Matrix::isEmpty().
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::isEmpty(), and 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::isEmpty(), and 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::isEmpty(), and 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 DUNE::Power::Model::computeMotionEnergy().
|
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::isEmpty(), and DUNE::Math::Matrix::skew.
double DUNE::Math::squaresum | ( | const Matrix & | a | ) |
[in] | a | matrix |
References DUNE::Math::Matrix::isEmpty(), and DUNE::Math::Matrix::size().
double DUNE::Math::sum | ( | const Matrix & | a | ) |
[in] | a | matrix |
References DUNE::Math::Matrix::isEmpty(), and 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. |
References DUNE::Math::Matrix::isEmpty().
Referenced by Sensors::LIMU::Task::decodeOutputData(), Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), Maneuver::VehicleFormation::FormCollAvoid::Task::leaderOutput(), Sensors::Microstrain3DMGX1::Task::onUpdateParameters(), Sensors::LIMU::Task::onUpdateParameters(), Sensors::Microstrain3DMGX3::Task::onUpdateParameters(), Transports::Seatrac::Task::onUpdateParameters(), Maneuver::VehicleFormation::Coordinator::Task::periodicUpdate(), Simulators::UAVAutopilot::Task::task(), Sensors::Microstrain3DMGX3::Task::task(), and Simulators::UAV::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::IMU::Task::consume(), Simulators::Servos::Task::consume(), Control::Path::Height::Task::consume(), Simulators::Docking::Task::consume(), Maneuver::VehicleFormation::Coordinator::Task::consume(), Maneuver::VehicleFormation::FormCollAvoid::Task::consume(), Control::AUV::Speed::Task::dispatchThrust(), Control::ASV::HeadingAndSpeed::Task::dispatchThrust(), Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), Control::ROV::RemoteOperation::Task::forwardControl(), 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(), Actuators::FLIRPTU::Task::rad2pos(), Actuators::Broom::Task::sanitizeRef(), Maneuver::VehicleFormation::Coordinator::Task::setLeaderState(), Maneuver::VehicleFormation::FormCollAvoid::Task::setLeaderState(), Actuators::Broom::Task::setRefCurrent(), Actuators::Broom::Task::setRefDcycle(), Sensors::Imagenex837B::Frame837::setRepRate(), DUNE::Control::DiscretePID::step(), Control::UAV::LOS::Task::step(), Maneuver::FollowTrajectory::Task::step(), Control::Path::LOSnSMC::Task::step(), Control::ROV::HorizontalPlane::Task::tal(), Actuators::FLIRPTU::Task::task(), Navigation::AUV::Navigation::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 |
Referenced by Maneuver::VehicleFormation::Coordinator::Task::onUpdateParameters(), Maneuver::VehicleFormation::FormCollAvoid::Task::onUpdateParameters(), DUNE::Tasks::BasicParameterParser< Math::Matrix >::read(), DUNE::Simulation::UAVSimulation::resetModel(), and DUNE::Coordinates::sphericalToCartesian().
class DUNE_DLL_SYM DUNE::Math::Optimization |
class DUNE_DLL_SYM DUNE::Math::QPSolver |