mc_trajectory::ExactCubic Struct Reference

Represents an Exact Cubic spline : a curve that passes exactly through waypoints in position, while respecting optional constraints on its initial and final velocity and acceleration. More...

#include <mc_trajectory/ExactCubic.h>

Inheritance diagram for mc_trajectory::ExactCubic:
Collaboration diagram for mc_trajectory::ExactCubic:

Public Types

using point_t = Eigen::Vector3d
 
using waypoint_t = std::pair< double, point_t >
 
using exact_cubic_t = ndcurves::exact_cubic< double, double, false, point_t >
 
using spline_constraints_t = ndcurves::curve_constraints< point_t >
 

Public Member Functions

 ExactCubic (double duration, const point_t &start, const point_t &target, const std::vector< waypoint_t > &waypoints={}, const point_t &init_vel={}, const point_t &init_acc={}, const point_t &end_vel={}, const point_t &end_acc={})
 
void update () override
 Triggers recreation of the curve. Will only occur if the curve parameters were modified (waypoints, target, constraints), or the sampling size has changed. More...
 
void waypoint (size_t idx, const point_t &waypoint)
 Updates the position of an existing waypoint. More...
 
void waypoint (size_t idx, const double t)
 Updates the time at which an existing waypoint should be reached. More...
 
const waypoint_twaypoint (size_t idx) const
 Gets position of a waypoint. More...
 
double waypointTime (size_t idx) const
 Gets the time at which a waypoint should be reached. More...
 
void constraints (const point_t &init_vel, const point_t &init_acc, const point_t &end_vel, const point_t &end_acc)
 Defines the initial/final velocity and acceleration constraints for the curve. More...
 
const point_tinit_vel () const
 Gets the curve's initial velocity. More...
 
const point_tinit_acc () const
 Gets the curve's initial acceleration. More...
 
const point_tend_vel () const
 Gets the curve's final velocity. More...
 
const point_tend_acc () const
 Gets the curve's final acceleration. More...
 
std::vector< Eigen::Vector3d > splev (double t, unsigned int der=0)
 Computes the position along the curve at time t, and its derivatives up to the nth order (typically velocity, acceleration) More...
 
std::vector< Eigen::Vector3d > sampleTrajectory ()
 Sample positions along the trajectory (for visualization purposes) More...
 
void addToGUI (mc_rtc::gui::StateBuilder &gui, const std::vector< std::string > &category)
 Add GUI elements to control the curve's waypoints and targets. More...
 
- Public Member Functions inherited from mc_trajectory::Spline< Eigen::Vector3d, std::vector< std::pair< double, Eigen::Vector3d > > >
 Spline (double duration, const Eigen::Vector3d &start, const Eigen::Vector3d &target, const std::vector< std::pair< double, Eigen::Vector3d > > &waypoints={})
 
void waypoints (const std::vector< std::pair< double, Eigen::Vector3d > > &waypoints)
 Defines waypoints. More...
 
const std::vector< std::pair< double, Eigen::Vector3d > > & waypoints () const
 Returns waypoints. More...
 
void start (const Eigen::Vector3d &start)
 Starting point for the trajectory at time t=0. More...
 
const Eigen::Vector3d & start () const
 Starting point at time t=0. More...
 
void target (const Eigen::Vector3d &target)
 Sets the spline target. More...
 
const Eigen::Vector3d & target () const
 Gets the spline target position. More...
 
void samplingPoints (unsigned s)
 Number of sampling points for the trajectory visualization. More...
 
unsigned samplingPoints () const
 Gets number of samples. More...
 

Additional Inherited Members

- Protected Attributes inherited from mc_trajectory::Spline< Eigen::Vector3d, std::vector< std::pair< double, Eigen::Vector3d > > >
double duration_
 
Eigen::Vector3d start_
 
Eigen::Vector3d target_
 
std::vector< std::pair< double, Eigen::Vector3d > > waypoints_
 
unsigned samplingPoints_
 
std::vector< Eigen::Vector3d > samples_
 
bool needsUpdate_
 

Detailed Description

Represents an Exact Cubic spline : a curve that passes exactly through waypoints in position, while respecting optional constraints on its initial and final velocity and acceleration.

Member Typedef Documentation

◆ exact_cubic_t

using mc_trajectory::ExactCubic::exact_cubic_t = ndcurves::exact_cubic<double, double, false, point_t>

◆ point_t

using mc_trajectory::ExactCubic::point_t = Eigen::Vector3d

◆ spline_constraints_t

using mc_trajectory::ExactCubic::spline_constraints_t = ndcurves::curve_constraints<point_t>

◆ waypoint_t

using mc_trajectory::ExactCubic::waypoint_t = std::pair<double, point_t>

Constructor & Destructor Documentation

◆ ExactCubic()

mc_trajectory::ExactCubic::ExactCubic ( double  duration,
const point_t start,
const point_t target,
const std::vector< waypoint_t > &  waypoints = {},
const point_t init_vel = {},
const point_t init_acc = {},
const point_t end_vel = {},
const point_t end_acc = {} 
)

Member Function Documentation

◆ addToGUI()

void mc_trajectory::ExactCubic::addToGUI ( mc_rtc::gui::StateBuilder gui,
const std::vector< std::string > &  category 
)

Add GUI elements to control the curve's waypoints and targets.

Parameters
guiGUI to which the task should be added
categorycategory in the GUI to which the curve's control belong to

◆ constraints()

void mc_trajectory::ExactCubic::constraints ( const point_t init_vel,
const point_t init_acc,
const point_t end_vel,
const point_t end_acc 
)

Defines the initial/final velocity and acceleration constraints for the curve.

Parameters
init_velInitial velocity
init_accInitial acceleration
end_velFinal velocity
end_accFinal acceleration

◆ end_acc()

const point_t& mc_trajectory::ExactCubic::end_acc ( ) const

Gets the curve's final acceleration.

Returns
final acceleration

◆ end_vel()

const point_t& mc_trajectory::ExactCubic::end_vel ( ) const

Gets the curve's final velocity.

Returns
final velocity

◆ init_acc()

const point_t& mc_trajectory::ExactCubic::init_acc ( ) const

Gets the curve's initial acceleration.

Returns
initial acceleration

◆ init_vel()

const point_t& mc_trajectory::ExactCubic::init_vel ( ) const

Gets the curve's initial velocity.

Returns
initial velocity

◆ sampleTrajectory()

std::vector<Eigen::Vector3d> mc_trajectory::ExactCubic::sampleTrajectory ( )

Sample positions along the trajectory (for visualization purposes)

Returns
Evenly sampled positions along the trajectory.

◆ splev()

std::vector<Eigen::Vector3d> mc_trajectory::ExactCubic::splev ( double  t,
unsigned int  der = 0 
)

Computes the position along the curve at time t, and its derivatives up to the nth order (typically velocity, acceleration)

Parameters
ttime at which the curve should be evaluated
derderivation order
Returns
The position and its derivatives along the curve at time t.

◆ update()

void mc_trajectory::ExactCubic::update ( )
overridevirtual

Triggers recreation of the curve. Will only occur if the curve parameters were modified (waypoints, target, constraints), or the sampling size has changed.

Implements mc_trajectory::Spline< Eigen::Vector3d, std::vector< std::pair< double, Eigen::Vector3d > > >.

◆ waypoint() [1/3]

const waypoint_t& mc_trajectory::ExactCubic::waypoint ( size_t  idx) const

Gets position of a waypoint.

Parameters
idxwaypoint id
Returns
Position of the waypoint idx

◆ waypoint() [2/3]

void mc_trajectory::ExactCubic::waypoint ( size_t  idx,
const double  t 
)

Updates the time at which an existing waypoint should be reached.

Parameters
idxid of the waypoint
ttime at which the waypoint should be reached

◆ waypoint() [3/3]

void mc_trajectory::ExactCubic::waypoint ( size_t  idx,
const point_t waypoint 
)

Updates the position of an existing waypoint.

Parameters
idxid of the waypoint
waypointdesired position

◆ waypointTime()

double mc_trajectory::ExactCubic::waypointTime ( size_t  idx) const

Gets the time at which a waypoint should be reached.

Parameters
idxwaypoint id
Returns
Waypoint time

The documentation for this struct was generated from the following file: