bitsim
Model, simulate, estimate and control robots in C++
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
9
10#include <chrono/physics/ChSystemNSC.h>
11
12#include "robot.h"
13
14#include <any>
15#include <string>
16#include <unordered_map>
17
18namespace chrono_smc_system
19{
20
21using namespace bitsim;
22
25
26using bitrl::TimeStep;
28
33
34class RobotEnv final : public bitrl::envs::EnvBase<time_step_type, space_type>
35{
36 public:
38
39 RobotEnv() = default;
40
41 virtual void make(const std::string &version,
42 const std::unordered_map<std::string, std::any> &make_options,
43 const std::unordered_map<std::string, std::any> &reset_options) override;
44
45 virtual void close() override {}
46 virtual time_step_type reset() override;
47 virtual time_step_type step(const action_type & /*action*/) override;
48 void simulate();
49
50 private:
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} // namespace chrono_smc_system
59
60#endif // ROBOT_ENV_H
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
Forward declaration.
Definition time_step.h:22
Base class interface for Reinforcement Learning environments.
Definition env_base.h:31
const std::unordered_map< std::string, std::any > & reset_options() const noexcept
Definition env_base.h:105
const std::unordered_map< std::string, std::any > & make_options() const noexcept
Definition env_base.h:96
std::string version() const noexcept
Definition env_base.h:143
virtual time_step_type step(const action_type &) override
Definition chrono_smc_system.cpp:180
virtual void close() override
Close and release any acquired environment resources.
Definition robot_env.h:45
virtual time_step_type reset() override
Reset the environment to an initial state using the reset options specified during make.
Definition chrono_smc_system.cpp:169
void simulate()
Definition chrono_smc_system.cpp:208
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 chrono_smc_system.cpp:152
space_type::action_type action_type
Definition robot_env.h:37
Definition robot.h:28
TimeStepTp
The TimeStepTp enum.
Definition time_step_type.h:15
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
double real_t
real_t
Definition bitsim_types.h:20
Definition chrono_smc_system.cpp:17
constexpr uint_t STATE_SPACE_SIZE
Definition robot_env.h:23
TimeStep< chrono::ChVector3d > time_step_type
Definition robot_env.h:29
constexpr uint_t ACTION_SPACE_SIZE
Definition robot_env.h:24
bitrl::envs::ContinuousVectorStateContinuousVectorActionEnv< STATE_SPACE_SIZE, STATE_SPACE_SIZE > space_type
Definition robot_env.h:32