se2ez
math.h File Reference
#include <type_traits>
#include <vector>
#include <map>
#include <unordered_map>
#include <boost/math/constants/constants.hpp>
#include <ompl/util/RandomNumbers.h>
#include <Eigen/Geometry>
#include <Eigen/StdVector>
#include <kdl/jntarray.hpp>
#include <kdl/frames.hpp>

Go to the source code of this file.

Namespaces

 se2ez
 Main namespace.
 
 se2ez::math
 Helper functions and constants require for mathematical operations.
 
 se2ez::tf
 Helper functions for transform manipulation.
 

Typedefs

template<typename V >
using se2ez::tf::EigenVector = std::vector< V, Eigen::aligned_allocator< V > >
 A template for a vector that stores Eigen objects. More...
 
template<typename K , typename V >
using se2ez::tf::EigenMap = std::map< K, V, std::less< K >, Eigen::aligned_allocator< std::pair< const K, V > >>
 A template for a map that stores Eigen objects. More...
 
template<typename K , typename V >
using se2ez::tf::EigenHash = std::unordered_map< K, V, std::hash< K >, std::equal_to< K >, Eigen::aligned_allocator< std::pair< const K, V > >>
 A template for an unordered map that stores Eigen objects. More...
 

Functions

Eigen::VectorXd se2ez::math::toVector (double x)
 Converts a single double value into a 1 x 1 matrix. More...
 
Eigen::MatrixXd se2ez::math::toMatrix (const std::vector< Eigen::VectorXd > &vlist)
 Converts a vector of lists into a Matrix. More...
 
Eigen::VectorXd se2ez::math::toVector (const std::initializer_list< double > &x)
 Converts an initialize list into a vector. More...
 
double se2ez::math::remap (double a1, double a2, double av, double b1, double b2)
 Remap a value av in the interval a1, a2 to the interval b1, b2. More...
 
double se2ez::math::clamp (double v, double a, double b)
 Clamp a value v between a range [a, b]. More...
 
double se2ez::math::angleDistance (double v1, double v2)
 Return the minimum distance between two angles (wrapping from -pi to pi). More...
 
double se2ez::math::angleNormalize (double v)
 Normalize an angle between -pi to pi. More...
 
double se2ez::math::toDegrees (double v)
 Convert an angle to degrees. More...
 
double se2ez::math::toRadians (double v)
 Convert an angle to radians. More...
 
double se2ez::math::uniformReal (double lower, double upper)
 Return a uniform random number between lower and upper. More...
 
int se2ez::math::uniformInteger (int lower, int upper)
 Return a uniform random integer between lower and upper (inclusive). More...
 
double se2ez::math::gaussianReal (double mean, double std)
 Return a random number sampled from a gaussain with given std and mean. More...
 
Eigen Isometry2d operations
Eigen::Isometry2d se2ez::tf::toIsometry (double x, double y, double theta)
 Converts a translation (x, y) and rotation from X-axis (theta) into a transform. More...
 
double se2ez::tf::getRotation (const Eigen::Isometry2d &frame)
 Gets rotation from a frame from the X-axis (t) More...
 
Eigen::Isometry2d se2ez::tf::toIsometry (const Eigen::Vector3d &vec)
 Converts a vector [x, y, t] composed of a translation (x, y) and rotation from X-axis (t) into a transform. More...
 
double se2ez::tf::transformDistance (const Eigen::Isometry2d &t1, const Eigen::Isometry2d &t2=Eigen::Isometry2d::Identity(), double alpha=0.75)
 Return the transform distance between two transformations, w is the weight of the euclidean distance, and (1-w) the weight of the rotational distance (wrapping from -pi to pi). More...
 
Eigen::Vector3d se2ez::tf::flattenIsometry (const Eigen::Isometry2d &frame)
 Converts a transformation frame into a vector [x, y, t] composed of a translation (x, y) and rotation from X-axis(t). More...
 
KDL and Eigen Conversions
KDL::Frame se2ez::tf::EigenToKDLFrame (const Eigen::Isometry2d &iso)
 Converts an Eigen transformation into a KDL transformation. More...
 
Eigen::Isometry2d se2ez::tf::KDLToEigenFrame (const KDL::Frame &frame)
 Converts an KDL transformation into a Eigen transformation. More...
 
KDL::JntArray se2ez::tf::EigenToKDLVec (const Eigen::VectorXd &vec)
 Converts an Eigen vector into a KDL vector. More...
 
Eigen::VectorXd se2ez::tf::KDLToEigenVec (const KDL::JntArray &array)
 Converts an KDL vector into a Eigen vector. More...
 
Debug & Output
std::string se2ez::tf::printFrame (const Eigen::Isometry2d &frame)
 Returns a string "[x, y, t]" of the translation (x, y) and rotation (t) component of a transform. More...
 
std::string se2ez::tf::printFrame (const KDL::Frame &frame)
 Returns a string "[x, y, t]" of the translation (x, y) and rotation (t) component of a transform. More...
 
std::string se2ez::tf::printVector (const Eigen::VectorXd &v, unsigned int precision=4)
 Returns a string of a vector's contents. More...
 
std::string se2ez::tf::printMatrix (const Eigen::MatrixXd &v, unsigned int precision=4)
 Returns a string of a matrix's contents. More...
 

Variables

static ompl::RNG se2ez::math::rng
 Random number generation from OMPL. An instance of this class cannot be used by multiple threads at once. More...
 
static const double se2ez::math::pi = boost::math::constants::pi<double>()
 
static const double se2ez::math::pipi = 2. * pi
 
static const double se2ez::math::pi2 = pi / 2.
 
static const double se2ez::math::eps = std::numeric_limits<double>::epsilon()
 
static const double se2ez::math::inf = std::numeric_limits<double>::infinity()
 
static const double se2ez::math::nan = std::numeric_limits<double>::quiet_NaN()