bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
quadcopter_sim_env.h
Go to the documentation of this file.
1/*
2 * Quadcopter simulation environment
3 * from
4 * <a href="https://github.com/utiasDSL/gym-pybullet-drones/tree/main">gym-pybullet-drones</a>
5 *
6 *
7 *
8 *
9 */
10
11#ifndef QUADCOPTER_SIM_ENV_H
12#define QUADCOPTER_SIM_ENV_H
13
14#include "rlenvs/envs/env_base.h"
15#include "rlenvs/extern/HTTPRequest.hpp"
16#include "rlenvs/rlenvs_types_v2.h"
17#include "rlenvs/time_step.h"
18
19#include <boost/noncopyable.hpp>
20
21#include <any>
22#include <string>
23#include <unordered_map>
24
25namespace rlenvscpp
26{
27namespace envs
28{
29namespace gym_pybullet_drones
30{
31
32class QuadcopterSimEnv : public EnvBase<TimeStep<std::vector<real_t>>, std::vector<real_t>>
33{
34 public:
35 typedef typename EnvBase<TimeStep<std::vector<real_t>>, std::vector<real_t>>::time_step_type
37 typedef typename EnvBase<TimeStep<std::vector<real_t>>, std::vector<real_t>>::action_type
39
44 QuadcopterSimEnv(const std::string &url, const std::string &name);
45
50 virtual void make(const std::string &version,
51 const std::unordered_map<std::string, std::any> &options) override final;
52
58 virtual time_step_type step(const action_type &action) override final;
59
63 virtual void close() override final;
64
68 virtual time_step_type
69 reset(uint_t seed, const std::unordered_map<std::string, std::any> &options) override final;
70
74 bool is_alive() const noexcept;
75
76 private:
77 time_step_type current_state_;
78
82 time_step_type create_time_step_from_response_(const http::Response &response) const;
83};
84
85inline QuadcopterSimEnv::QuadcopterSimEnv(const std::string &url, const std::string &name)
86 : EnvBase(url + "/gym-pybullet-drones/quadcopter-sim-env", name), current_state_()
87{
88}
89
90} // namespace gym_pybullet_drones
91} // namespace envs
92} // namespace rlenvscpp
93
94#endif // QUADCOPTER_SIM_ENV_H
virtual time_step_type step(const action_type &action) override final
step
Definition quadcopter_sim_env.cpp:49
virtual void make(const std::string &version, const std::unordered_map< std::string, std::any > &options) override final
make. Builds the environment. Optionally we can choose if the environment will be slippery
Definition quadcopter_sim_env.cpp:22
EnvBase< TimeStep< std::vector< real_t > >, std::vector< real_t > >::action_type action_type
Definition quadcopter_sim_env.h:38
bool is_alive() const noexcept
Query the environment server is the environment has been created.
Definition quadcopter_sim_env.cpp:108
virtual time_step_type reset(uint_t seed, const std::unordered_map< std::string, std::any > &options) override final
Reset the environment.
Definition quadcopter_sim_env.cpp:79
EnvBase< TimeStep< std::vector< real_t > >, std::vector< real_t > >::time_step_type time_step_type
Definition quadcopter_sim_env.h:36
virtual void close() override final
close the environment
Definition quadcopter_sim_env.cpp:124
Definition quadcopter_sim_env.cpp:16