PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <BezierQuad.hpp>
Public Types | |
using | Vector3_t = matrix::Vector< Tp, 3 > |
Public Member Functions | |
BezierQuad () | |
Empty constructor. More... | |
BezierQuad (const Tp pt0[3], const Tp ctrl[3], const Tp pt1[3], Tp duration=1.0f) | |
Constructor from array. More... | |
BezierQuad (const Vector3_t &pt0, const Vector3_t &ctrl, const Vector3_t &pt1, Tp duration=1.0f) | |
Constructor from vector. More... | |
void | getBezier (Vector3_t &pt0, Vector3_t &ctrl, Vector3_t &pt1) |
Vector3_t | getPt0 () |
Vector3_t | getCtrl () |
Vector3_t | getPt1 () |
void | setBezier (const Vector3_t &pt0, const Vector3_t &ctrl, const Vector3_t &pt1, Tp duration=(Tp) 1) |
Set new bezier points and duration. More... | |
void | setDuration (const Tp time) |
Vector3_t | getPoint (const Tp t) |
Return point on bezier point corresponding to time t. More... | |
Tp | getDistToClosestPoint (const Vector3_t &pose) |
Vector3_t | getVelocity (const Tp t) |
Vector3_t | getAcceleration () |
void | getStates (Vector3_t &point, Vector3_t &vel, Vector3_t &acc, const Tp t) |
void | getStatesClosest (Vector3_t &point, Vector3_t &vel, Vector3_t &acc, const Vector3_t pose) |
void | setBezFromVel (const Vector3_t &ctrl, const Vector3_t &vel0, const Vector3_t &vel1, const Tp duration=(Tp) 1) |
Tp | getArcLength (const Tp resolution) |
Private Member Functions | |
Tp | _goldenSectionSearch (const Vector3_t &pose) |
Tp | _getDistanceSquared (const Tp t, const Vector3_t &pose) |
Private Attributes | |
Vector3_t | _pt0 |
Bezier starting point. More... | |
Vector3_t | _ctrl |
Bezier control point. More... | |
Vector3_t | _pt1 |
bezier end point More... | |
Tp | _duration = (Tp)1 |
Total time to travle along spline. More... | |
Tp | _cached_arc_length = (Tp)0 |
The saved arc length of the spline. More... | |
Tp | _cached_resolution = (Tp)(-1) |
The resolution used to compute the arc length. More... | |
Definition at line 55 of file BezierQuad.hpp.
using bezier::BezierQuad< Tp >::Vector3_t = matrix::Vector<Tp, 3> |
Definition at line 59 of file BezierQuad.hpp.
|
inline |
Empty constructor.
Definition at line 64 of file BezierQuad.hpp.
|
inline |
Constructor from array.
Definition at line 70 of file BezierQuad.hpp.
|
inline |
Constructor from vector.
Definition at line 76 of file BezierQuad.hpp.
References bezier::BezierQuad< Tp >::getBezier().
|
private |
Definition at line 204 of file BezierQuad.cpp.
|
private |
Definition at line 179 of file BezierQuad.cpp.
References bezier::RESOLUTION.
matrix::Vector< Tp, 3 > bezier::BezierQuad< Tp >::getAcceleration | ( | ) |
Definition at line 81 of file BezierQuad.cpp.
Referenced by bezier::BezierQuad< Tp >::setDuration().
Tp bezier::BezierQuad< Tp >::getArcLength | ( | const Tp | resolution | ) |
Definition at line 119 of file BezierQuad.cpp.
References matrix::Vector< Type, M >::length().
Referenced by BezierQuadTest::_get_arc_length(), and bezier::BezierQuad< Tp >::setDuration().
void bezier::BezierQuad< Tp >::getBezier | ( | Vector3_t & | pt0, |
Vector3_t & | ctrl, | ||
Vector3_t & | pt1 | ||
) |
Definition at line 59 of file BezierQuad.cpp.
Referenced by bezier::BezierQuad< Tp >::BezierQuad().
|
inline |
Definition at line 94 of file BezierQuad.hpp.
References bezier::BezierQuad< Tp >::_ctrl.
Tp bezier::BezierQuad< Tp >::getDistToClosestPoint | ( | const Vector3_t & | pose | ) |
Definition at line 168 of file BezierQuad.cpp.
Referenced by bezier::BezierQuad< Tp >::setDuration().
matrix::Vector< Tp, 3 > bezier::BezierQuad< Tp >::getPoint | ( | const Tp | t | ) |
Return point on bezier point corresponding to time t.
t | is a time in seconds in between [0, duration] |
Definition at line 67 of file BezierQuad.cpp.
Referenced by BezierQuadTest::_get_arc_length(), and bezier::BezierQuad< Tp >::setDuration().
|
inline |
Definition at line 89 of file BezierQuad.hpp.
References bezier::BezierQuad< Tp >::_pt0.
|
inline |
Definition at line 99 of file BezierQuad.hpp.
References bezier::BezierQuad< Tp >::_pt1, and bezier::BezierQuad< Tp >::setBezier().
void bezier::BezierQuad< Tp >::getStates | ( | Vector3_t & | point, |
Vector3_t & | vel, | ||
Vector3_t & | acc, | ||
const Tp | t | ||
) |
Definition at line 87 of file BezierQuad.cpp.
Referenced by BezierQuadTest::_get_states_from_time(), and bezier::BezierQuad< Tp >::setDuration().
void bezier::BezierQuad< Tp >::getStatesClosest | ( | Vector3_t & | point, |
Vector3_t & | vel, | ||
Vector3_t & | acc, | ||
const Vector3_t | pose | ||
) |
Definition at line 95 of file BezierQuad.cpp.
Referenced by bezier::BezierQuad< Tp >::setDuration().
matrix::Vector< Tp, 3 > bezier::BezierQuad< Tp >::getVelocity | ( | const Tp | t | ) |
Definition at line 75 of file BezierQuad.cpp.
Referenced by BezierQuadTest::_set_bez_from_vel(), and bezier::BezierQuad< Tp >::setDuration().
void bezier::BezierQuad< Tp >::setBezFromVel | ( | const Vector3_t & | ctrl, |
const Vector3_t & | vel0, | ||
const Vector3_t & | vel1, | ||
const Tp | duration = (Tp)1 |
||
) |
Definition at line 107 of file BezierQuad.cpp.
Referenced by BezierQuadTest::_set_bez_from_vel(), and bezier::BezierQuad< Tp >::setDuration().
void bezier::BezierQuad< Tp >::setBezier | ( | const Vector3_t & | pt0, |
const Vector3_t & | ctrl, | ||
const Vector3_t & | pt1, | ||
Tp | duration = (Tp)1 |
||
) |
Set new bezier points and duration.
Definition at line 48 of file BezierQuad.cpp.
Referenced by BezierQuadTest::_get_states_from_time(), and bezier::BezierQuad< Tp >::getPt1().
|
inline |
Definition at line 112 of file BezierQuad.hpp.
References bezier::BezierQuad< Tp >::_duration, bezier::BezierQuad< Tp >::getAcceleration(), bezier::BezierQuad< Tp >::getArcLength(), bezier::BezierQuad< Tp >::getDistToClosestPoint(), bezier::BezierQuad< Tp >::getPoint(), bezier::BezierQuad< Tp >::getStates(), bezier::BezierQuad< Tp >::getStatesClosest(), bezier::BezierQuad< Tp >::getVelocity(), and bezier::BezierQuad< Tp >::setBezFromVel().
|
private |
The saved arc length of the spline.
Definition at line 185 of file BezierQuad.hpp.
|
private |
The resolution used to compute the arc length.
Negative number means that cache is not up to date.
Definition at line 186 of file BezierQuad.hpp.
|
private |
Bezier control point.
Definition at line 181 of file BezierQuad.hpp.
Referenced by bezier::BezierQuad< Tp >::getCtrl().
|
private |
Total time to travle along spline.
Definition at line 183 of file BezierQuad.hpp.
Referenced by bezier::BezierQuad< Tp >::setDuration().
|
private |
Bezier starting point.
Definition at line 180 of file BezierQuad.hpp.
Referenced by bezier::BezierQuad< Tp >::getPt0().
|
private |
bezier end point
Definition at line 182 of file BezierQuad.hpp.
Referenced by bezier::BezierQuad< Tp >::getPt1().