1#ifndef MOTION_MODEL_BASE_H
2#define MOTION_MODEL_BASE_H
7#include "boost/noncopyable.hpp"
22template <
typename StateTp,
typename MatrixDescriptor,
typename InputTp>
30 typedef typename matrix_descriptor_type::matrix_type
matrix_type;
31 typedef typename matrix_descriptor_type::vector_type
vector_type;
121 state_.set(i, {name, val});
161 bool update_description_matrices_on_evaluate =
true);
192template <
typename StateTp,
typename MatrixDescriptor,
typename InputTp>
194 bool update_description_matrices_on_evaluate)
195 : state_(), matrix_description_(),
196 update_description_matrices_on_evaluate_(update_description_matrices_on_evaluate), dt_(0.0),
197 tol_(
bitrl::consts::TOLERANCE)
201template <
typename StateTp,
typename MatrixDescriptor,
typename InputTp>
205 bool update_description_matrices_on_evaluate)
206 : state_(init_state), matrix_description_(),
207 update_description_matrices_on_evaluate_(update_description_matrices_on_evaluate), dt_(0.0),
208 tol_(
bitrl::consts::TOLERANCE)
Base class for deriving motion models. Motion models describe the dynamics or kinematics of a rigid b...
Definition motion_model_base.h:24
void set_matrix_update_flag(bool f)
set the matrix update flag
Definition motion_model_base.h:94
StateTp state_type
Definition motion_model_base.h:26
InputTp input_type
Definition motion_model_base.h:28
matrix_descriptor_type::matrix_type matrix_type
Definition motion_model_base.h:30
void set_matrix(const std::string &name, const matrix_type &mat)
Definition motion_model_base.h:73
matrix_descriptor_type::vector_type vector_type
Definition motion_model_base.h:31
void set_state_name_value(uint_t i, const std::pair< std::string, real_t > &val)
Set the state names.
Definition motion_model_base.h:127
virtual ~MotionModelDynamicsBase()=default
Destructor.
MotionModelDynamicsBase(bool update_description_matrices_on_evaluate=true)
Constructor.
Definition motion_model_base.h:193
const state_type & get_state() const
Read access to the state.
Definition motion_model_base.h:52
matrix_type & get_matrix(const std::string &name)
Definition motion_model_base.h:65
void set_tolerance(real_t tol)
set_tolerance Set the general tolerance used in the calculations. Default is KernelConsts::tolerance(...
Definition motion_model_base.h:153
const vector_type & get_vector(const std::string &name) const
Definition motion_model_base.h:82
state_type output_type
Definition motion_model_base.h:27
static const uint_t state_dimension
The dimension of the state.
Definition motion_model_base.h:36
MatrixDescriptor matrix_descriptor_type
Definition motion_model_base.h:29
real_t get_time_step() const
get_time_step Returns the sampling time the dynamics model is using
Definition motion_model_base.h:141
void set_state_name_value(uint_t i, const std::string &name, real_t val)
Set the state names.
Definition motion_model_base.h:119
void set_vector(const std::string &name, const vector_type &vec)
Definition motion_model_base.h:86
vector_type & get_vector(const std::string &name)
Definition motion_model_base.h:78
real_t get_tolerance() const
get_tolerance Returns the general tolerance used in the calculations
Definition motion_model_base.h:147
void set_state_property(const std::string &name, real_t value)
Set the name-th value of the state.
Definition motion_model_base.h:116
bool update_description_matrices_on_evaluate_
flag indicating the update of the matrices the model is using to describe itself
Definition motion_model_base.h:179
state_type state_
The object describing the state of the object of which its dynamics are described/modeled by this Mot...
Definition motion_model_base.h:168
void set_time_step(real_t dt)
Set the time step.
Definition motion_model_base.h:135
real_t dt_
The time step the integrator uses.
Definition motion_model_base.h:184
bool has_matrix(const std::string &name) const
Returns true if the matrix with the given name already exists.
Definition motion_model_base.h:106
virtual state_type & evaluate(const input_type &input)=0
Updates and returns the value of the state given the input.
const matrix_type & get_matrix(const std::string &name) const
Definition motion_model_base.h:69
std::vector< std::string_view > get_state_variables_names() const
get_state_variables_names. Returns the name of the variables in the state
Definition motion_model_base.h:63
MotionModelDynamicsBase(const state_type &init_state, bool update_description_matrices_on_evaluate=true)
Constructor.
real_t tol_
tolerance
Definition motion_model_base.h:189
matrix_descriptor_type matrix_description_
matrix descriptor
Definition motion_model_base.h:173
state_type & get_state()
Read/write access to the state.
Definition motion_model_base.h:57
bool allows_matrix_updates() const
Set the flag for updating or not the matrices describing the model.
Definition motion_model_base.h:100
real_t get_state_property(const std::string &name) const
Returns the state property with the given name.
Definition motion_model_base.h:111
Definition bitrl_consts.h:14
double real_t
real_t
Definition bitrl_types.h:23
std::size_t uint_t
uint_t
Definition bitrl_types.h:43