bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
robot_env.h
Go to the documentation of this file.
1#ifndef ROBOT_ENV_H
2#define ROBOT_ENV_H
3
4#include "bitrl/bitrl_types.h"
9
10#include <chrono/physics/ChSystemNSC.h>
11
12#include "robot.h"
13
14#include <unordered_map>
15#include <any>
16#include <string>
17
18namespace example_13
19{
20
21using namespace bitrl;
22
25
27using bitrl::TimeStep;
28
31
32class RobotEnv final: public bitrl::envs::EnvBase<time_step_type, space_type>
33{
34public:
35
37
38 RobotEnv()=default;
39
40 virtual void make(const std::string &version,
41 const std::unordered_map<std::string, std::any> &make_options,
42 const std::unordered_map<std::string, std::any> &reset_options) override;
43
44 virtual void close()override{}
45 virtual time_step_type reset()override;
46 virtual time_step_type step(const action_type &/*action*/)override;
47 void simulate();
48
49private:
50
51 Robot robot_;
52 chrono::ChSystemNSC sys_;
53 uint_t sim_counter_{0};
54 real_t current_time_{0.0};
55 void build_system_(std::shared_ptr<chrono::ChContactMaterialNSC> material);
56
57};
58
59
60}
61
62#endif //ROBOT_ENV_H
Forward declaration.
Definition time_step.h:22
Base class interface for Reinforcement Learning environments.
Definition env_base.h:30
const std::unordered_map< std::string, std::any > & reset_options() const noexcept
Access the configuration options provided to make().
Definition env_base.h:104
time_step_type time_step_type
Alias for the type returned when stepping the environment.
Definition env_base.h:41
const std::unordered_map< std::string, std::any > & make_options() const noexcept
Access the configuration options provided to make().
Definition env_base.h:95
std::string version() const noexcept
Get the environment version set during make().
Definition env_base.h:142
Definition robot_env.h:33
virtual void close() override
Close and release any acquired environment resources.
Definition robot_env.h:44
space_type::action_type action_type
Definition robot_env.h:36
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
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.
Definition robot.h:29
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
TimeStepTp
The TimeStepTp enum.
Definition time_step_type.h:16
Definition robot.h:13
constexpr uint_t STATE_SPACE_SIZE
Definition robot_env.h:23
constexpr uint_t ACTION_SPACE_SIZE
Definition robot_env.h:24
TimeStep< chrono::ChVector3d > time_step_type
Definition robot_env.h:29
bitrl::envs::ContinuousVectorStateContinuousVectorActionEnv< STATE_SPACE_SIZE, STATE_SPACE_SIZE > space_type
Definition robot_env.h:30
action_space::space_item_type action_type
The type of action.
Definition env_types.h:135