25 #ifndef SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_SHOOTING_GRID_BASE_H_ 26 #define SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_SHOOTING_GRID_BASE_H_ 42 using Ptr = std::shared_ptr<ShootingGridBase>;
43 using UPtr = std::unique_ptr<ShootingGridBase>;
48 std::vector<VectorVertex>
u_seq;
76 void clear()
override;
81 void setN(
int n,
bool try_resample =
true)
override 91 int getN()
const override;
116 void getVertices(std::vector<VertexInterface*>& vertices)
override;
118 #ifdef MESSAGE_SUPPORT 119 void fromMessage(
const messages::DiscretizationGrid& message, std::stringstream* issues)
override {}
120 void toMessage(messages::DiscretizationGrid& message)
const override {}
176 #endif // SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_SHOOTING_GRID_BASE_H_ void setNumControlsPerShootingInterval(int num_u_per_interv)
virtual bool isDtFixedIntended() const
void getStateAndControlTimeSeries(TimeSeries::Ptr x_sequence, TimeSeries::Ptr u_sequence, double t_max=CORBO_INF_DBL) const override
Return state and control trajectory as time series object (shared instance)
std::unique_ptr< DiscretizationGridInterface > UPtr
double getFirstDt() const override
void computeActiveVertices() override
void setInitialDt(double dt) override
ShootingGridBase()=default
Generic interface class for discretization grids.
bool isTimeVariableGrid() const override
void setXfFixed(const Eigen::Matrix< bool, -1, 1 > &xf_fixed)
bool _intermediate_x_constraints
bool isEmpty() const override
virtual bool adaptGrid(bool new_run, NlpFunctions &nlp_fun)
void setNumControlsPerShootingInterval(int num_u_per_interv, bool intermediate_x_constraints)
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW
bool hasSingleDt() const override
bool _full_discretization
Vertex implementation for scalar values.
NumericalIntegratorExplicitInterface::Ptr _integrator
std::vector< VectorVertex > u_seq
void updateBounds(const NlpFunctions &nlp_fun)
Representation of time stamps.
void resampleTrajectory(int n_new, NlpFunctions &nlp_fun)
double getFinalTime() const override
Vector based vertex with support for partially fixed components.
Eigen::Matrix< bool, -1, 1 > _xf_fixed
std::vector< VertexInterface * > _active_vertices
DiscretizationGridInterface::Ptr getInstance() const override=0
Return a newly created shared instance of the implemented class.
bool hasConstantControls() const override
GridUpdateResult update(const Eigen::VectorXd &x0, ReferenceTrajectoryInterface &xref, ReferenceTrajectoryInterface &uref, NlpFunctions &nlp_fun, OptimizationEdgeSet &edges, SystemDynamicsInterface::Ptr dynamics, bool new_run, const Time &t, ReferenceTrajectoryInterface *sref=nullptr, const Eigen::VectorXd *prev_u=nullptr, double prev_u_dt=0, ReferenceTrajectoryInterface *xinit=nullptr, ReferenceTrajectoryInterface *uinit=nullptr) override
std::vector< ShootingInterval > _intervals
void setModified(bool modified)
void getVertices(std::vector< VertexInterface *> &vertices) override
constexpr const double CORBO_INF_DBL
Representation for infinity (double version)
int getInitialN() const override
int _num_u_per_interv_ref
void setWarmStart(bool active)
int getN() const override
void setConsiderIntermediateStateConstraints(bool active)
double getInitialDt() const override
int findNearestShootingInterval(const Eigen::VectorXd &x0)
const double & value() const
Get underlying value.
std::shared_ptr< NumericalIntegratorExplicitInterface > Ptr
virtual ~ShootingGridBase()=default
bool checkAndInitializeXfFixedFlags(int dim_x)
virtual void createEdges(NlpFunctions &nlp_fun, OptimizationEdgeSet &edges, SystemDynamicsInterface::Ptr dynamics)=0
Interface class for reference trajectories.
std::shared_ptr< DiscretizationGridInterface > Ptr
virtual bool isGridAdaptActive() const
void initializeSequences(const Eigen::VectorXd &x0, const Eigen::VectorXd &xf, ReferenceTrajectoryInterface &uref, NlpFunctions &nlp_fun)
virtual bool isXfShootingNode() const
Vertex implementation that stores an Eigen::VectorXd (dynamic dimension)
std::shared_ptr< TimeSeries > Ptr
bool providesStateTrajectory() const override
bool getFirstControlInput(Eigen::VectorXd &u0) override
PartiallyFixedVectorVertex _xf
void warmStartShifting(const Eigen::VectorXd &x0)
std::vector< VertexInterface * > & getActiveVertices() override
std::shared_ptr< SystemDynamicsInterface > Ptr
virtual bool isMovingHorizonWarmStartActive() const
bool isUniformGrid() const override
void setN(int n, bool try_resample=true) override
Return dimension of the control input dimension in the grid.
void setNumericalIntegrator(NumericalIntegratorExplicitInterface::Ptr integrator)