|
Robotics Library
0.7.0
|
Go to the documentation of this file.
27 #ifndef RL_MATH_CIRCULARVECTOR3_H
28 #define RL_MATH_CIRCULARVECTOR3_H
30 #define EIGEN_MATRIXBASE_PLUGIN <rl/math/MatrixBaseAddons.h>
31 #define EIGEN_QUATERNIONBASE_PLUGIN <rl/math/QuaternionBaseAddons.h>
32 #define EIGEN_TRANSFORM_PLUGIN <rl/math/TransformAddons.h>
37 #include <Eigen/Dense>
78 Vector3 planeNormal = (yi - y0).cross(y1 - y0);
79 assert(planeNormal.norm() > 1e-8 &&
"Circular motion is ambiguous. Given three points must not be colinear!");
80 planeNormal.normalize();
81 Real planeD = planeNormal.transpose() * y0;
84 Vector3 planeDirection1, planeDirection2;
88 if ((planeNormal.transpose() * someUnit).norm() < (planeNormal.transpose() * someOtherUnit).norm())
90 planeDirection1 = planeNormal.cross(someUnit);
94 planeDirection1 = planeNormal.cross(someOtherUnit);
97 planeDirection1.normalize();
98 planeDirection2 = planeNormal.cross(planeDirection1);
99 planeDirection2.normalize();
102 ::Eigen::Matrix<Real, 2, 3> projectionTo2d;
103 projectionTo2d << planeDirection1.transpose(), planeDirection2.transpose();
104 Vector2 y02d = projectionTo2d * y0;
105 Vector2 yi2d = projectionTo2d * yi;
106 Vector2 y12d = projectionTo2d * y1;
109 f.center = projectionTo2d.transpose() * circ2d.
getCenter() + planeNormal * planeD;
110 f.axisX = y0 - f.center;
111 f.axisY = planeNormal.cross(
Vector3(f.axisX));
173 assert(derivative <= 2 &&
"Circular: higher derivatives not implemented");
175 Real c = this->angle / this->
x1;
179 return this->center + ::std::cos(c * x) * this->axisX + ::std::sin(c * x) * this->axisY;
181 else if (derivative == 1)
183 return -c * ::std::sin(c * x) * this->axisX + c * ::std::cos(c * x) * this->axisY;
185 else if (derivative == 2)
187 return -
::std::pow(c, 2) * ::std::cos(c * x) * this->axisX -
::std::pow(c, 2) * ::std::sin(c * x) * this->axisY;
191 return this->axisX * ::std::numeric_limits<Real>::signaling_NaN();
214 #endif // RL_MATH_CIRCULARVECTOR3_H
Vector3 getCenter() const
Definition: CircularVector3.h:158
Quaternion< Scalar > pow(const Scalar &t) const
Definition: QuaternionBaseAddons.h:128
Circular segment function that maps from a time x to a point on a circular trajectory.
Definition: Circular.h:43
Vector2 getCenter() const
Definition: CircularVector2.h:151
A mathematical mapping from Real -> ArrayX.
Definition: Function.h:45
Real x1
Definition: Function.h:104
::Eigen::Matrix< Real, 3, 1 > Vector3
Definition: Vector.h:46
Circular segment function that maps from a time x to a point in 2D on a circular trajectory.
Definition: CircularVector2.h:56
Vector3 getAxisY() const
Definition: CircularVector3.h:153
Vector3 operator()(const Real &x, const ::std::size_t &derivative=0) const
Evaluates the circular segment function for a given x.
Definition: CircularVector3.h:169
Circular segment function that maps from a time x to a point in 3D on a circular trajectory.
Definition: CircularVector3.h:57
Real getAngle() const
Definition: CircularVector3.h:143
static Circular< Vector3 > ThreePointsAngle(const Vector3 &y0, const Vector3 &yi, const Vector3 &y1, const Real &angle, const Real &x1=1)
Generates a circular segment through three given points in 3D with a given segment angle.
Definition: CircularVector3.h:131
Vector3 axisX
First axis of the circular motion.
Definition: CircularVector3.h:200
Circular< Vector3 > * clone() const
Definition: CircularVector3.h:138
Real & upper()
Definition: Function.h:74
Vector3 center
Center of the circle.
Definition: CircularVector3.h:206
Vector3 getAxisX() const
Definition: CircularVector3.h:148
::Eigen::Matrix< Real, 2, 1 > Vector2
Definition: Vector.h:44
static Circular< Vector3 > ThreePoints(const Vector3 &y0, const Vector3 &yi, const Vector3 &y1, const Real &x1=1)
Generates a circular segment through three given points in 3D.
Definition: CircularVector3.h:74
Real getAngle() const
Definition: CircularVector2.h:136
static const Real FUNCTION_BOUNDARY
Definition: Function.h:110
Real & lower()
Definition: Function.h:64
double Real
Definition: Real.h:42
Real angle
Angle of circular motion.
Definition: CircularVector3.h:197
Vector3 axisY
Second axis of the circular motion.
Definition: CircularVector3.h:203
Robotics Library.
Definition: AnalogInput.cpp:30