37 : VariableSet(kSpecifyLater, name)
46 bounds_ = VecBound(n_variables, ifopt::NoBound);
56 VectorXd average_velocity = dp/t_total;
57 int num_nodes =
nodes_.size();
58 for (
int i=0; i<
nodes_.size(); ++i) {
60 n.
at(
kPos) = initial_pos + i/
static_cast<double>(num_nodes-1)*dp;
61 n.
at(
kVel) = average_velocity;
83 for (
int idx=0; idx<GetRows(); ++idx)
92 std::vector<Nodes::IndexInfo>
95 std::vector<IndexInfo> nodes;
98 int n_opt_values_per_node_ = 2*
n_dim_;
99 int internal_id = idx%n_opt_values_per_node_;
104 node.
node_id_ = std::floor(idx/n_opt_values_per_node_);
106 nodes.push_back(node);
116 for (
int idx=0; idx<x.rows(); ++idx)
118 x(idx) =
nodes_.at(info.node_id_).at(info.node_deriv_)(info.node_dim_);
126 for (
int idx=0; idx<x.rows(); ++idx)
128 nodes_.at(info.node_id_).at(info.node_deriv_)(info.node_dim_) = x(idx);
149 return poly_id + side;
152 const std::vector<Node>
155 std::vector<Node> nodes;
179 const std::vector<Node>
187 const std::vector<int>& dimensions,
190 for (
auto dim : dimensions)
197 for (
int idx=0; idx<GetRows(); ++idx)
199 if (info == node_info)
200 bounds_.at(idx) = ifopt::Bounds(val, val);
205 const std::vector<int>& dimensions,
213 const std::vector<int>& dimensions,
void AddBound(const IndexInfo &node_info, double value)
Restricts a specific optimization variables.
Base class to receive up-to-date values of the NodeVariables.
const VectorXd at(Dx deriv) const
Read the state value or it's derivatives by index.
std::vector< Node > nodes_
VectorXd GetValues() const override
void UpdateObservers() const
Notifies the subscribed observers that the node values changes.
void AddObserver(ObserverPtr const spline)
Adds a dependent observer that gets notified when the nodes change.
virtual std::vector< IndexInfo > GetNodeInfoAtOptIndex(int idx) const =0
The node information that the optimization index represents.
void InitializeNodesTowardsGoal(const VectorXd &initial_pos, const VectorXd &final_pos, double t_total)
Sets nodes pos/vel equally spaced from initial to final position.
int node_dim_
the dimension (x,y,z) of that optimization index.
void AddFinalBound(Dx deriv, const std::vector< int > &dimensions, const VectorXd &val)
Restricts the last node in the spline.
int Index(const IndexInfo &node_info) const
The index at which a specific node variable is stored.
void AddBounds(int node_id, Dx deriv, const std::vector< int > &dim, const VectorXd &values)
Bounds a specific node variables.
void InitMembers(int n_nodes, int n_variables)
initializes the member variables.
VecBound bounds_
the bounds on the node values.
static int GetNodeId(int poly_id, Side side)
The node ID that belongs to a specific side of a specific polynomial.
Nodes(int n_dim, const std::string &variable_name)
int GetPolynomialCount() const
std::vector< ObserverPtr > observers_
Dx node_deriv_
The derivative (pos,vel) of that optimziation index.
virtual VecBound GetBounds() const override
Holds information about the node the optimization index represents.
int node_id_
The ID of the node of the optimization index.
void SetVariables(const VectorXd &x) override
Sets the node position and velocity optimization variables.
int operator==(const IndexInfo &right) const
const std::vector< Node > GetBoundaryNodes(int poly_id) const
void AddStartBound(Dx deriv, const std::vector< int > &dimensions, const VectorXd &val)
Restricts the first node in the spline.
A node represents the state of a trajectory at a specific time.
Dx
< the values or derivative. For motions e.g. position, velocity, ...
const std::vector< Node > GetNodes() const