1#ifndef BITSIM_DYNAMICS_MOTION_MODEL_BASE_H
2#define BITSIM_DYNAMICS_MOTION_MODEL_BASE_H
7#include "boost/noncopyable.hpp"
25template <
typename StateTp,
typename MatrixDescriptor,
typename InputTp>
124 state_.set(i, {name, val});
164 bool update_description_matrices_on_evaluate =
true);
195template <
typename StateTp,
typename MatrixDescriptor,
typename InputTp>
197 bool update_description_matrices_on_evaluate)
204template <
typename StateTp,
typename MatrixDescriptor,
typename InputTp>
208 bool update_description_matrices_on_evaluate)
209 : state_(init_state), matrix_description_(),
210 update_description_matrices_on_evaluate_(update_description_matrices_on_evaluate), dt_(0.0),
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
DynVec< real_t > vector_type
Definition dynamics_matrix_descriptor.h:23
DynMat< real_t > matrix_type
Definition dynamics_matrix_descriptor.h:22
real_t get_time_step() const
get_time_step Returns the sampling time the dynamics model is using
Definition motion_model_base.h:144
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:66
state_type & get_state()
Read/write access to the state.
Definition motion_model_base.h:60
bool update_description_matrices_on_evaluate_
Definition motion_model_base.h:182
const state_type & get_state() const
Read access to the state.
Definition motion_model_base.h:55
const vector_type & get_vector(const std::string &name) const
Definition motion_model_base.h:85
state_type output_type
Definition motion_model_base.h:30
bool allows_matrix_updates() const
Set the flag for updating or not the matrices describing the model.
Definition motion_model_base.h:103
matrix_type & get_matrix(const std::string &name)
Definition motion_model_base.h:68
MotionModelDynamicsBase(const state_type &init_state, bool update_description_matrices_on_evaluate=true)
Constructor.
real_t get_tolerance() const
get_tolerance Returns the general tolerance used in the calculations
Definition motion_model_base.h:150
virtual ~MotionModelDynamicsBase()=default
Destructor.
real_t dt_
Definition motion_model_base.h:187
state_type state_
Definition motion_model_base.h:171
MotionModelDynamicsBase(bool update_description_matrices_on_evaluate=true)
Constructor.
Definition motion_model_base.h:196
std::map< std::string, std::any > input_type
Definition motion_model_base.h:31
virtual state_type & evaluate(const input_type &input)=0
Updates and returns the value of the state given the input.
matrix_descriptor_type matrix_description_
Definition motion_model_base.h:176
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:130
void set_state_name_value(uint_t i, const std::string &name, real_t val)
Set the state names.
Definition motion_model_base.h:122
void set_matrix(const std::string &name, const matrix_type &mat)
Definition motion_model_base.h:76
static const uint_t state_dimension
Definition motion_model_base.h:39
real_t get_state_property(const std::string &name) const
Returns the state property with the given name.
Definition motion_model_base.h:114
DynamicsMatrixDescriptor matrix_descriptor_type
Definition motion_model_base.h:32
void set_vector(const std::string &name, const vector_type &vec)
Definition motion_model_base.h:89
void set_time_step(real_t dt)
Set the time step.
Definition motion_model_base.h:138
real_t tol_
Definition motion_model_base.h:192
const matrix_type & get_matrix(const std::string &name) const
Definition motion_model_base.h:72
void set_matrix_update_flag(bool f)
set the matrix update flag
Definition motion_model_base.h:97
SysState< 3 > state_type
Definition motion_model_base.h:29
typename matrix_descriptor_type::vector_type vector_type
Definition motion_model_base.h:34
bool has_matrix(const std::string &name) const
Returns true if the matrix with the given name already exists.
Definition motion_model_base.h:109
typename matrix_descriptor_type::matrix_type matrix_type
Definition motion_model_base.h:33
vector_type & get_vector(const std::string &name)
Definition motion_model_base.h:81
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:156
void set_state_property(const std::string &name, real_t value)
Set the name-th value of the state.
Definition motion_model_base.h:119
Definition bitsim_consts.cpp:10
Models of how things move: wheeled robots, a bicycle, a quadrotor and a fixed wing aircraft,...
Definition bicycle_vehicle_model_dynamics.cpp:10
Definition dc_motor_backend_base.h:9
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
double real_t
real_t
Definition bitsim_types.h:20