Go to the documentation of this file.
30 #ifndef EXOTICA_CORE_DYNAMICS_SOLVER_H_
31 #define EXOTICA_CORE_DYNAMICS_SOLVER_H_
38 #include <exotica_core/dynamics_solver_initializer.h>
40 #define REGISTER_DYNAMICS_SOLVER_TYPE(TYPE, DERIV) EXOTICA_CORE_REGISTER(exotica::DynamicsSolver, TYPE, DERIV)
54 template <
typename T,
int NX,
int NU>
72 virtual void AssignScene(std::shared_ptr<Scene> scene_in);
75 virtual void SetDt(
double dt_in);
138 assert(x_1.size() == x_2.size());
151 assert(x_1.size() == x_2.size());
166 assert(x_1.size() == x_2.size());
272 #endif // EXOTICA_CORE_DYNAMICS_SOLVER_H_
void StateDelta(const StateVector &x_1, const StateVector &x_2, Eigen::VectorXdRef xout)
const ControlDerivative & get_fu() const
Returns derivative fu computed by ComputeDerivatives.
int num_state_
Size of state space (num_positions + num_velocities)
StateDerivative fx_fd(const StateVector &x, const ControlVector &u)
Derivative of the forward dynamics w.r.t. the state [finite differencing].
Eigen::Matrix< T, NX, 1 > StateVector
Convenience definition for a StateVector containing both position and velocity (dimension NX x 1)
bool has_state_limits_
Whether the solver specifies state limits.
virtual Hessian ddStateDelta(const StateVector &x_1, const StateVector &x_2, const ArgumentPosition first_or_second)
const Eigen::MatrixXd & get_control_limits()
Returns the control limits vector.
int get_num_controls() const
Returns number of controls.
const bool & get_has_second_order_derivatives() const
Returns whether second-order derivatives are available.
const StateDerivative & get_Fx() const
Returns derivative Fx computed by ComputeDerivatives.
@ SymplecticEuler
Semi-Implicit Euler.
virtual void Integrate(const StateVector &x, const StateVector &dx, const double dt, StateVector &xout)
Integrates without performing dynamics.
void InitializeSecondOrderDerivatives()
Eigen::Tensor< T, 3 > fxx_default_
virtual ~AbstractDynamicsSolver()
bool second_order_derivatives_initialized_
Whether fxx, fxu and fuu have been initialized to 0.
virtual void ComputeDerivatives(const StateVector &x, const ControlVector &u)
Computes derivatives fx, fu, Fx, Fu [single call for efficiency, derivatives can be retrieved with ge...
Eigen::VectorXd state_limits_upper_
Upper state limits (configuration and velocity)
virtual Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > dStateDelta(const StateVector &x_1, const StateVector &x_2, const ArgumentPosition first_or_second)
Return the difference of the StateDelta operation between two state vectors. The ArgumentPosition arg...
int num_positions_
Number of positions in the dynamic system.
Eigen::VectorXd raw_control_limits_low_
Eigen::Tensor< T, 3 > fxu_default_
Eigen::MatrixXd fu_
Internal storage of differential dynamics partial derivative fu computed by ComputeDerivatives.
Eigen::VectorXd raw_control_limits_high_
std::shared_ptr< exotica::DynamicsSolver > DynamicsSolverPtr
Eigen::Matrix< T, NX, NX > StateDerivative
Convenience definition for a StateDerivative.
virtual void AssignScene(std::shared_ptr< Scene > scene_in)
Passes the Scene of the PlanningProblem to the DynamicsSolver.
virtual Eigen::Tensor< T, 3 > fxx(const StateVector &x, const ControlVector &u)
bool control_limits_initialized_
const StateDerivative & get_fx() const
Returns derivative fx computed by ComputeDerivatives.
Eigen::Array< Eigen::MatrixXd, Eigen::Dynamic, 1 > Hessian
void ClampToStateLimits(Eigen::Ref< Eigen::VectorXd > state_in)
Clamps the passed in state to the state limits.
Eigen::MatrixXd dStateDelta_
int num_state_derivative_
Size of the tangent vector to the state space (2 * num_velocities)
bool has_second_order_derivatives_
Whether this solver provides second order derivatives. If false (default), assumed to be all zeros.
int get_num_velocities() const
Returns number of velocities.
const ControlDerivative & get_Fu() const
Returns derivative Fu computed by ComputeDerivatives.
int get_num_state() const
Returns size of state space (nx)
int get_num_state_derivative() const
Returns size of derivative vector of state space (ndx)
virtual Eigen::Tensor< T, 3 > fuu(const StateVector &x, const ControlVector &u)
Eigen::VectorXd state_limits_lower_
Lower state limits (configuration and velocity)
Eigen::Ref< Eigen::VectorXd > VectorXdRef
const typedef Eigen::Ref< const Eigen::VectorXd > & VectorXdRefConst
Convenience wrapper for storing references to sub-matrices/vectors.
T get_dt() const
Returns integration timestep dt.
T dt_
Internal timestep used for integration. Defaults to 10ms.
Eigen::Matrix< T, NX, NU > ControlDerivative
Convenience definition for a ControlDerivative.
ArgumentPosition
Argument position. Used as parameter to refer to an argument.
Eigen::MatrixXd fx_
Internal storage of differential dynamics partial derivative fx computed by ComputeDerivatives.
Eigen::MatrixXd Fx_
Internal storage of state transition partial derivative Fx computed by ComputeDerivatives.
Integrator integrator_
Chosen integrator. Defaults to Euler (RK1).
void set_control_limits(Eigen::VectorXdRefConst control_limits_low, Eigen::VectorXdRefConst control_limits_high)
Sets the control limits.
Eigen::Matrix< T, NU, 1 > ControlVector
Convenience definition for a ControlVector (dimension NU x 1)
virtual ControlDerivative fu(const StateVector &x, const ControlVector &u)
Derivative of the forward dynamics w.r.t. the control.
virtual StateVector SimulateOneStep(const StateVector &x, const ControlVector &u)
Integrates the dynamic system from state x with controls u applied for one timestep dt using the sele...
virtual StateDerivative fx(const StateVector &x, const ControlVector &u)
Derivative of the forward dynamics w.r.t. the state.
virtual ControlVector InverseDynamics(const StateVector &state)
Returns a control vector corresponding to the state vector assuming zero acceleration.
virtual void SetDt(double dt_in)
Sets the timestep dt to be used for integration.
Eigen::MatrixXd control_limits_
ControlLimits. Default is empty vector.
@ RK1
Forward Euler (explicit)
Eigen::Tensor< T, 3 > fuu_default_
void SetIntegrator(const std::string &integrator_in)
Sets integrator type based on request string.
int get_num_positions() const
Returns number of positions.
virtual StateVector f(const StateVector &x, const ControlVector &u)=0
Forward dynamics. This computes the differential dynamics.
Eigen::MatrixXd Fu_
Internal storage of state transition partial derivative Fu computed by ComputeDerivatives.
Integrator get_integrator() const
Returns used integration scheme.
ControlDerivative fu_fd(const StateVector &x, const ControlVector &u)
Derivative of the forward dynamics w.r.t. the control [finite differencing].
const bool & get_has_state_limits() const
Returns whether state limits are available.
virtual void InstantiateBase(const Initializer &init)
Instantiates the base properties of the DynamicsSolver.
int num_controls_
Number of controls in the dynamic system.
StateVector Simulate(const StateVector &x, const ControlVector &u, T t)
Simulates the dynamic system from starting state x using control u for t seconds.
virtual Eigen::Matrix< T, Eigen::Dynamic, 1 > GetPosition(Eigen::VectorXdRefConst x_in)
Returns the position-part of the state vector to update the scene. For types including SE(3) and rota...
virtual StateVector StateDelta(const StateVector &x_1, const StateVector &x_2)
Return the difference of two state vectors. Used when e.g. angle differences need to be wrapped from ...
AbstractDynamicsSolver< double, Eigen::Dynamic, Eigen::Dynamic > DynamicsSolver
virtual StateVector F(const StateVector &x, const ControlVector &u)
State transition function. This internally computes the differential dynamics and applies the chosen ...
virtual Eigen::Tensor< T, 3 > fxu(const StateVector &x, const ControlVector &u)
void set_integrator(Integrator integrator_in)
Sets integrator type.
int num_velocities_
Number of velocities in the dynamic system.
@ RK2
Explicit trapezoid rule.
exotica_core
Author(s): Yiming Yang, Michael Camilleri
autogenerated on Fri Aug 2 2024 08:43:02