85 a2_ = 3.0*(b - a) - 2.0*(adot - bdot);
86 a3_ = -2.0*(b - a) + 1.0*(bdot - adot);
99 HUMOTO_ASSERT((t >= 0.0) && (t <= 1.0),
"time value not between 0 and 1." )
100 return (a0_ + a1_*t + a2_*t*t + a3_*t*t*t);
113 HUMOTO_ASSERT((t >= 0.0) && (t <= 1.0),
"time value not between 0 and 1." )
114 return (a1_ + 2.0*a2_*t + 3.0*a3_*t*t);
127 HUMOTO_ASSERT((t >= 0.0) && (t <= 1.0),
"time value not between 0 and 1." )
128 return (2.0*a2_ + 6.0*a3_*t);
154 switch(trajectory_type)
157 return getPosition(t);
159 return getVelocity(t);
161 return getAcceleration(t);
176 std::vector<double>
eval(
const Eigen::VectorXd& time_points,
179 std::vector<double> result(time_points.size());
181 for(std::size_t i = 0; i < result.size(); ++i)
183 result[i] = eval(time_points(i), trajectory_type);
197 static Eigen::VectorXd
scale(
const Eigen::VectorXd& time_points)
199 Eigen::VectorXd result(time_points.size());
203 result[i] = (time_points(i) - time_points.minCoeff()) / (time_points.maxCoeff() - time_points.minCoeff());
void initialize(const double a, const double b)
Builds cubic polynomial in t = [0, 1] with first derivative equal to 0 at both ends.
double getVelocity(const double t) const
Computes velocity at the given time point.
CubicPolynomial1D()
Constructor.
std::vector< double > eval(const Eigen::VectorXd &time_points, const TrajectoryEvaluationType::Type trajectory_type) const
Evaluate the polynomial at time_interval points.
static Eigen::VectorXd scale(const Eigen::VectorXd &time_points)
Scale vector.
#define HUMOTO_ASSERT(condition, message)
double getJerk() const
Computes jerk.
Class interpolating simple 1D cubic polynomial between two 1D points. Use this class to build more co...
#define HUMOTO_THROW_MSG(s)
HUMOTO_THROW_MSG throws an error message concatenated with the name of the function (if supported)...
EIGEN_DEFAULT_DENSE_INDEX_TYPE EigenIndex
double getPosition(const double t) const
Computes position at the given time point.
void initialize(const double a, const double adot, const double b, const double bdot)
Builds cubic polynomial in t = [0, 1] with first derivative not equal to 0 at ends.
double eval(const double t, const TrajectoryEvaluationType::Type trajectory_type) const
Evaluate the spline at a point.
The root namespace of HuMoTo.
double getAcceleration(const double t) const
Computes acceleration at the given time point.
Type of interpolated trajectory.