bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
chrono_smc_system::RobotEnv Class Referencefinal

#include <robot_env.h>

Inheritance diagram for chrono_smc_system::RobotEnv:
Collaboration diagram for chrono_smc_system::RobotEnv:

Public Types

typedef space_type::action_type action_type
Public Types inherited from bitrl::envs::EnvBase< time_step_type, space_type >
typedef time_step_type time_step_type
 Alias for the type returned when stepping the environment.
typedef space_type::state_space state_space_type
 Type describing the environment state space.
typedef space_type::state_type state_type
 Type describing an individual state.
typedef space_type::action_space action_space_type
 Type describing the environment action space.
typedef space_type::action_type action_type
 Type representing an individual action.

Public Member Functions

 RobotEnv ()=default
virtual void make (const std::string &version, const std::unordered_map< std::string, std::any > &make_options, const std::unordered_map< std::string, std::any > &reset_options) override
 Construct the environment instance.
virtual void close () override
 Close and release any acquired environment resources.
virtual time_step_type reset () override
 Reset the environment to an initial state using the reset options specified during make.
virtual time_step_type step (const action_type &) override
void simulate ()
Public Member Functions inherited from bitrl::envs::EnvBase< time_step_type, space_type >
virtual ~EnvBase ()=default
 Virtual destructor.
virtual time_step_type step (const action_type &action)=0
 Perform one step in the environment using an action.
const std::unordered_map< std::string, std::any > & make_options () const noexcept
 Access the configuration options provided to make().
const std::unordered_map< std::string, std::any > & reset_options () const noexcept
 Access the configuration options provided to make().
T read_option (const std::string &op_name) const
 Read a specific make() option and cast it to the requested type.
std::string idx () const noexcept
 Get the id identifying this environment within a simulation batch. The id is valid only if make has been called.
bool is_created () const noexcept
 Check if make() has successfully initialized the environment.
std::string env_name () const noexcept
 Get the name of this environment instance.
std::string version () const noexcept
 Get the environment version set during make().
uint_t last_reset_seed () const noexcept
 The seed of the latest reset(), for the environments that take one. The first reset after make() uses the "seed" reset option, or DEFAULT_ENV_SEED, and every reset after it the next seed, so that the episodes start differently and a run is the same every time.

Additional Inherited Members

Static Public Attributes inherited from bitrl::envs::EnvBase< time_step_type, space_type >
static constexpr uint_t DEFAULT_ENV_SEED
 Default seed used in reset() if none provided.
Protected Member Functions inherited from bitrl::envs::EnvBase< time_step_type, space_type >
 EnvBase (const std::string &idx=bitsim::consts::INVALID_STR, const std::string &name=bitsim::consts::INVALID_STR)
 Constructor (protected — for subclassing only).
void set_version_ (const std::string &version) noexcept
 Set internal version string.
void set_idx_ (const std::string &idx) noexcept
 Set the id of the environment.
void set_make_options_ (const std::unordered_map< std::string, std::any > &options) noexcept
 Store options for future access.
void set_reset_options_ (const std::unordered_map< std::string, std::any > &options) noexcept
 Store reset options for future access.
uint_t next_reset_seed_ ()
 The seed for the next reset: the "seed" reset option, or DEFAULT_ENV_SEED, plus the number of resets since make().
void invalidate_is_created_flag_ () noexcept
 Mark environment as not created.
void make_created_ () noexcept
 Mark environment creation as successful.
time_step_type & get_current_time_step_ () noexcept
 Mutable access to the current time step.

Member Typedef Documentation

◆ action_type

Constructor & Destructor Documentation

◆ RobotEnv()

chrono_smc_system::RobotEnv::RobotEnv ( )
default

Member Function Documentation

◆ close()

virtual void chrono_smc_system::RobotEnv::close ( )
inlineoverridevirtual

Close and release any acquired environment resources.

Implements bitrl::envs::EnvBase< time_step_type, space_type >.

◆ make()

void chrono_smc_system::RobotEnv::make ( const std::string & version,
const std::unordered_map< std::string, std::any > & make_options,
const std::unordered_map< std::string, std::any > & reset_options )
overridevirtual

Construct the environment instance.

Parameters
versionVersion string used to control environment variant
make_optionsKey-value configuration options for environment creation.
reset_optionsKey-value configuration how the environment should be reset
Note
Derived classes should use set_version_() and set_make_options_() internally. They may store selected options for later use.

Implements bitrl::envs::EnvBase< time_step_type, space_type >.

◆ reset()

time_step_type chrono_smc_system::RobotEnv::reset ( )
overridevirtual

Reset the environment to an initial state using the reset options specified during make.

Returns
Initial time step after reset

Implements bitrl::envs::EnvBase< time_step_type, space_type >.

◆ simulate()

void chrono_smc_system::RobotEnv::simulate ( )

◆ step()

time_step_type chrono_smc_system::RobotEnv::step ( const action_type & )
overridevirtual

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