30 #ifndef TOWR_VARIABLES_PHASE_NODES_H_ 31 #define TOWR_VARIABLES_PHASE_NODES_H_ 61 using Ptr = std::shared_ptr<NodesVariablesPhaseBased>;
63 using OptIndexMap = std::map<int, std::vector<NodeValueInfo> >;
73 PolyInfo(
int phase,
int poly_in_phase,
int n_polys_in_phase,
bool is_const);
85 bool first_phase_constant,
86 const std::string& var_name,
87 int n_polys_in_changing_phase);
169 return index_to_node_value_info_.at(idx);
194 bool is_in_contact_at_start,
195 const std::string& name,
196 int n_polys_in_changing_phase);
210 bool is_in_contact_at_start,
211 const std::string& name,
212 int n_polys_in_changing_phase);
int n_polys_in_phase_
the number of polynomials used for this phase.
int GetNodeIDAtStartOfPhase(int phase) const
std::map< int, std::vector< NodeValueInfo > > OptIndexMap
std::vector< int > GetAdjacentPolyIds(int node_id) const
IDs of the polynomial to the left and right of node_id.
bool is_constant_
Does this polynomial represent a constant phase.
Holds semantic information each polynomial in spline.
int phase_
The phase ID this polynomial represents.
virtual ~NodesVariablesPhaseBased()=default
Eigen::Vector3d GetValueAtStartOfPhase(int phase) const
virtual bool IsInConstantPhase(int polynomial_id) const
Is the polynomial constant, so not changing the value.
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::shared_ptr< Component > Ptr
std::vector< PolyInfo > polynomial_info_
semantic information associated with each polynomial
OptIndexMap index_to_node_value_info_
Assign optimization variables to the correct node values.
Variables fully defining the endeffector forces.
Variables fully defining the endeffector motion.
NodeIds GetIndicesOfNonConstantNodes() const
The indices of those nodes that don't belong to a constant phase.
void SetNumberOfVariables(int n_variables)
virtual double GetDerivativeOfPolyDurationWrtPhaseDuration(int polynomial_id) const
How a change in the phase duration affects the polynomial duration.
int poly_in_phase_
is this the 1st, 2nd, ... polynomial or this phase.
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.
int GetPolyIDAtStartOfPhase(int phase) const
ID of the first polynomial of a phase.
Nodes that are associated to either swing or stance phases.
virtual VecDurations ConvertPhaseToPolyDurations(const VecDurations &phase_durations) const
Converts durations of swing and stance phases to polynomial durations.
int GetPhase(int node_id) const
std::vector< NodeValueInfo > GetNodeValuesInfo(int idx) const override
Node values affected by one specific optimization variable.
virtual bool IsConstantNode(int node_id) const
node is constant if either left or right polynomial belongs to a constant phase.
virtual int GetNumberOfPrevPolynomialsInPhase(int polynomial_id) const
How many polynomials in the current phase come before.