3 #ifndef SE2EZ_CORE_MATH_ 4 #define SE2EZ_CORE_MATH_ 9 #include <unordered_map> 11 #include <boost/math/constants/constants.hpp> 13 #include <ompl/util/RandomNumbers.h> 15 #include <Eigen/Geometry> 16 #include <Eigen/StdVector> 18 #include <kdl/jntarray.hpp> 19 #include <kdl/frames.hpp> 32 static const double pi = boost::math::constants::pi<double>();
34 static const double pi2 = pi / 2.;
66 double remap(
double a1,
double a2,
double av,
double b1,
double b2);
74 double clamp(
double v,
double a,
double b);
130 template <
typename V>
137 template <
typename K,
typename V>
140 Eigen::aligned_allocator<std::pair<const K, V>>>;
146 template <
typename K,
typename V>
149 Eigen::aligned_allocator<std::pair<const K, V>>>;
160 Eigen::Isometry2d
toIsometry(
double x,
double y,
double theta);
166 double getRotation(
const Eigen::Isometry2d &frame);
173 Eigen::Isometry2d
toIsometry(
const Eigen::Vector3d &vec);
183 const Eigen::Isometry2d &t2 = Eigen::Isometry2d::Identity(),
184 double alpha = 0.75);
Eigen::Isometry2d KDLToEigenFrame(const KDL::Frame &frame)
Converts an KDL transformation into a Eigen transformation.
std::string printFrame(const KDL::Frame &frame)
Returns a string "[x, y, t]" of the translation (x, y) and rotation (t) component of a transform...
double gaussianReal(double mean, double std)
Return a random number sampled from a gaussain with given std and mean.
double toRadians(double v)
Convert an angle to radians.
Eigen::Isometry2d 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 tran...
Eigen::Vector3d flattenIsometry(const Eigen::Isometry2d &frame)
Converts a transformation frame into a vector [x, y, t] composed of a translation (x...
Eigen::MatrixXd toMatrix(const std::vector< Eigen::VectorXd > &vlist)
Converts a vector of lists into a Matrix.
double uniformReal(double lower, double upper)
Return a uniform random number between lower and upper.
double getRotation(const Eigen::Isometry2d &frame)
Gets rotation from a frame from the X-axis (t)
double clamp(double v, double a, double b)
Clamp a value v between a range [a, b].
std::string printMatrix(const Eigen::MatrixXd &v, unsigned int precision=4)
Returns a string of a matrix's contents.
Eigen::VectorXd KDLToEigenVec(const KDL::JntArray &array)
Converts an KDL vector into a Eigen vector.
double 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...
Eigen::VectorXd toVector(double x)
Converts a single double value into a 1 x 1 matrix.
double angleNormalize(double v)
Normalize an angle between -pi to pi.
KDL::JntArray EigenToKDLVec(const Eigen::VectorXd &vec)
Converts an Eigen vector into a KDL vector.
std::string printVector(const Eigen::VectorXd &v, unsigned int precision=4)
Returns a string of a vector's contents.
KDL::Frame EigenToKDLFrame(const Eigen::Isometry2d &iso)
Converts an Eigen transformation into a KDL transformation.
int uniformInteger(int lower, int upper)
Return a uniform random integer between lower and upper (inclusive).
double toDegrees(double v)
Convert an angle to degrees.
double 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.
static ompl::RNG rng
Random number generation from OMPL. An instance of this class cannot be used by multiple threads at o...
double angleDistance(double v1, double v2)
Return the minimum distance between two angles (wrapping from -pi to pi).