40 int n_coeff = order+1;
41 for (
int c=
A; c<n_coeff; ++c) {
42 coeff_ids_.push_back(static_cast<Coefficients>(c));
43 coeff_.push_back(VectorXd::Zero(dim));
53 int n_dim =
coeff_.front().size();
67 case kPos:
return std::pow(t,c);
break;
68 case kVel:
return c>=
B? c* std::pow(t,c-1) : 0.0;
break;
69 case kAcc:
return c>=
C? c*(c-1)*std::pow(t,c-2) : 0.0;
break;
70 default: assert(
false);
109 double t_local)
const 126 double t_local)
const 144 double t2 = std::pow(t,2);
145 double t3 = std::pow(t,3);
147 double T2 = std::pow(
T_,2);
148 double T3 = std::pow(
T_,3);
150 switch (node_value) {
151 case kPos:
return (2*t3)/T3 - (3*t2)/T2 + 1;
152 case kVel:
return t - (2*t2)/T + t3/T2;
153 default: assert(
false);
161 double t2 = std::pow(t,2);
163 double T2 = std::pow(
T_,2);
164 double T3 = std::pow(
T_,3);
166 switch (node_value) {
167 case kPos:
return (6*t2)/T3 - (6*t)/T2;
168 case kVel:
return (3*t2)/T2 - (4*t)/T + 1;
169 default: assert(
false);
178 double T2 = std::pow(
T_,2);
179 double T3 = std::pow(
T_,3);
181 switch (node_value) {
182 case kPos:
return (12*t)/T3 - 6/T2;
183 case kVel:
return (6*t)/T2 - 4/T;
184 default: assert(
false);
192 double t2 = std::pow(t,2);
193 double t3 = std::pow(t,3);
195 double T2 = std::pow(
T_,2);
196 double T3 = std::pow(
T_,3);
198 switch (node_value) {
199 case kPos:
return (3*t2)/T2 - (2*t3)/T3;
200 case kVel:
return t3/T2 - t2/T;
201 default: assert(
false);
209 double t2 = std::pow(t,2);
211 double T2 = std::pow(
T_,2);
212 double T3 = std::pow(
T_,3);
214 switch (node_value) {
215 case kPos:
return (6*t)/T2 - (6*t2)/T3;
216 case kVel:
return (3*t2)/T2 - (2*t)/T;
217 default: assert(
false);
226 double T2 = std::pow(
T_,2);
227 double T3 = std::pow(
T_,3);
229 switch (node_value) {
230 case kPos:
return 6/T2 - (12*t)/T3;
231 case kVel:
return (6*t)/T2 - 2/T;
232 default: assert(
false);
244 double t2 = std::pow(t,2);
245 double t3 = std::pow(t,3);
247 double T2 = std::pow(
T_,2);
248 double T3 = std::pow(
T_,3);
249 double T4 = std::pow(
T_,4);
252 - (t2*(2*v0 + v1))/T2
253 - (3*t3*(2*x0 - 2*x1 + T*v0 + T*v1))/T4
254 + (2*t2*(3*x0 - 3*x1 + 2*T*v0 + T*v1))/T3;
Stores at state comprised of values and higher-order derivatives.
const VectorXd at(Dx deriv) const
Read the state value or it's derivatives by index.
A polynomial of arbitrary order and dimension.
double T_
the total duration of the polynomial.
double GetDerivativeOfAccWrtEndNode(Dx node_deriv, double t_local) const
void SetNodes(const Node &n0, const Node &n1)
Fully defines the polynomial by the node values using current duration.
Node n1_
the start and final node comprising the polynomial.
double GetDerivativeOfVelWrtEndNode(Dx node_deriv, double t_local) const
double GetDerivativeOfAccWrtStartNode(Dx node_deriv, double t_local) const
Polynomial(int poly_order, int poly_dim)
Constructs a polynomial with zero coefficient values.
CubicHermitePolynomial(int dim)
void SetDuration(double duration)
sets the total duration of the polynomial.
void UpdateCoeff()
updates the coefficients using current nodes and durations.
double GetDerivativeWrtStartNode(Dx dfdt, Dx node_deriv, double t) const
The derivative of the polynomial when changing the start node.
double GetDerivativeWrtCoeff(double t, Dx poly_deriv, Coefficients coeff) const
The derivative of the polynomial with respect to the coefficients.
double GetDerivativeWrtEndNode(Dx dfdt, Dx node_deriv, double t) const
The derivative of the polynomial when changing the end node.
std::vector< VectorXd > coeff_
double GetDerivativeOfVelWrtStartNode(Dx node_deriv, double t_local) const
double GetDerivativeOfPosWrtEndNode(Dx node_deriv, double t_local) const
double GetDerivativeOfPosWrtStartNode(Dx node_deriv, double t_local) const
State GetPoint(double t) const
VectorXd GetDerivativeOfPosWrtDuration(double t) const
How the total duration affect the value ("pos") of the polynomial.
A node represents the state of a trajectory at a specific time.
Dx
< the values or derivative. For motions e.g. position, velocity, ...