|
Robotics Library
0.7.0
|
Go to the documentation of this file.
27 #ifndef RL_MATH_CIRCULARVECTOR2_H
28 #define RL_MATH_CIRCULARVECTOR2_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>
77 ::Eigen::Matrix<Real, 2, 3> points2d;
78 points2d << y0, yi, y1;
82 A << Matrix::Ones(3, 1), -points2d.transpose();
83 Vector3 b = - (points2d.transpose() * points2d).diagonal();
84 Vector3 x = A.fullPivLu().solve(b);
85 Vector2 center2d = x.bottomRows(2) / 2;
88 assert((A * x - b).norm() < 1e-8 &&
"Circular motion: Linear system cannot be solved. (Points must not be colinear.)");
166 assert(derivative <= 2 &&
"Circular: higher derivatives not implemented");
168 Real c = this->angle / this->
x1;
172 return this->center + ::std::cos(c * x) * this->axisX + ::std::sin(c * x) * this->axisY;
174 else if (derivative == 1)
176 return -c * ::std::sin(c * x) * this->axisX + c * ::std::cos(c * x) * this->axisY;
178 else if (derivative == 2)
180 return -
::std::pow(c, 2) * ::std::cos(c * x) * this->axisX -
::std::pow(c, 2) * ::std::sin(c * x) * this->axisY;
184 return this->axisX * ::std::numeric_limits<Real>::signaling_NaN();
207 #endif // RL_MATH_CIRCULARVECTOR2_H
Vector2 axisY
Second axis of the circular motion.
Definition: CircularVector2.h:196
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
Vector2 operator()(const Real &x, const ::std::size_t &derivative=0) const
Evaluates the circular segment function for a given x.
Definition: CircularVector2.h:162
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
Circular< Vector2 > * clone() const
Definition: CircularVector2.h:131
Vector2 getAxisX() const
Definition: CircularVector2.h:141
Real & upper()
Definition: Function.h:74
static Circular< Vector2 > ThreePointsAngle(const Vector2 &y0, const Vector2 &yi, const Vector2 &y1, const Real &angle, const Real &x1=1)
Generates a circular segment through three given points in 2D with a given segment angle.
Definition: CircularVector2.h:124
static Circular< Vector2 > ThreePoints(const Vector2 &y0, const Vector2 &yi, const Vector2 &y1, const Real &x1=1)
Generates a circular segment function in 2D through three given points.
Definition: CircularVector2.h:73
Vector2 axisX
First axis of the circular motion.
Definition: CircularVector2.h:193
::Eigen::Matrix< Real, 2, 1 > Vector2
Definition: Vector.h:44
Real getAngle() const
Definition: CircularVector2.h:136
Vector2 getAxisY() const
Definition: CircularVector2.h:146
Vector2 center
Center of the circle.
Definition: CircularVector2.h:199
static const Real FUNCTION_BOUNDARY
Definition: Function.h:110
Real angle
Angle of circular motion.
Definition: CircularVector2.h:190
Real & lower()
Definition: Function.h:64
double Real
Definition: Real.h:42
::Eigen::Matrix< Real, 3, 3 > Matrix33
Definition: Matrix.h:46
Robotics Library.
Definition: AnalogInput.cpp:30