12 #ifndef ECL_MANIPULATORS_TRAJECTORY_HPP_ 13 #define ECL_MANIPULATORS_TRAJECTORY_HPP_ 56 template <enum ManipulatorAngleType Type = Jo
intAngles>
102 Trajectory(
const unsigned int& dimension,
const char* name_identifier =
"") :
103 name(name_identifier),
104 spline_functions(dimension),
105 max_accelerations(
Array<double>::Constant(dimension,0.0))
117 void clear() { clearSplines(); waypoints.clear(); }
123 unsigned int size()
const {
return waypoints.size(); }
131 unsigned int dimension()
const {
return max_accelerations.size(); }
142 spline_functions.resize(dim);
159 waypoints.push_back(waypoint);
171 return waypoints.back();
183 return waypoints.back();
197 return waypoints[index];
221 void tensionSplineInterpolation(
const double &tension);
243 void linearSplineInterpolation();
252 double operator ()(
const unsigned int& joint,
const double& time );
260 double derivative(
const unsigned int& joint,
const double& time );
268 double dderivative(
const unsigned int& joint,
const double& time );
296 for (
unsigned int i = 0; i < dimension(); ++i ) {
297 max_accelerations[i] = max_acceleration;
321 template <
typename OutputStream>
322 friend OutputStream& operator << (OutputStream &ostream, Trajectory<JointAngles> &trajectory);
334 const double&
duration()
const {
return trajectory_duration; }
361 Array<TensionSpline> generateTensionSplines(
const double& tension,
const double initial_time = 0.0);
367 bool validateWaypoints(
unsigned int min_no_waypoints);
373 bool initialiseWaypointDurations();
381 void updateDuration();
388 template <
typename OutputStream>
389 OutputStream& operator << (OutputStream &ostream, Trajectory<JointAngles> &trajectory) {
393 for (
unsigned int i = 0; i < trajectory.waypoints.size(); ++i ) {
394 ostream <<
"Waypoint " << i <<
"\n";
395 ostream << trajectory.waypoints[i] <<
"\n";
Array< double > max_accelerations
WayPoint< JointAngles > & last()
Get the last waypoint in the trajectory.
const WayPoint< JointAngles > & waypoint(const unsigned int &index)
Get a handle to the specified waypoint.
Trajectory(const unsigned int &dimension, const char *name_identifier="")
Configures the joint dimension, and also (optionally) the trajectory name.
void append(const WayPoint< JointAngles > &waypoint)
Appends a waypoint to the trajectory specification.
Trajectory()
Unreachable constructor.
Array< double > & maxAccelerations()
Handle to the max accelerations array, use to initialise the polynomial.
Waypoint definitions for various manipulator contexts.
unsigned int size() const
Number of waypoints in the trajectory.
Type definitions for manipulators.
unsigned int dimension() const
Dimension, or degrees of freedom for the trajectory.
Array< std::vector< GenericSplineFunction * > > spline_functions
#define ecl_assert_throw(expression, exception)
Parameter< std::string > name
String name identifier.
double trajectory_duration
const WayPoint< JointAngles > & last() const
Const version of the last waypoint in the trajectory.
void redimension(const unsigned int &dim)
Reset the dimension, or degrees of freedom for the trajectory.
virtual ~Trajectory()
Default destructor.
const double & duration() const
Total trajectory duration (in seconds).
Trajectory(const char *name_identifier="")
Default constructor, only (optionally) configures the trajectory name.
#define ecl_compile_time_concept_check(Model)
static ConstantArray< Type, Size > Constant(const Type &value)
unsigned int dimension() const
Return the waypoint dimension.
Primary template for manipulator trajectories.
const Array< double > & maxAccelerations() const
Non-modifiable handle to the max accelerations array.
WayPoint specialisation with joint (motor) angle storage format.
Joint angle representations are being used.
void clear()
Clear the waypoints and splines.
void maxAccelerations(const double &max_acceleration)
Configure the entire trajectory with a uniform max acceleration bound.
std::vector< WayPoint< JointAngles > > waypoints