PX4 Firmware
PX4 Autopilot Software http://px4.io
bezier::BezierQuad< Tp > Class Template Reference

#include <BezierQuad.hpp>

Collaboration diagram for bezier::BezierQuad< Tp >:

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...
 

Detailed Description

template<typename Tp>
class bezier::BezierQuad< Tp >

Definition at line 55 of file BezierQuad.hpp.

Member Typedef Documentation

◆ Vector3_t

template<typename Tp >
using bezier::BezierQuad< Tp >::Vector3_t = matrix::Vector<Tp, 3>

Definition at line 59 of file BezierQuad.hpp.

Constructor & Destructor Documentation

◆ BezierQuad() [1/3]

template<typename Tp >
bezier::BezierQuad< Tp >::BezierQuad ( )
inline

Empty constructor.

Definition at line 64 of file BezierQuad.hpp.

◆ BezierQuad() [2/3]

template<typename Tp >
bezier::BezierQuad< Tp >::BezierQuad ( const Tp  pt0[3],
const Tp  ctrl[3],
const Tp  pt1[3],
Tp  duration = 1.0f 
)
inline

Constructor from array.

Definition at line 70 of file BezierQuad.hpp.

◆ BezierQuad() [3/3]

template<typename Tp >
bezier::BezierQuad< Tp >::BezierQuad ( const Vector3_t pt0,
const Vector3_t ctrl,
const Vector3_t pt1,
Tp  duration = 1.0f 
)
inline

Constructor from vector.

Definition at line 76 of file BezierQuad.hpp.

References bezier::BezierQuad< Tp >::getBezier().

Here is the call graph for this function:

Member Function Documentation

◆ _getDistanceSquared()

template<typename Tp >
Tp bezier::BezierQuad< Tp >::_getDistanceSquared ( const Tp  t,
const Vector3_t pose 
)
private

Definition at line 204 of file BezierQuad.cpp.

◆ _goldenSectionSearch()

template<typename Tp >
Tp bezier::BezierQuad< Tp >::_goldenSectionSearch ( const Vector3_t pose)
private

Definition at line 179 of file BezierQuad.cpp.

References bezier::RESOLUTION.

◆ getAcceleration()

template<typename Tp >
matrix::Vector< Tp, 3 > bezier::BezierQuad< Tp >::getAcceleration ( )

Definition at line 81 of file BezierQuad.cpp.

Referenced by bezier::BezierQuad< Tp >::setDuration().

Here is the caller graph for this function:

◆ getArcLength()

template<typename Tp >
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBezier()

template<typename Tp >
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().

Here is the caller graph for this function:

◆ getCtrl()

template<typename Tp >
Vector3_t bezier::BezierQuad< Tp >::getCtrl ( )
inline

Definition at line 94 of file BezierQuad.hpp.

References bezier::BezierQuad< Tp >::_ctrl.

◆ getDistToClosestPoint()

template<typename Tp >
Tp bezier::BezierQuad< Tp >::getDistToClosestPoint ( const Vector3_t pose)

Definition at line 168 of file BezierQuad.cpp.

Referenced by bezier::BezierQuad< Tp >::setDuration().

Here is the caller graph for this function:

◆ getPoint()

template<typename Tp >
matrix::Vector< Tp, 3 > bezier::BezierQuad< Tp >::getPoint ( const Tp  t)

Return point on bezier point corresponding to time t.

Parameters
tis a time in seconds in between [0, duration]
Returns
a point on bezier

Definition at line 67 of file BezierQuad.cpp.

Referenced by BezierQuadTest::_get_arc_length(), and bezier::BezierQuad< Tp >::setDuration().

Here is the caller graph for this function:

◆ getPt0()

template<typename Tp >
Vector3_t bezier::BezierQuad< Tp >::getPt0 ( )
inline

Definition at line 89 of file BezierQuad.hpp.

References bezier::BezierQuad< Tp >::_pt0.

◆ getPt1()

template<typename Tp >
Vector3_t bezier::BezierQuad< Tp >::getPt1 ( )
inline

Definition at line 99 of file BezierQuad.hpp.

References bezier::BezierQuad< Tp >::_pt1, and bezier::BezierQuad< Tp >::setBezier().

Here is the call graph for this function:

◆ getStates()

template<typename Tp >
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().

Here is the caller graph for this function:

◆ getStatesClosest()

template<typename Tp >
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().

Here is the caller graph for this function:

◆ getVelocity()

template<typename Tp >
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().

Here is the caller graph for this function:

◆ setBezFromVel()

template<typename Tp >
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().

Here is the caller graph for this function:

◆ setBezier()

template<typename Tp >
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().

Here is the caller graph for this function:

◆ setDuration()

template<typename Tp >
void bezier::BezierQuad< Tp >::setDuration ( const Tp  time)
inline

Member Data Documentation

◆ _cached_arc_length

template<typename Tp >
Tp bezier::BezierQuad< Tp >::_cached_arc_length = (Tp)0
private

The saved arc length of the spline.

Definition at line 185 of file BezierQuad.hpp.

◆ _cached_resolution

template<typename Tp >
Tp bezier::BezierQuad< Tp >::_cached_resolution = (Tp)(-1)
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.

◆ _ctrl

template<typename Tp >
Vector3_t bezier::BezierQuad< Tp >::_ctrl
private

Bezier control point.

Definition at line 181 of file BezierQuad.hpp.

Referenced by bezier::BezierQuad< Tp >::getCtrl().

◆ _duration

template<typename Tp >
Tp bezier::BezierQuad< Tp >::_duration = (Tp)1
private

Total time to travle along spline.

Definition at line 183 of file BezierQuad.hpp.

Referenced by bezier::BezierQuad< Tp >::setDuration().

◆ _pt0

template<typename Tp >
Vector3_t bezier::BezierQuad< Tp >::_pt0
private

Bezier starting point.

Definition at line 180 of file BezierQuad.hpp.

Referenced by bezier::BezierQuad< Tp >::getPt0().

◆ _pt1

template<typename Tp >
Vector3_t bezier::BezierQuad< Tp >::_pt1
private

bezier end point

Definition at line 182 of file BezierQuad.hpp.

Referenced by bezier::BezierQuad< Tp >::getPt1().


The documentation for this class was generated from the following files: