Position and velocity of nodes used to generate a Hermite spline. More...
#include <nodes.h>
Classes | |
struct | IndexInfo |
Holds information about the node the optimization index represents. More... | |
Public Types | |
using | ObserverPtr = NodesObserver * |
using | Ptr = std::shared_ptr< Nodes > |
enum | Side { Start =0, End } |
using | VecDurations = std::vector< double > |
Public Member Functions | |
void | AddFinalBound (Dx deriv, const std::vector< int > &dimensions, const VectorXd &val) |
Restricts the last node in the spline. More... | |
void | AddObserver (ObserverPtr const spline) |
Adds a dependent observer that gets notified when the nodes change. More... | |
void | AddStartBound (Dx deriv, const std::vector< int > &dimensions, const VectorXd &val) |
Restricts the first node in the spline. More... | |
const std::vector< Node > | GetBoundaryNodes (int poly_id) const |
virtual VecBound | GetBounds () const override |
int | GetDim () const |
virtual std::vector< IndexInfo > | GetNodeInfoAtOptIndex (int idx) const =0 |
The node information that the optimization index represents. More... | |
const std::vector< Node > | GetNodes () const |
int | GetPolynomialCount () const |
VectorXd | GetValues () const override |
int | Index (const IndexInfo &node_info) const |
The index at which a specific node variable is stored. More... | |
int | Index (int node_id, Dx deriv, int node_dim) const |
void | InitializeNodesTowardsGoal (const VectorXd &initial_pos, const VectorXd &final_pos, double t_total) |
Sets nodes pos/vel equally spaced from initial to final position. More... | |
void | SetVariables (const VectorXd &x) override |
Sets the node position and velocity optimization variables. More... | |
Static Public Member Functions | |
static int | GetNodeId (int poly_id, Side side) |
The node ID that belongs to a specific side of a specific polynomial. More... | |
Protected Member Functions | |
void | InitMembers (int n_nodes, int n_variables) |
initializes the member variables. More... | |
Nodes (int n_dim, const std::string &variable_name) | |
virtual | ~Nodes ()=default |
Protected Attributes | |
VecBound | bounds_ |
the bounds on the node values. More... | |
Private Member Functions | |
void | AddBound (const IndexInfo &node_info, double value) |
Restricts a specific optimization variables. More... | |
void | AddBounds (int node_id, Dx deriv, const std::vector< int > &dim, const VectorXd &values) |
Bounds a specific node variables. More... | |
void | UpdateObservers () const |
Notifies the subscribed observers that the node values changes. More... | |
Private Attributes | |
int | n_dim_ |
std::vector< Node > | nodes_ |
std::vector< ObserverPtr > | observers_ |
Position and velocity of nodes used to generate a Hermite spline.
Instead of setting the polynomial coefficients directly, a third-order polynomial is also fully defined by the value and first-derivative of the start and end of the polynomial as well as the duration. This way of specifying a polynomial is called "Hermite". These are the node values of position and velocity.
using towr::Nodes::ObserverPtr = NodesObserver* |
using towr::Nodes::Ptr = std::shared_ptr<Nodes> |
using towr::Nodes::VecDurations = std::vector<double> |
enum towr::Nodes::Side |
|
protected |
|
protectedvirtualdefault |
|
private |
void towr::Nodes::AddObserver | ( | ObserverPtr const | spline | ) |
const std::vector< Node > towr::Nodes::GetBoundaryNodes | ( | int | poly_id | ) | const |
|
overridevirtual |
int towr::Nodes::GetDim | ( | ) | const |
|
static |
|
pure virtual |
The node information that the optimization index represents.
idx | The index (=row) of the node optimization variable. |
One optimization variables can also represent multiple nodes in the spline if they are always equal (e.g. constant phases). This is why this function returns a vector.
Implemented in towr::PhaseNodes, and towr::BaseNodes.
const std::vector< Node > towr::Nodes::GetNodes | ( | ) | const |
int towr::Nodes::GetPolynomialCount | ( | ) | const |
|
override |
int towr::Nodes::Index | ( | const IndexInfo & | node_info | ) | const |
int towr::Nodes::Index | ( | int | node_id, |
Dx | deriv, | ||
int | node_dim | ||
) | const |
|
protected |
|
override |
|
private |
|
protected |
|
private |