RML  1.0
Robotics Mathematical Library
Loading...
Searching...
No Matches
Functions.h
Go to the documentation of this file.
1
8#ifndef INCLUDE_RML_FUNCTIONS_H_
9#define INCLUDE_RML_FUNCTIONS_H_
10
11#include "EulerRPY.h"
12#include "RMLExceptions.h"
13#include "Types.h"
14#include <algorithm>
15#include <array>
16#include <iostream>
17#include <vector>
18
19namespace rml {
25 double A, B, C, D;
26
28 : A(0)
29 , B(0)
30 , C(0)
31 , D(0)
32 {
33 }
34};
42Eigen::Vector3d ReducedVersorLemma(const Eigen::Vector3d& v1, const Eigen::Vector3d& v2);
43
58Eigen::Vector3d VersorLemma(const Eigen::RotationMatrix& r1, const Eigen::RotationMatrix& r2);
75Eigen::Vector3d VersorLemma(const EulerRPY& v1, const EulerRPY& v2);
126double DecreasingBellShapedFunction(double xmin, double xmax, double ymin, double ymax, double x) noexcept(false);
143double IncreasingBellShapedFunction(double xmin, double xmax, double ymin, double ymax, double x) noexcept(false);
149void SaturateScalar(double sat, double& value);
156void SaturateVector(const double sat, Eigen::VectorXd& vector);
157
183void SaturateVector(const Eigen::VectorXd& upper_limits, const Eigen::VectorXd& lower_limits, Eigen::VectorXd& vect);
184
185
193double DistancePointToPlane(const Eigen::Vector3d& point, const PlaneParameters& planeParams);
201Eigen::Vector3d ClosestPointOnPlane(const Eigen::Vector3d& point, const PlaneParameters& planeParams);
215Eigen::Matrix3d Vect3ToSkew(const Eigen::Vector3d& t);
243Eigen::Matrix6d RigidBodyMatrix(const Eigen::Vector3d& transl);
252Eigen::MatrixXd ChangeJacobianObserver(Eigen::MatrixXd J, Eigen::MatrixXd Jobserver, Eigen::Vector3d CartesianError);
260template <class MatT>
261static bool eigen_norm_compare(MatT& a, MatT& b)
262{
263 return (a.norm() < b.norm());
264}
273template <class MatT>
274MatT GreatestNormElement(const MatT& vect1, const MatT& vect2, const MatT& vect3)
275{
276
277 std::vector<MatT> vecs = { vect1, vect2, vect3 };
278 return *std::max_element(vecs.begin(), vecs.end(), eigen_norm_compare<MatT>);
279}
280template <typename T>
281int sgn(T val)
282{
283 return (T(0) < val) - (val < T(0));
284}
285}
286
287#endif /* INCLUDE_RML_FUNCTIONS_H_ */
This class extends the Eigen::Matrix3d.
Definition RotMatrix.h:26
This class extends the Eigen::Matrix4d.
Definition TransfMatrix.h:26
A 6d vector generally used for containing pose [x y z r p y] or velocity [vx vy vz wx wy wz] vectors.
Definition Vector6d.h:18
Euler RPY angle representation.
Definition EulerRPY.h:25
Eigen::Matrix< double, 6, 6 > Matrix6d
Definition Types.h:36
Types and algorithms for robotic mobile manipulation.
Definition ArmModel.h:19
Eigen::MatrixXd ChangeJacobianObserver(Eigen::MatrixXd J, Eigen::MatrixXd Jobserver, Eigen::Vector3d CartesianError)
ChangeJacobianObserver Method implementing change of observer for a cartesian Jacobian....
Eigen::Matrix3d Vect3ToSkew(const Eigen::Vector3d &t)
Computes the skew symmetric matrix form for a vector.
double IncreasingBellShapedFunction(double xmin, double xmax, double ymin, double ymax, double x) noexcept(false)
An increasing bell shaped (sigmoid) function.
Eigen::Vector3d VersorLemma(const Eigen::RotationMatrix &r1, const Eigen::RotationMatrix &r2)
Compute the versor lemma between the two rotation matrices.
MatT GreatestNormElement(const MatT &vect1, const MatT &vect2, const MatT &vect3)
An utility to find the vector with the greatest norm among three.
Definition Functions.h:274
void SaturateScalar(double sat, double &value)
Saturate the scalar to a given maximum value.
double DistancePointToPlane(const Eigen::Vector3d &point, const PlaneParameters &planeParams)
Evaluates the norm of the shortest distance vector among a point and a given plane.
void SaturateVector(const double sat, Eigen::VectorXd &vector)
Saturate the vector to a given maximum value applying normalization for preserving the vector directi...
int sgn(T val)
Definition Functions.h:281
Eigen::Vector6d CartesianError(const Eigen::TransformationMatrix &in1, const Eigen::TransformationMatrix &in2)
Compute the Cartesian error between two transformation matrices.
Eigen::Vector3d ReducedVersorLemma(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Compute the misalignment error between two vectors. The result is the vector around which v1 has to r...
double DecreasingBellShapedFunction(double xmin, double xmax, double ymin, double ymax, double x) noexcept(false)
A decreasing bell shaped (sigmoid) function.
Eigen::Matrix6d RigidBodyMatrix(const Eigen::Vector3d &transl)
Compute a rigid body matrix.
Eigen::Vector3d ClosestPointOnPlane(const Eigen::Vector3d &point, const PlaneParameters &planeParams)
Given a point and a plane evaluates the coordinates of the closest point on plane w....
Using four parameters represention in the form: Ax + By + Cz + D = 0;.
Definition Functions.h:24
PlaneParameters()
Definition Functions.h:27
double A
Definition Functions.h:25
double B
Definition Functions.h:25
double C
Definition Functions.h:25
double D
Definition Functions.h:25