53 if (x1.rows() != x0.rows())
59 Eigen::VectorXd
x = x0;
61 for (
int i = 0; i < u_seq.size(); ++i)
63 double cur_dt = u_seq[i].first;
74 _dynamics->dynamics(x, u_seq[i].second, x1);
82 #ifdef MESSAGE_SUPPORT 83 void OneStepPredictor::toMessage(messages::OneStepPredictor& message)
const 89 void OneStepPredictor::fromMessage(
const messages::OneStepPredictor& message, std::stringstream* issues)
95 if (message.has_system_dynamics())
99 util::get_oneof_field_type_expand_isolated(message.system_dynamics(),
"system_dynamics", type,
false, 1);
104 dynamics->fromMessage(message.system_dynamics(), issues);
110 if (message.has_integrator())
114 util::get_oneof_field_type(message.integrator(),
"explicit_integrator", type,
false);
119 integrator->fromMessage(message.integrator(), issues);
#define PRINT_ERROR_NAMED(msg)
bool initialize()
initialize the predictor
void predict(const Eigen::Ref< const StateVector > &x0, std::vector< std::pair< double, ControlVector >> u_seq, double dt, Eigen::Ref< StateVector > x1)
Predict x1 using t0, x0, u and dt (alias between x0 and x1 allowed)
SystemDynamicsInterface::Ptr _dynamics
#define PRINT_WARNING_COND(cond, msg)
Print msg-stream only if cond == true.
static Factory & instance()
< Retrieve static instance of the factory
std::shared_ptr< NumericalIntegratorExplicitInterface > Ptr
NumericalIntegratorExplicitInterface::Ptr _integrator
A matrix or vector expression mapping an existing expression.
void setIntegrator(NumericalIntegratorExplicitInterface::Ptr integrator)
Set a numerical integrator for continuous-time dynamics.
std::shared_ptr< Derived > create(const std::string &name, bool print_error=true) const
Create a shared instance of the desired object.
void setSystemDynamics(SystemDynamicsInterface::Ptr dynamics)
Set the system dynamics of the simulated plant.
std::shared_ptr< SystemDynamicsInterface > Ptr