25 #ifndef SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_DISCRETIZATION_GRID_INTERFACE_H_ 26 #define SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_DISCRETIZATION_GRID_INTERFACE_H_ 43 #ifdef MESSAGE_SUPPORT 44 #include <corbo-communication/messages/optimal_control/discretization_grids.pb.h> 85 using Ptr = std::shared_ptr<DiscretizationGridInterface>;
86 using UPtr = std::unique_ptr<DiscretizationGridInterface>;
103 virtual Ptr getInstance()
const = 0;
113 virtual void setN(
int n,
bool try_resample =
true) = 0;
114 virtual void setInitialDt(
double dt) = 0;
116 virtual int getN()
const = 0;
117 virtual double getFirstDt()
const = 0;
118 virtual double getFinalTime()
const = 0;
119 virtual double getInitialDt()
const = 0;
120 virtual int getInitialN()
const = 0;
123 virtual bool hasConstantControls()
const = 0;
124 virtual bool hasSingleDt()
const = 0;
125 virtual bool isTimeVariableGrid()
const = 0;
126 virtual bool isUniformGrid()
const = 0;
127 virtual bool providesStateTrajectory()
const = 0;
133 virtual bool getFirstControlInput(Eigen::VectorXd& u0) = 0;
135 void clear()
override = 0;
137 virtual bool isEmpty()
const = 0;
141 #ifdef MESSAGE_SUPPORT 142 virtual void fromMessage(
const messages::DiscretizationGrid& message, std::stringstream* issues) {}
143 virtual void toMessage(messages::DiscretizationGrid& message)
const {}
148 std::vector<VertexInterface*>& getActiveVertices()
override = 0;
149 void getVertices(std::vector<VertexInterface*>& vertices)
override = 0;
151 void computeActiveVertices()
override = 0;
155 if (!_u_prev.isFixed() || !_u_prev_dt.isFixed()) setModified(
true);
156 _u_prev.values() = prev_u;
157 _u_prev.setFixed(
true);
158 _u_prev_dt.value() = prev_u_dt;
159 _u_prev_dt.setFixed(
true);
163 if (!_u_ref.isFixed()) setModified(
true);
164 _u_ref.values() = last_u_ref;
165 _u_ref.setFixed(
true);
174 #define FACTORY_REGISTER_DISCRETIZATION_GRID(type) FACTORY_REGISTER_OBJECT(type, DiscretizationGridInterface) 178 #endif // SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_DISCRETIZATION_GRID_INTERFACE_H_
static Factory< DiscretizationGridInterface > & getFactory()
Get access to the accociated factory.
std::unique_ptr< DiscretizationGridInterface > UPtr
Abstract class representing a set of vertices.
void setPreviousControl(const Eigen::VectorXd &prev_u, double prev_u_dt)
Generic interface class for discretization grids.
Vertex implementation for scalar values.
Representation of time stamps.
constexpr const double CORBO_INF_DBL
Representation for infinity (double version)
static Factory & instance()
< Retrieve static instance of the factory
void setLastControlRef(const Eigen::VectorXd &last_u_ref)
Interface class for reference trajectories.
std::shared_ptr< DiscretizationGridInterface > Ptr
Vertex implementation that stores an Eigen::VectorXd (dynamic dimension)
std::shared_ptr< TimeSeries > Ptr
std::shared_ptr< SystemDynamicsInterface > Ptr