38 std::vector<NodesVariablesPhaseBased::PolyInfo>
40 int n_polys_in_changing_phase)
43 std::vector<PolyInfo> polynomial_info;
45 bool phase_constant = first_phase_constant;
47 for (
int i=0; i<phase_count; ++i) {
49 polynomial_info.push_back(PolyInfo(i,0,1,
true));
51 for (
int j=0; j<n_polys_in_changing_phase; ++j)
52 polynomial_info.push_back(PolyInfo(i,j,n_polys_in_changing_phase,
false));
54 phase_constant = !phase_constant;
57 return polynomial_info;
61 bool first_phase_constant,
62 const std::string& name,
63 int n_polys_in_changing_phase)
80 poly_durations.push_back(phase_durations.at(info.phase_)/info.n_polys_in_phase_);
83 return poly_durations;
90 return 1./n_polys_in_phase;
102 bool is_constant =
false;
124 for (
int id=0;
id<
GetNodes().size(); ++id)
126 node_ids.push_back(
id);
166 std::vector<int> poly_ids;
167 int last_node_id =
GetNodes().size()-1;
170 poly_ids.push_back(0);
171 else if (node_id==last_node_id)
172 poly_ids.push_back(last_node_id-1);
174 poly_ids.push_back(node_id-1);
175 poly_ids.push_back(node_id);
182 int num_polys_in_phase,
bool is_constant)
184 poly_in_phase_(poly_id_in_phase),
185 n_polys_in_phase_(num_polys_in_phase),
186 is_constant_(is_constant)
198 bool is_in_contact_at_start,
199 const std::string& name,
200 int n_polys_in_changing_phase)
202 is_in_contact_at_start,
204 n_polys_in_changing_phase)
216 for (
int node_id=0; node_id<
nodes_.size(); ++node_id) {
219 for (
int dim=0; dim<
GetDim(); ++dim) {
242 for (
int dim=0; dim<
GetDim(); ++dim) {
256 bool is_in_contact_at_start,
257 const std::string& name,
258 int n_polys_in_changing_phase)
260 !is_in_contact_at_start,
262 n_polys_in_changing_phase)
274 for (
int id=0;
id<
nodes_.size(); ++id) {
278 for (
int dim=0; dim<
GetDim(); ++dim) {
const std::vector< Node > GetNodes() const
virtual VecDurations ConvertPhaseToPolyDurations(const VecDurations &phase_durations) const
Converts durations of swing and stance phases to polynomial durations.
NodesVariablesEEMotion(int phase_count, bool is_in_contact_at_start, const std::string &name, int n_polys_in_changing_phase)
std::map< int, std::vector< NodeValueInfo > > OptIndexMap
virtual bool IsConstantNode(int node_id) const
node is constant if either left or right polynomial belongs to a constant phase.
Holds semantic information each polynomial in spline.
PolyInfo(int phase, int poly_in_phase, int n_polys_in_phase, bool is_const)
Position and velocity of nodes used to generate a Hermite spline.
std::vector< int > NodeIds
std::vector< Node > nodes_
static const Bounds NoBound
static int GetNodeId(int poly_id, Side side)
The node ID that belongs to a specific side of a specific polynomial.
std::vector< PolyInfo > polynomial_info_
semantic information associated with each polynomial
Semantic information associated with a scalar node value.
OptIndexMap index_to_node_value_info_
Assign optimization variables to the correct node values.
virtual int GetNumberOfPrevPolynomialsInPhase(int polynomial_id) const
How many polynomials in the current phase come before.
int GetPhase(int node_id) const
std::vector< int > GetAdjacentPolyIds(int node_id) const
IDs of the polynomial to the left and right of node_id.
int GetPolynomialCount() const
void SetRows(int num_rows)
void SetNumberOfVariables(int n_variables)
std::vector< NodesVariablesPhaseBased::PolyInfo > BuildPolyInfos(int phase_count, bool first_phase_constant, int n_polys_in_changing_phase)
Eigen::Vector3d GetValueAtStartOfPhase(int phase) const
OptIndexMap GetPhaseBasedEEParameterization()
virtual double GetDerivativeOfPolyDurationWrtPhaseDuration(int polynomial_id) const
How a change in the phase duration affects the polynomial duration.
int GetPolyIDAtStartOfPhase(int phase) const
ID of the first polynomial of a phase.
int GetNodeIDAtStartOfPhase(int phase) const
std::vector< double > VecDurations
NodesVariablesPhaseBased(int phase_count, bool first_phase_constant, const std::string &var_name, int n_polys_in_changing_phase)
Constructs a variable set of node variables.
Nodes that are associated to either swing or stance phases.
OptIndexMap GetPhaseBasedEEParameterization()
NodeIds GetIndicesOfNonConstantNodes() const
The indices of those nodes that don't belong to a constant phase.
VecBound bounds_
the bounds on the node values.
std::vector< Bounds > VecBound
A node represents the state of a trajectory at a specific time.
virtual bool IsInConstantPhase(int polynomial_id) const
Is the polynomial constant, so not changing the value.
NodesVariablesEEForce(int phase_count, bool is_in_contact_at_start, const std::string &name, int n_polys_in_changing_phase)