bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
bitrl::dynamics::DiffDriveDynamics Class Reference

DiffDriveDynamics class. Describes the motion dynamics of a differential drive system. It implements the following equations. More...

#include <diff_drive_dynamics.h>

Inheritance diagram for bitrl::dynamics::DiffDriveDynamics:
Collaboration diagram for bitrl::dynamics::DiffDriveDynamics:

Public Types

enum class  DynamicVersion { V1 , V2 , V3 }
 The DynamicVersion enum. Helper enum to disambiguate the two supplied configurations. More...
 
typedef MotionModelDynamicsBase< SysState< 3 >, DynamicsMatrixDescriptor, std::map< std::string, std::any > >::state_type state_type
 The type of the state handled by this dynamics object.
 
typedef MotionModelDynamicsBase< SysState< 3 >, DynamicsMatrixDescriptor, std::map< std::string, std::any > >::input_type input_type
 input_t The type of the input for solving the dynamics
 
typedef MotionModelDynamicsBase< SysState< 3 >, DynamicsMatrixDescriptor, std::map< std::string, std::any > >::matrix_type matrix_type
 matrix_t Matrix type that describes the dynamics
 
typedef MotionModelDynamicsBase< SysState< 3 >, DynamicsMatrixDescriptor, std::map< std::string, std::any > >::vector_type vector_type
 vector_t
 
- Public Types inherited from bitrl::dynamics::MotionModelDynamicsBase< SysState< 3 >, DynamicsMatrixDescriptor, std::map< std::string, std::any > >
typedef SysState< 3 > state_type
 
typedef state_type output_type
 
typedef std::map< std::string, std::any > input_type
 
typedef DynamicsMatrixDescriptor matrix_descriptor_type
 
typedef matrix_descriptor_type::matrix_type matrix_type
 
typedef matrix_descriptor_type::vector_type vector_type
 

Public Member Functions

 DiffDriveDynamics (DynamicVersion type=DynamicVersion::V1, bool update_description_matrices_on_evaluate=true)
 Constructor.
 
 DiffDriveDynamics (state_type &&state)
 Constructor.
 
virtual state_typeevaluate (const input_type &input) override
 Evaluate the new state using the given input it also updates the various matrices if needed.
 
void integrate (const input_type &input)
 Integrate the new state. It also uses error terms.
 
real_t get_x_position () const
 Read the x-coordinate.
 
void set_x_position (real_t x)
 Set the x-coordinate.
 
real_t get_y_position () const
 Read the y-coordinate.
 
void set_y_position (real_t y)
 Set the y-coordinate.
 
real_t get_orientation () const
 Read the y-coordinate.
 
void set_orientation (real_t theta)
 Set the orientation.
 
real_t get_velocity () const
 get_velocity Returns the velocity used for integration
 
real_t get_angular_velocity () const
 get_velocity Returns the angular velocity used for integration
 
void update_matrices (const input_type &input)
 updates the matrices used to describe this motion model
 
void initialize_matrices (const input_type &input)
 Initialize the matrices describing the the dynamics.
 
- Public Member Functions inherited from bitrl::dynamics::MotionModelDynamicsBase< SysState< 3 >, DynamicsMatrixDescriptor, std::map< std::string, std::any > >
virtual ~MotionModelDynamicsBase ()=default
 Destructor.
 
virtual state_typeevaluate (const input_type &input)=0
 Updates and returns the value of the state given the input.
 
const state_typeget_state () const
 Read access to the state.
 
state_typeget_state ()
 Read/write access to the state.
 
std::vector< std::string_view > get_state_variables_names () const
 get_state_variables_names. Returns the name of the variables in the state
 
matrix_typeget_matrix (const std::string &name)
 
const matrix_typeget_matrix (const std::string &name) const
 
void set_matrix (const std::string &name, const matrix_type &mat)
 
vector_typeget_vector (const std::string &name)
 
const vector_typeget_vector (const std::string &name) const
 
void set_vector (const std::string &name, const vector_type &vec)
 
void set_matrix_update_flag (bool f)
 set the matrix update flag
 
bool allows_matrix_updates () const
 Set the flag for updating or not the matrices describing the model.
 
bool has_matrix (const std::string &name) const
 Returns true if the matrix with the given name already exists.
 
real_t get_state_property (const std::string &name) const
 Returns the state property with the given name.
 
void set_state_property (const std::string &name, real_t value)
 Set the name-th value of the state.
 
void set_state_name_value (uint_t i, const std::string &name, real_t val)
 Set the state names.
 
void set_state_name_value (uint_t i, const std::pair< std::string, real_t > &val)
 Set the state names.
 
void set_time_step (real_t dt)
 Set the time step.
 
real_t get_time_step () const
 get_time_step Returns the sampling time the dynamics model is using
 
real_t get_tolerance () const
 get_tolerance Returns the general tolerance used in the calculations
 
void set_tolerance (real_t tol)
 set_tolerance Set the general tolerance used in the calculations. Default is KernelConsts::tolerance()
 

Static Public Member Functions

static SysState< 3 > integrate_state_v1 (const SysState< 3 > &state, real_t tol, real_t dt, real_t v, real_t w, const std::array< real_t, 2 > &errors)
 integrate_state_v1
 
static SysState< 3 > integrate_state_v2 (const SysState< 3 > &state, real_t dt, real_t v, real_t w, const std::array< real_t, 2 > &errors)
 integrate_state_v2
 
static SysState< 3 > integrate_state_v3 (const SysState< 3 > &state, real_t r, real_t l, real_t dt, real_t w1, real_t w2, const std::array< real_t, 2 > &errors)
 integrate_state_v3
 
static SysState< 3 > integrate (const SysState< 3 > &state, const input_type &input, const DynamicVersion version)
 integrate Factory method to apply the different integration methods
 

Additional Inherited Members

- Static Public Attributes inherited from bitrl::dynamics::MotionModelDynamicsBase< SysState< 3 >, DynamicsMatrixDescriptor, std::map< std::string, std::any > >
static const uint_t state_dimension
 The dimension of the state.
 
- Protected Member Functions inherited from bitrl::dynamics::MotionModelDynamicsBase< SysState< 3 >, DynamicsMatrixDescriptor, std::map< std::string, std::any > >
 MotionModelDynamicsBase (bool update_description_matrices_on_evaluate=true)
 Constructor.
 
 MotionModelDynamicsBase (const state_type &init_state, bool update_description_matrices_on_evaluate=true)
 Constructor.
 
- Protected Attributes inherited from bitrl::dynamics::MotionModelDynamicsBase< SysState< 3 >, DynamicsMatrixDescriptor, std::map< std::string, std::any > >
state_type state_
 The object describing the state of the object of which its dynamics are described/modeled by this MotionModel.
 
matrix_descriptor_type matrix_description_
 matrix descriptor
 
bool update_description_matrices_on_evaluate_
 flag indicating the update of the matrices the model is using to describe itself
 
real_t dt_
 The time step the integrator uses.
 
real_t tol_
 tolerance
 

Detailed Description

DiffDriveDynamics class. Describes the motion dynamics of a differential drive system. It implements the following equations.

Member Typedef Documentation

◆ input_type

input_t The type of the input for solving the dynamics

◆ matrix_type

matrix_t Matrix type that describes the dynamics

◆ state_type

The type of the state handled by this dynamics object.

◆ vector_type

vector_t

Member Enumeration Documentation

◆ DynamicVersion

The DynamicVersion enum. Helper enum to disambiguate the two supplied configurations.

Enumerator
V1 
V2 
V3 

Constructor & Destructor Documentation

◆ DiffDriveDynamics() [1/2]

bitrl::dynamics::DiffDriveDynamics::DiffDriveDynamics ( DiffDriveDynamics::DynamicVersion  type = DynamicVersion::V1,
bool  update_description_matrices_on_evaluate = true 
)
explicit

Constructor.

◆ DiffDriveDynamics() [2/2]

bitrl::dynamics::DiffDriveDynamics::DiffDriveDynamics ( DiffDriveDynamics::state_type &&  state)
explicit

Constructor.

Member Function Documentation

◆ evaluate()

DiffDriveDynamics::state_type & bitrl::dynamics::DiffDriveDynamics::evaluate ( const input_type input)
overridevirtual

Evaluate the new state using the given input it also updates the various matrices if needed.

◆ get_angular_velocity()

real_t bitrl::dynamics::DiffDriveDynamics::get_angular_velocity ( ) const
inline

get_velocity Returns the angular velocity used for integration

◆ get_orientation()

real_t bitrl::dynamics::DiffDriveDynamics::get_orientation ( ) const
inline

Read the y-coordinate.

◆ get_velocity()

real_t bitrl::dynamics::DiffDriveDynamics::get_velocity ( ) const
inline

get_velocity Returns the velocity used for integration

◆ get_x_position()

real_t bitrl::dynamics::DiffDriveDynamics::get_x_position ( ) const
inline

Read the x-coordinate.

◆ get_y_position()

real_t bitrl::dynamics::DiffDriveDynamics::get_y_position ( ) const
inline

Read the y-coordinate.

◆ initialize_matrices()

void bitrl::dynamics::DiffDriveDynamics::initialize_matrices ( const input_type input)

Initialize the matrices describing the the dynamics.

◆ integrate() [1/2]

void bitrl::dynamics::DiffDriveDynamics::integrate ( const input_type input)

Integrate the new state. It also uses error terms.

◆ integrate() [2/2]

SysState< 3 > bitrl::dynamics::DiffDriveDynamics::integrate ( const SysState< 3 > &  state,
const input_type input,
const DynamicVersion  version 
)
static

integrate Factory method to apply the different integration methods

◆ integrate_state_v1()

SysState< 3 > bitrl::dynamics::DiffDriveDynamics::integrate_state_v1 ( const SysState< 3 > &  state,
real_t  tol,
real_t  dt,
real_t  v,
real_t  w,
const std::array< real_t, 2 > &  errors 
)
static

integrate_state_v1

assume zero angular velocity

clip the value

◆ integrate_state_v2()

SysState< 3 > bitrl::dynamics::DiffDriveDynamics::integrate_state_v2 ( const SysState< 3 > &  state,
real_t  dt,
real_t  v,
real_t  w,
const std::array< real_t, 2 > &  errors 
)
static

integrate_state_v2

◆ integrate_state_v3()

SysState< 3 > bitrl::dynamics::DiffDriveDynamics::integrate_state_v3 ( const SysState< 3 > &  state,
real_t  r,
real_t  l,
real_t  dt,
real_t  w1,
real_t  w2,
const std::array< real_t, 2 > &  errors 
)
static

integrate_state_v3

◆ set_orientation()

void bitrl::dynamics::DiffDriveDynamics::set_orientation ( real_t  theta)
inline

Set the orientation.

◆ set_x_position()

void bitrl::dynamics::DiffDriveDynamics::set_x_position ( real_t  x)
inline

Set the x-coordinate.

◆ set_y_position()

void bitrl::dynamics::DiffDriveDynamics::set_y_position ( real_t  y)
inline

Set the y-coordinate.

◆ update_matrices()

void bitrl::dynamics::DiffDriveDynamics::update_matrices ( const input_type input)

updates the matrices used to describe this motion model


The documentation for this class was generated from the following files: