bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitsim::dynamics::BicycleVehicleModelDynamics Class Reference

The BicycleVehicleModelDynamics class. Implements the bicycle vehicle model dynamics. The implementation of the dynamics is taken from the paper: Deep Reinforcement Learning for Mobile Robot Path Planning by Hao Liu, Yi Shen, Shuangjiang Yu, Zijun Gao, Tong Wu The state of the model is described by the tuple (X, Y, Phi) where (X,Y) denotes the 2D position of the vehicle in the world coordinates and phi denotes the heading of the vehicle. More...

#include <bicycle_vehicle_model_dynamics.h>

Inheritance diagram for bitsim::dynamics::BicycleVehicleModelDynamics:
Collaboration diagram for bitsim::dynamics::BicycleVehicleModelDynamics:

Public Types

using base_type
using state_type = base_type::state_type
using input_type = base_type::input_type
using matrix_descriptor_type = base_type::matrix_descriptor_type
using matrix_type = typename matrix_descriptor_type::matrix_type
using vector_type = typename matrix_descriptor_type::vector_type
Public Types inherited from bitsim::dynamics::MotionModelDynamicsBase< SysState< 3 >, DynamicsMatrixDescriptor, std::map< std::string, std::any > >
using state_type
using output_type
using input_type
using matrix_descriptor_type
using matrix_type
using vector_type

Public Member Functions

 BicycleVehicleModelDynamics (const BicycleVehicleModelDynamicsConfig config, SysState< 3 > &init_state)
 Constructor.
void integrate (const input_type &input)
 Move the state by one step of config.dt with the inputs "v", the speed [m/s], "delta", the steering angle of the front wheel [rad], and "errors", the errors added to both, an std::array<real_t, 2>: x += v cos(theta) dt, y += v sin(theta) dt, theta += v tan(delta) dt / L. If matrix updates are allowed, F and L are first set to the Jacobians of the step with respect to the state and to the errors.
state_type & evaluate (const input_type &input)
 evaluate
void initialize_matrices (const input_type &input)
 initialize_matrices. Initialize the matrix description of the dynamics
void update_matrices (const input_type &input)
 update_matrices. Update the matrix description of the dynamics
void load_from_json (const std::string &filename)
 load_from_json Load the description of the chassis from the given json file
Public Member Functions inherited from bitsim::dynamics::MotionModelDynamicsBase< SysState< 3 >, DynamicsMatrixDescriptor, std::map< std::string, std::any > >
virtual ~MotionModelDynamicsBase ()=default
 Destructor.
const state_type & get_state () const
 Read access to the state.
state_type & get_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_type & get_matrix (const std::string &name)
const matrix_type & get_matrix (const std::string &name) const
void set_matrix (const std::string &name, const matrix_type &mat)
vector_type & get_vector (const std::string &name)
const vector_type & get_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()

Additional Inherited Members

Static Public Attributes inherited from bitsim::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 bitsim::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 bitsim::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

The BicycleVehicleModelDynamics class. Implements the bicycle vehicle model dynamics. The implementation of the dynamics is taken from the paper: Deep Reinforcement Learning for Mobile Robot Path Planning by Hao Liu, Yi Shen, Shuangjiang Yu, Zijun Gao, Tong Wu The state of the model is described by the tuple (X, Y, Phi) where (X,Y) denotes the 2D position of the vehicle in the world coordinates and phi denotes the heading of the vehicle.

Member Typedef Documentation

◆ base_type

Initial value:
std::map<std::string, std::any>>
The DynamicsMatrixDescriptor class. Helper class to model the matrix representon of dynamical systems...
Definition dynamics_matrix_descriptor.h:19

◆ input_type

◆ matrix_descriptor_type

◆ matrix_type

◆ state_type

◆ vector_type

Constructor & Destructor Documentation

◆ BicycleVehicleModelDynamics()

bitsim::dynamics::BicycleVehicleModelDynamics::BicycleVehicleModelDynamics ( const BicycleVehicleModelDynamicsConfig config,
SysState< 3 > & init_state )

Constructor.

Member Function Documentation

◆ evaluate()

BicycleVehicleModelDynamics::state_type & bitsim::dynamics::BicycleVehicleModelDynamics::evaluate ( const input_type & input)
virtual

◆ initialize_matrices()

void bitsim::dynamics::BicycleVehicleModelDynamics::initialize_matrices ( const input_type & input)

initialize_matrices. Initialize the matrix description of the dynamics

◆ integrate()

void bitsim::dynamics::BicycleVehicleModelDynamics::integrate ( const input_type & input)

Move the state by one step of config.dt with the inputs "v", the speed [m/s], "delta", the steering angle of the front wheel [rad], and "errors", the errors added to both, an std::array<real_t, 2>: x += v cos(theta) dt, y += v sin(theta) dt, theta += v tan(delta) dt / L. If matrix updates are allowed, F and L are first set to the Jacobians of the step with respect to the state and to the errors.

◆ load_from_json()

void bitsim::dynamics::BicycleVehicleModelDynamics::load_from_json ( const std::string & filename)
inline

load_from_json Load the description of the chassis from the given json file

◆ update_matrices()

void bitsim::dynamics::BicycleVehicleModelDynamics::update_matrices ( const input_type & input)

update_matrices. Update the matrix description of the dynamics


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