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>
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_t & | waypoint (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_t & | init_vel () const |
Gets the curve's initial velocity. More... | |
const point_t & | init_acc () const |
Gets the curve's initial acceleration. More... | |
const point_t & | end_vel () const |
Gets the curve's final velocity. More... | |
const point_t & | end_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_ |
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.
using mc_trajectory::ExactCubic::exact_cubic_t = ndcurves::exact_cubic<double, double, false, point_t> |
using mc_trajectory::ExactCubic::point_t = Eigen::Vector3d |
using mc_trajectory::ExactCubic::spline_constraints_t = ndcurves::curve_constraints<point_t> |
using mc_trajectory::ExactCubic::waypoint_t = std::pair<double, point_t> |
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 = {} |
||
) |
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.
gui | GUI to which the task should be added |
category | category in the GUI to which the curve's control belong to |
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.
init_vel | Initial velocity |
init_acc | Initial acceleration |
end_vel | Final velocity |
end_acc | Final acceleration |
const point_t& mc_trajectory::ExactCubic::end_acc | ( | ) | const |
Gets the curve's final acceleration.
const point_t& mc_trajectory::ExactCubic::end_vel | ( | ) | const |
Gets the curve's final velocity.
const point_t& mc_trajectory::ExactCubic::init_acc | ( | ) | const |
Gets the curve's initial acceleration.
const point_t& mc_trajectory::ExactCubic::init_vel | ( | ) | const |
Gets the curve's initial velocity.
std::vector<Eigen::Vector3d> mc_trajectory::ExactCubic::sampleTrajectory | ( | ) |
Sample positions along the trajectory (for visualization purposes)
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)
t | time at which the curve should be evaluated |
der | derivation order |
|
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 > > >.
const waypoint_t& mc_trajectory::ExactCubic::waypoint | ( | size_t | idx | ) | const |
Gets position of a waypoint.
idx | waypoint id |
void mc_trajectory::ExactCubic::waypoint | ( | size_t | idx, |
const double | t | ||
) |
Updates the time at which an existing waypoint should be reached.
idx | id of the waypoint |
t | time at which the waypoint should be reached |
void mc_trajectory::ExactCubic::waypoint | ( | size_t | idx, |
const point_t & | waypoint | ||
) |
Updates the position of an existing waypoint.
idx | id of the waypoint |
waypoint | desired position |
double mc_trajectory::ExactCubic::waypointTime | ( | size_t | idx | ) | const |
Gets the time at which a waypoint should be reached.
idx | waypoint id |