Updated README for simple env

This commit is contained in:
hzyjerry 2017-10-13 14:25:58 -07:00
parent 99afb69ee6
commit 522c86c912
3 changed files with 35 additions and 11 deletions

View File

@ -1,27 +1,51 @@
## Real Universe Environment
This folder has the source code for environment bundle, which includes viewer renderer, multichannel renderer and physics simulation engine
This folder has the source code for environment bundle, which includes view renderer, multichannel renderer and physics simulation engine
### Requirement
You need CUDA 8.0 in order to run the environment.
### Run everything at once
Open three different shells, and follow the sequence
### Run everything in a bundle
Current trainin environment in implemented in `simple_env.py`. It is a dead simple room exploration game with negative delta distance as reward. It's default to ru with model `11HB6XZSh1Q`. We provide a sample agent `random_husky.py` to interact with this environment. To start, run the following command
```shell
source activate (py2_universe_env)
python random_husky.py
```
You can switch between agent/human mode by setting `human=True/False` when initializing environment object. You can also set `debug=True/False` to run with or without graphical interface.
### Components
The above environment has three components: view renderer, multichannel renderer and physics simulation engine. A built-in add on is a scoreboard implemented with matplotlib.
#### Test each component individually
Multichannel renderer currently only supports depth rendering. In the future we will provide surface normal, semantics and arbitrary meta information.
```shell
## Shell One
cd {realenv_root}/realenv/envs/depth/depth_render
./depth_render --datapath ../data -m 11HB6XZSh1Q
cd depth/depth_render
./depth_render --datapath ../../data -m 11HB6XZSh1Q
```
View renderer.
```shell
## Shell Two
cd {realenv_root}/realenv/envs/render
cd render
source activate (py2_universe_env)
python show_3d2.py --datapath ../data/ --idx 10
```
Physics engine
```shell
## Shell Three
cd {realenv_root}/realenv/envs/physics
cd physics
source activate (py2_universe_env)
python render_physics.py --datapath ../data --model 11HB6XZSh1Q
```
If you want to test out how they work together in a combined way, you don't have to open up three separate terminals. Run
```shell
source acitvate (py2_universe_env)
python simple_env.py
```
You should see OpenCV windows, as well as pybullet panel pop up.
To control the object, click on pybullet panel, then use the following keys. Pybullet sends its movement to

View File

@ -18,8 +18,8 @@ from multiprocessing.dummy import Process
class SimpleEnv(gym.Env):
metadata = {'render.modes': ['human']}
def __init__(self, human=False):
self.debug_mode = True
def __init__(self, human=False, debug=True):
self.debug_mode = debug
file_dir = os.path.dirname(__file__)
cmd_channel = "bash run_depth_render.sh"
@ -115,7 +115,7 @@ class SimpleEnv(gym.Env):
#reward = random.randrange(-8, 20)
with Profiler("Reward func"):
reward = self.reward_func(self.state_old, state)
#self.r_displayer.add_reward(reward)
self.r_displayer.add_reward(reward)
self.state_old = state
#with Profiler("Display reward"):

View File

@ -31,7 +31,7 @@ class RandomAgent(object):
if __name__ == '__main__':
action_space = generate_actions()
agent = RandomAgent(action_space)
env = SimpleEnv(human=False)
env = SimpleEnv(human=False, debug=True)
ob = None
i = 0