├── .dockerignore ├── .gitignore ├── .travis.yml ├── Dockerfile ├── LICENSE.md ├── README.md ├── agent_zoo ├── RoboschoolAnt_v0_2017may.py ├── RoboschoolAnt_v1_2017jul.py ├── RoboschoolAnt_v1_2017jul.weights ├── RoboschoolAtlasForwardWalk_v1_2017jul.py ├── RoboschoolAtlasForwardWalk_v1_2017jul.weights ├── RoboschoolHalfCheetah_v0_2017may.py ├── RoboschoolHalfCheetah_v1_2017jul.py ├── RoboschoolHalfCheetah_v1_2017jul.weights ├── RoboschoolHopper_v0_2017may.py ├── RoboschoolHopper_v1_2017jul.py ├── RoboschoolHopper_v1_2017jul.weights ├── RoboschoolHumanoidFlagrunHarder_v0_2017may.py ├── RoboschoolHumanoidFlagrunHarder_v1_2017jul.jpg ├── RoboschoolHumanoidFlagrunHarder_v1_2017jul.py ├── RoboschoolHumanoidFlagrunHarder_v1_2017jul.weights ├── RoboschoolHumanoidFlagrun_v0_2017may.py ├── RoboschoolHumanoidFlagrun_v1_2017jul.jpg ├── RoboschoolHumanoidFlagrun_v1_2017jul.py ├── RoboschoolHumanoidFlagrun_v1_2017jul.weights ├── RoboschoolHumanoid_v0_2017may.py ├── RoboschoolHumanoid_v1_2017jul.py ├── RoboschoolHumanoid_v1_2017jul.weights ├── RoboschoolInvertedDoublePendulum_v0_2017may.py ├── RoboschoolInvertedPendulumSwingup_v0_2017may.py ├── RoboschoolInvertedPendulum_v0_2017may.py ├── RoboschoolPong_v0_2017may1.py ├── RoboschoolPong_v0_2017may2.py ├── RoboschoolReacher_v0_2017may.py ├── RoboschoolWalker2d_v0_2017may.py ├── RoboschoolWalker2d_v1_2017jul.py ├── RoboschoolWalker2d_v1_2017jul.weights ├── demo_keyboard_humanoid1.py ├── demo_keyboard_humanoid2.py ├── demo_pong.py ├── demo_race1.py └── demo_race2.py ├── build_wheel.sh ├── config.sh ├── deploy.sh ├── docker_build_wheel.sh ├── docker_test_wheel.sh ├── exports.sh ├── install_boost.sh ├── install_bullet.sh ├── osx_build_wheel.sh ├── osx_test_wheel.sh ├── roboschool ├── __init__.py ├── cpp-household │ ├── Makefile │ ├── assets-mesh.cpp │ ├── assets.h │ ├── glsl │ │ ├── NvFoundation.h │ │ ├── common.h │ │ ├── displaytex.frag.glsl │ │ ├── fullscreen_triangle.vert.glsl │ │ ├── hud.vert.glsl │ │ ├── nv_math.h │ │ ├── nv_math.inl │ │ ├── nv_math_glsltypes.h │ │ ├── nv_math_types.h │ │ ├── simple_texturing.frag.glsl │ │ ├── simple_texturing.vert.glsl │ │ ├── ssao_depthlinearize.frag.glsl │ │ ├── ssao_hbao.frag.glsl │ │ └── ssao_hbao_blur.frag.glsl │ ├── household.h │ ├── physics-bullet.cpp │ ├── python-binding.cpp │ ├── random-world-tools.cpp │ ├── render-glwidget.cpp │ ├── render-glwidget.h │ ├── render-hud.cpp │ ├── render-simple-primitives.cpp │ ├── render-simple.cpp │ ├── render-simple.h │ ├── render-ssao.cpp │ ├── roboschool.config │ ├── roboschool.creator │ ├── roboschool.files │ ├── roboschool.includes │ └── test-tool-qt4.cpp ├── gym_atlas.py ├── gym_forward_walker.py ├── gym_humanoid_flagrun.py ├── gym_mujoco_walkers.py ├── gym_mujoco_xml_env.py ├── gym_pendulums.py ├── gym_pong.py ├── gym_pong_trainservers.py ├── gym_reacher.py ├── gym_urdf_robot_env.py ├── models_household │ ├── ball.urdf │ ├── bottle │ │ ├── bottle.urdf │ │ ├── glass_tex.png │ │ ├── glasscontent_tex.jpg │ │ ├── potionbottleglass.mtl │ │ ├── potionbottleglass.obj │ │ ├── potionbottlesolid.mtl │ │ └── potionbottlesolid.obj │ ├── cube.urdf │ ├── dinnerware │ │ ├── dinnerware.mtl │ │ ├── generate.py │ │ ├── pan_tefal-collision01.obj │ │ ├── pan_tefal-collision02.obj │ │ ├── pan_tefal-collision03.obj │ │ ├── pan_tefal-collision04.obj │ │ ├── pan_tefal-collision05.obj │ │ ├── pan_tefal-collision06.obj │ │ ├── pan_tefal.jpg │ │ ├── pan_tefal.obj │ │ ├── pan_tefal.urdf │ │ ├── plate-collision01.obj │ │ ├── plate-collision02.obj │ │ ├── plate-collision03.obj │ │ ├── plate-collision04.obj │ │ ├── plate-collision05.obj │ │ ├── plate-collision06.obj │ │ ├── plate.obj │ │ └── plate.urdf │ ├── duck │ │ ├── duck.dae │ │ └── duckCM.jpg │ ├── joypad │ │ ├── joypad.mtl │ │ ├── joypad.obj │ │ └── joypad_tex.jpg │ ├── keyboard │ │ ├── keyboard.mtl │ │ ├── keyboard.obj │ │ └── keyboard_tex.jpg │ ├── tablelamp │ │ ├── tablelamp-collision00.off │ │ ├── tablelamp-collision01.off │ │ ├── tablelamp-collision02.off │ │ ├── tablelamp.obj │ │ ├── tablelamp.obj.mtl │ │ └── tablelamptex.jpg │ ├── woodenbox │ │ ├── woodenbox-collision00.off │ │ ├── woodenbox-collision01.off │ │ ├── woodenbox-collision02.off │ │ ├── woodenbox-collision03.off │ │ ├── woodenbox-collision04.off │ │ ├── woodenbox-collision05.off │ │ ├── woodenbox-collision06.off │ │ ├── woodenbox-collision07.off │ │ ├── woodenbox-collision08.off │ │ ├── woodenbox-collision09.off │ │ ├── woodenbox-collision10.off │ │ ├── woodenbox.mtl │ │ ├── woodenbox.obj │ │ ├── woodenbox.wrl │ │ └── woodenbox_tex.jpg │ └── zucchini │ │ ├── zucchini.mtl │ │ ├── zucchini.obj │ │ └── zucchini_tex_green.jpg ├── models_outdoor │ └── stadium │ │ ├── pong1.obj │ │ ├── stadium.mtl │ │ ├── stadium1.obj │ │ └── stadium_grass.jpg ├── models_robot │ ├── atlas_description │ │ ├── materials │ │ │ └── textures │ │ │ │ ├── drc_extremities_diffuse.jpg │ │ │ │ ├── extremities_diffuse_unplugged.jpg │ │ │ │ ├── right_leg_diffuse_unplugged.jpg │ │ │ │ └── torso_diffuse_unplugged.jpg │ │ ├── meshes_unplugged │ │ │ ├── l_foot.dae │ │ │ ├── l_lglut.dae │ │ │ ├── l_lleg.dae │ │ │ ├── l_talus.dae │ │ │ ├── l_uglut.dae │ │ │ ├── l_uleg.dae │ │ │ ├── ltorso.dae │ │ │ ├── mtorso.dae │ │ │ ├── pelvis.dae │ │ │ ├── r_clav.dae │ │ │ ├── r_foot.dae │ │ │ ├── r_lglut.dae │ │ │ ├── r_lleg.dae │ │ │ ├── r_scap.dae │ │ │ ├── r_talus.dae │ │ │ ├── r_uarm.dae │ │ │ ├── r_uglut.dae │ │ │ ├── r_uleg.dae │ │ │ └── utorso.dae │ │ ├── meshes_v3 │ │ │ ├── r_farm.dae │ │ │ ├── r_hand.dae │ │ │ └── r_larm.dae │ │ └── urdf │ │ │ └── atlas_v4_with_multisense.urdf │ ├── fetch_description │ │ ├── meshes │ │ │ ├── base_link.dae │ │ │ ├── base_link_collision.STL │ │ │ ├── base_link_uv.png │ │ │ ├── bellows_link.STL │ │ │ ├── bellows_link_collision.STL │ │ │ ├── elbow_flex_link.dae │ │ │ ├── elbow_flex_link_collision.STL │ │ │ ├── elbow_flex_uv.png │ │ │ ├── estop_link.STL │ │ │ ├── forearm_roll_link.dae │ │ │ ├── forearm_roll_link_collision.STL │ │ │ ├── forearm_roll_uv.png │ │ │ ├── gripper_link.STL │ │ │ ├── gripper_link.dae │ │ │ ├── gripper_uv.png │ │ │ ├── head_pan_link.dae │ │ │ ├── head_pan_link_collision.STL │ │ │ ├── head_pan_uv.png │ │ │ ├── head_tilt_link.dae │ │ │ ├── head_tilt_link_collision.STL │ │ │ ├── head_tilt_uv.png │ │ │ ├── l_gripper_finger_link.STL │ │ │ ├── l_wheel_link.STL │ │ │ ├── l_wheel_link_collision.STL │ │ │ ├── laser_link.STL │ │ │ ├── r_gripper_finger_link.STL │ │ │ ├── r_wheel_link.STL │ │ │ ├── r_wheel_link_collision.STL │ │ │ ├── shoulder_lift_link.dae │ │ │ ├── shoulder_lift_link_collision.STL │ │ │ ├── shoulder_lift_uv.png │ │ │ ├── shoulder_pan_link.dae │ │ │ ├── shoulder_pan_link_collision.STL │ │ │ ├── shoulder_pan_uv.png │ │ │ ├── torso_fixed_link.STL │ │ │ ├── torso_fixed_link.dae │ │ │ ├── torso_fixed_uv.png │ │ │ ├── torso_lift_link.dae │ │ │ ├── torso_lift_link_collision.STL │ │ │ ├── torso_lift_uv.png │ │ │ ├── upperarm_roll_link.dae │ │ │ ├── upperarm_roll_link_collision.STL │ │ │ ├── upperarm_roll_uv.png │ │ │ ├── wrist_flex_link.dae │ │ │ ├── wrist_flex_link_collision.STL │ │ │ ├── wrist_flex_uv.png │ │ │ ├── wrist_roll_link.dae │ │ │ ├── wrist_roll_link_collision.STL │ │ │ └── wrist_roll_uv.png │ │ └── robots │ │ │ ├── FETCH_MODIFICATIONS.md │ │ │ └── fetch.urdf │ ├── multisense_sl_description │ │ ├── materials │ │ │ └── textures │ │ │ │ └── drc_torso_head_diffuse.jpg │ │ └── meshes │ │ │ ├── head.dae │ │ │ └── head_camera.dae │ └── roboschool_pong.xml ├── mujoco_assets │ ├── ant.xml │ ├── ground_plane.xml │ ├── half_cheetah.xml │ ├── hopper.xml │ ├── humanoid_symmetric.xml │ ├── inverted_double_pendulum.xml │ ├── inverted_pendulum.xml │ ├── reacher.xml │ └── walker2d.xml ├── multiplayer.py ├── random_stadium.py ├── random_stadium_kernel.pyx ├── scene_abstract.py ├── scene_stadium.py └── test_manual.py ├── roboschool_compile_and_graft.sh ├── setup.py └── test_wheel.sh /.dockerignore: -------------------------------------------------------------------------------- 1 | roboschool.egg-info 2 | ascii_houses/* 3 | roboschool/cpp-household/.generated* 4 | roboschool/cpp-household/.build-debug* 5 | roboschool/cpp-household/.build-release* 6 | roboschool/cpp-household/bullet_local_install 7 | roboschool/cpp-household/roboschool.creator.user 8 | roboschool/cpp-household/Makefile.dep 9 | roboschool/robot-test-tool 10 | roboschool/robot-test-tool_d 11 | *.pyc 12 | *.dylib 13 | *.so 14 | *.swp 15 | __pycache__ 16 | .git 17 | **/*.pyc 18 | **/.git 19 | **/__pycache__ 20 | **/*.o 21 | **/*.so 22 | **/*.dylib 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | roboschool.egg-info 2 | ascii_houses/* 3 | roboschool/cpp-household/.generated* 4 | roboschool/cpp-household/.build-debug* 5 | roboschool/cpp-household/.build-release* 6 | roboschool/cpp-household/roboschool.creator.user 7 | roboschool/cpp-household/Makefile.dep 8 | roboschool/cpp-household/*_local_install 9 | roboschool/robot-test-tool 10 | roboschool/robot-test-tool_d 11 | roboschool/.libs 12 | roboschool/.qt_plugins 13 | *.pyc 14 | *.dylib 15 | *.so 16 | *.swp 17 | __pycache__ 18 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | env: 2 | global: 3 | - REPO_DIR=. 4 | - BUILD_COMMIT=$TRAVIS_COMMIT 5 | - PLAT=x86_64 6 | install: 7 | - "./build_wheel.sh" 8 | script: 9 | - "./test_wheel.sh" 10 | after_success: 11 | - "./deploy.sh" 12 | 13 | matrix: 14 | include: 15 | - os: linux 16 | env: 17 | - MB_PYTHON_VERSION=3.5 18 | 19 | - os: linux 20 | env: 21 | - MB_PYTHON_VERSION=3.6 22 | 23 | - os: linux 24 | env: 25 | - MB_PYTHON_VERSION=3.7 26 | 27 | - os: osx 28 | osx_image: xcode9.3 29 | env: 30 | - MB_PYTHON_VERSION=3.5 31 | 32 | # block deployment of source package - compiling from that would be an extra pain, better use github repo + tags 33 | # - DEPLOY_SDIST=true 34 | 35 | - os: osx 36 | osx_image: xcode9.3 37 | env: 38 | - MB_PYTHON_VERSION=3.6 39 | 40 | - os: osx 41 | osx_image: xcode9.3 42 | env: 43 | - MB_PYTHON_VERSION=3.7 44 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | # get dependencies 3 | RUN apt-get -y update && apt-get -y install python3-dev python3-pip curl \ 4 | apt-utils libgl1-mesa-dev qtbase5-dev \ 5 | libqt5opengl5-dev libassimp-dev patchelf cmake pkg-config git 6 | # set python and pip to point to python3 versions 7 | RUN bash -c "ln -s $(which python3) /usr/bin/python && ln -s $(which pip3) /usr/bin/pip" 8 | COPY . /code 9 | RUN cd /code && \ 10 | bash -c ". ./exports.sh && ./install_boost.sh && ./install_bullet.sh && ./roboschool_compile_and_graft.sh" 11 | 12 | # install pip package and test 13 | RUN pip install -e /code 14 | RUN python -c "import gym; gym.make('roboschool:RoboschoolAnt-v1').reset()" 15 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # Roboschool 2 | 3 | The MIT License 4 | 5 | Copyright (c) 2017 OpenAI (http://openai.com) 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | 25 | 26 | # Mujoco models 27 | 28 | This work is derived from [MuJuCo models](http://www.mujoco.org/forum/index.php?resources/) used under the following license: 29 | 30 | ``` 31 | This file is part of MuJoCo. 32 | Copyright 2009-2015 Roboti LLC. 33 | Mujoco :: Advanced physics simulation engine 34 | Source : www.roboti.us 35 | Version : 1.31 36 | Released : 23Apr16 37 | Author :: Vikash Kumar 38 | Contacts : kumar@roboti.us 39 | ``` 40 | 41 | -------------------------------------------------------------------------------- /agent_zoo/RoboschoolAnt_v1_2017jul.py: -------------------------------------------------------------------------------- 1 | import os.path, gym 2 | import numpy as np 3 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 4 | import tensorflow as tf 5 | import roboschool 6 | 7 | class ZooPolicyTensorflow(object): 8 | def __init__(self, name, ob_space, ac_space, take_weights_here=None): 9 | self.name = name 10 | 11 | with tf.variable_scope(name): 12 | obs_tuple = [ 13 | tf.placeholder(tf.float32, (None, 1), name="obs0"), 14 | tf.placeholder(tf.float32, (None, 28), name="obs1"), 15 | ] 16 | self.obs_tuple = obs_tuple 17 | 18 | actions_input = [] 19 | actions_input.append(obs_tuple[1]) 20 | 21 | x = tf.concat( actions_input, axis=1 ) 22 | dense1_w = tf.get_variable("dense1_w", [28,128]) 23 | dense1_b = tf.get_variable("dense1_b", [128]) 24 | x = tf.matmul(x, dense1_w) + dense1_b 25 | x = tf.nn.relu(x) 26 | dense2_w = tf.get_variable("dense2_w", [128,64]) 27 | dense2_b = tf.get_variable("dense2_b", [64]) 28 | x = tf.matmul(x, dense2_w) + dense2_b 29 | x = tf.nn.relu(x) 30 | final_w = tf.get_variable("final_w", [64,8]) 31 | final_b = tf.get_variable("final_b", [8]) 32 | x = tf.matmul(x, final_w) + final_b 33 | pi = x 34 | self.pi = pi 35 | 36 | if take_weights_here is None: 37 | take_weights_here = {} 38 | exec(open(os.path.splitext(__file__)[0] + ".weights").read(), take_weights_here) 39 | self.assigns = [ 40 | ( dense1_w, take_weights_here["weights_dense1_w"]), 41 | ( dense1_b, take_weights_here["weights_dense1_b"]), 42 | ( dense2_w, take_weights_here["weights_dense2_w"]), 43 | ( dense2_b, take_weights_here["weights_dense2_b"]), 44 | ( final_w, take_weights_here["weights_final_w"]), 45 | ( final_b, take_weights_here["weights_final_b"]), 46 | ] 47 | 48 | self.weight_assignment_placeholders = [] 49 | self.weight_assignment_nodes = [] 50 | for var, w in self.assigns: 51 | ph = tf.placeholder(tf.float32, w.shape) 52 | self.weight_assignment_placeholders.append(ph) 53 | self.weight_assignment_nodes.append( tf.assign(var, ph) ) 54 | 55 | self.load_weights() 56 | 57 | def load_weights(self): 58 | feed_dict = {} 59 | for (var, w), ph in zip(self.assigns, self.weight_assignment_placeholders): 60 | feed_dict[ph] = w 61 | tf.get_default_session().run(self.weight_assignment_nodes, feed_dict=feed_dict) 62 | 63 | def act(self, obs_data, cx): 64 | obs_data = [np.ones((1,)), obs_data] 65 | obs_data = [obs_data[0], obs_data[1]] 66 | # Because we need batch dimension, data[None] changes shape from [A] to [1,A] 67 | a = tf.get_default_session().run(self.pi, feed_dict=dict( (ph,data[None]) for ph,data in zip(self.obs_tuple, obs_data) )) 68 | return a[0] # return first in batch 69 | 70 | 71 | def demo_run(): 72 | config = tf.ConfigProto( 73 | inter_op_parallelism_threads=1, 74 | intra_op_parallelism_threads=1, 75 | device_count = { "GPU": 0 } ) 76 | sess = tf.InteractiveSession(config=config) 77 | 78 | env = gym.make("RoboschoolAnt-v1") 79 | 80 | pi = ZooPolicyTensorflow("mymodel1", env.observation_space, env.action_space) 81 | 82 | while 1: 83 | frame = 0 84 | score = 0 85 | restart_delay = 0 86 | obs = env.reset() 87 | 88 | while 1: 89 | a = pi.act(obs, env) 90 | 91 | obs, r, done, _ = env.step(a) 92 | 93 | score += r 94 | frame += 1 95 | still_open = env.render("human") 96 | if still_open==False: 97 | return 98 | if not done: continue 99 | if restart_delay==0: 100 | print("score=%0.2f in %i frames" % (score, frame)) 101 | if still_open!=True: # not True in multiplayer or non-Roboschool environment 102 | break 103 | restart_delay = 60*2 # 2 sec at 60 fps 104 | restart_delay -= 1 105 | if restart_delay==0: break 106 | 107 | if __name__=="__main__": 108 | demo_run() 109 | -------------------------------------------------------------------------------- /agent_zoo/RoboschoolAtlasForwardWalk_v1_2017jul.py: -------------------------------------------------------------------------------- 1 | import os.path, time, gym 2 | import numpy as np 3 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 4 | import tensorflow as tf 5 | import roboschool 6 | 7 | class ZooPolicyTensorflow(object): 8 | def __init__(self, name, ob_space, ac_space, take_weights_here=None): 9 | self.name = name 10 | 11 | with tf.variable_scope(name): 12 | obs_tuple = [ 13 | tf.placeholder(tf.float32, (None, 1), name="obs0"), 14 | tf.placeholder(tf.float32, (None, 70), name="obs1"), 15 | ] 16 | self.obs_tuple = obs_tuple 17 | 18 | actions_input = [] 19 | actions_input.append(obs_tuple[1]) 20 | 21 | x = tf.concat( actions_input, axis=1 ) 22 | dense1_w = tf.get_variable("dense1_w", [70,128]) 23 | dense1_b = tf.get_variable("dense1_b", [128]) 24 | x = tf.matmul(x, dense1_w) + dense1_b 25 | x = tf.nn.relu(x) 26 | dense2_w = tf.get_variable("dense2_w", [128,64]) 27 | dense2_b = tf.get_variable("dense2_b", [64]) 28 | x = tf.matmul(x, dense2_w) + dense2_b 29 | x = tf.nn.relu(x) 30 | final_w = tf.get_variable("final_w", [64,30]) 31 | final_b = tf.get_variable("final_b", [30]) 32 | x = tf.matmul(x, final_w) + final_b 33 | pi = x 34 | self.pi = pi 35 | 36 | if take_weights_here is None: 37 | take_weights_here = {} 38 | exec(open(os.path.splitext(__file__)[0] + ".weights").read(), take_weights_here) 39 | self.assigns = [ 40 | ( dense1_w, take_weights_here["weights_dense1_w"]), 41 | ( dense1_b, take_weights_here["weights_dense1_b"]), 42 | ( dense2_w, take_weights_here["weights_dense2_w"]), 43 | ( dense2_b, take_weights_here["weights_dense2_b"]), 44 | ( final_w, take_weights_here["weights_final_w"]), 45 | ( final_b, take_weights_here["weights_final_b"]), 46 | ] 47 | 48 | self.weight_assignment_placeholders = [] 49 | self.weight_assignment_nodes = [] 50 | for var, w in self.assigns: 51 | ph = tf.placeholder(tf.float32, w.shape) 52 | self.weight_assignment_placeholders.append(ph) 53 | self.weight_assignment_nodes.append( tf.assign(var, ph) ) 54 | 55 | self.load_weights() 56 | 57 | def load_weights(self): 58 | feed_dict = {} 59 | for (var, w), ph in zip(self.assigns, self.weight_assignment_placeholders): 60 | feed_dict[ph] = w 61 | tf.get_default_session().run(self.weight_assignment_nodes, feed_dict=feed_dict) 62 | 63 | def act(self, obs_data, cx): 64 | obs_data = [np.ones((1,)), obs_data] 65 | obs_data = [obs_data[0], obs_data[1]] 66 | if not hasattr(cx, "skip") or cx.skip==0: 67 | # Because we need batch dimension, data[None] changes shape from [A] to [1,A] 68 | a = tf.get_default_session().run(self.pi, feed_dict=dict( (ph,data[None]) for ph,data in zip(self.obs_tuple, obs_data) )) 69 | cx.skip_prev_action = a 70 | else: 71 | a = cx.skip_prev_action 72 | return a[0] # return first in batch 73 | 74 | 75 | def demo_run(): 76 | config = tf.ConfigProto( 77 | inter_op_parallelism_threads=1, 78 | intra_op_parallelism_threads=1, 79 | device_count = { "GPU": 0 } ) 80 | sess = tf.InteractiveSession(config=config) 81 | 82 | env = gym.make("RoboschoolAtlasForwardWalk-v1") 83 | 84 | pi = ZooPolicyTensorflow("mymodel1", env.observation_space, env.action_space) 85 | 86 | while 1: 87 | frame = 0 88 | score = 0 89 | restart_delay = 0.0 90 | obs = env.reset() 91 | 92 | while 1: 93 | a = pi.act(obs, env) 94 | 95 | obs, r, done, _ = env.step(a) 96 | 97 | score += r 98 | frame += 1 99 | still_open = env.render("human") 100 | if still_open==False: 101 | return 102 | if not done: continue 103 | if restart_delay==0.0: 104 | print("score=%0.2f in %i frames" % (score, frame)) 105 | if still_open!=True: # not True in multiplayer or non-Roboschool environment 106 | break 107 | restart_delay = time.time() + 1.0 108 | if time.time() > restart_delay: 109 | break 110 | 111 | if __name__=="__main__": 112 | demo_run() 113 | -------------------------------------------------------------------------------- /agent_zoo/RoboschoolHalfCheetah_v1_2017jul.py: -------------------------------------------------------------------------------- 1 | import os.path, gym 2 | import numpy as np 3 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 4 | import tensorflow as tf 5 | import roboschool 6 | 7 | class ZooPolicyTensorflow(object): 8 | def __init__(self, name, ob_space, ac_space, take_weights_here=None): 9 | self.name = name 10 | 11 | with tf.variable_scope(name): 12 | obs_tuple = [ 13 | tf.placeholder(tf.float32, (None, 1), name="obs0"), 14 | tf.placeholder(tf.float32, (None, 26), name="obs1"), 15 | ] 16 | self.obs_tuple = obs_tuple 17 | 18 | actions_input = [] 19 | actions_input.append(obs_tuple[1]) 20 | 21 | x = tf.concat( actions_input, axis=1 ) 22 | dense1_w = tf.get_variable("dense1_w", [26,128]) 23 | dense1_b = tf.get_variable("dense1_b", [128]) 24 | x = tf.matmul(x, dense1_w) + dense1_b 25 | x = tf.nn.relu(x) 26 | dense2_w = tf.get_variable("dense2_w", [128,64]) 27 | dense2_b = tf.get_variable("dense2_b", [64]) 28 | x = tf.matmul(x, dense2_w) + dense2_b 29 | x = tf.nn.relu(x) 30 | final_w = tf.get_variable("final_w", [64,6]) 31 | final_b = tf.get_variable("final_b", [6]) 32 | x = tf.matmul(x, final_w) + final_b 33 | pi = x 34 | self.pi = pi 35 | 36 | if take_weights_here is None: 37 | take_weights_here = {} 38 | exec(open(os.path.splitext(__file__)[0] + ".weights").read(), take_weights_here) 39 | self.assigns = [ 40 | ( dense1_w, take_weights_here["weights_dense1_w"]), 41 | ( dense1_b, take_weights_here["weights_dense1_b"]), 42 | ( dense2_w, take_weights_here["weights_dense2_w"]), 43 | ( dense2_b, take_weights_here["weights_dense2_b"]), 44 | ( final_w, take_weights_here["weights_final_w"]), 45 | ( final_b, take_weights_here["weights_final_b"]), 46 | ] 47 | 48 | self.weight_assignment_placeholders = [] 49 | self.weight_assignment_nodes = [] 50 | for var, w in self.assigns: 51 | ph = tf.placeholder(tf.float32, w.shape) 52 | self.weight_assignment_placeholders.append(ph) 53 | self.weight_assignment_nodes.append( tf.assign(var, ph) ) 54 | 55 | self.load_weights() 56 | 57 | def load_weights(self): 58 | feed_dict = {} 59 | for (var, w), ph in zip(self.assigns, self.weight_assignment_placeholders): 60 | feed_dict[ph] = w 61 | tf.get_default_session().run(self.weight_assignment_nodes, feed_dict=feed_dict) 62 | 63 | def act(self, obs_data, cx): 64 | obs_data = [np.ones((1,)), obs_data] 65 | obs_data = [obs_data[0], obs_data[1]] 66 | # Because we need batch dimension, data[None] changes shape from [A] to [1,A] 67 | a = tf.get_default_session().run(self.pi, feed_dict=dict( (ph,data[None]) for ph,data in zip(self.obs_tuple, obs_data) )) 68 | return a[0] # return first in batch 69 | 70 | 71 | def demo_run(): 72 | config = tf.ConfigProto( 73 | inter_op_parallelism_threads=1, 74 | intra_op_parallelism_threads=1, 75 | device_count = { "GPU": 0 } ) 76 | sess = tf.InteractiveSession(config=config) 77 | 78 | env = gym.make("RoboschoolHalfCheetah-v1") 79 | 80 | pi = ZooPolicyTensorflow("mymodel1", env.observation_space, env.action_space) 81 | 82 | while 1: 83 | frame = 0 84 | score = 0 85 | restart_delay = 0 86 | obs = env.reset() 87 | 88 | while 1: 89 | a = pi.act(obs, env) 90 | 91 | obs, r, done, _ = env.step(a) 92 | 93 | score += r 94 | frame += 1 95 | still_open = env.render("human") 96 | if still_open==False: 97 | return 98 | if not done: continue 99 | if restart_delay==0: 100 | print("score=%0.2f in %i frames" % (score, frame)) 101 | if still_open!=True: # not True in multiplayer or non-Roboschool environment 102 | break 103 | restart_delay = 60*2 # 2 sec at 60 fps 104 | restart_delay -= 1 105 | if restart_delay==0: break 106 | 107 | if __name__=="__main__": 108 | demo_run() 109 | -------------------------------------------------------------------------------- /agent_zoo/RoboschoolHopper_v1_2017jul.py: -------------------------------------------------------------------------------- 1 | import os.path, gym 2 | import numpy as np 3 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 4 | import tensorflow as tf 5 | import roboschool 6 | 7 | class ZooPolicyTensorflow(object): 8 | def __init__(self, name, ob_space, ac_space, take_weights_here=None): 9 | self.name = name 10 | 11 | with tf.variable_scope(name): 12 | obs_tuple = [ 13 | tf.placeholder(tf.float32, (None, 1), name="obs0"), 14 | tf.placeholder(tf.float32, (None, 15), name="obs1"), 15 | ] 16 | self.obs_tuple = obs_tuple 17 | 18 | actions_input = [] 19 | actions_input.append(obs_tuple[1]) 20 | 21 | x = tf.concat( actions_input, axis=1 ) 22 | dense1_w = tf.get_variable("dense1_w", [15,128]) 23 | dense1_b = tf.get_variable("dense1_b", [128]) 24 | x = tf.matmul(x, dense1_w) + dense1_b 25 | x = tf.nn.relu(x) 26 | dense2_w = tf.get_variable("dense2_w", [128,64]) 27 | dense2_b = tf.get_variable("dense2_b", [64]) 28 | x = tf.matmul(x, dense2_w) + dense2_b 29 | x = tf.nn.relu(x) 30 | final_w = tf.get_variable("final_w", [64,3]) 31 | final_b = tf.get_variable("final_b", [3]) 32 | x = tf.matmul(x, final_w) + final_b 33 | pi = x 34 | self.pi = pi 35 | 36 | if take_weights_here is None: 37 | take_weights_here = {} 38 | exec(open(os.path.splitext(__file__)[0] + ".weights").read(), take_weights_here) 39 | self.assigns = [ 40 | ( dense1_w, take_weights_here["weights_dense1_w"]), 41 | ( dense1_b, take_weights_here["weights_dense1_b"]), 42 | ( dense2_w, take_weights_here["weights_dense2_w"]), 43 | ( dense2_b, take_weights_here["weights_dense2_b"]), 44 | ( final_w, take_weights_here["weights_final_w"]), 45 | ( final_b, take_weights_here["weights_final_b"]), 46 | ] 47 | 48 | self.weight_assignment_placeholders = [] 49 | self.weight_assignment_nodes = [] 50 | for var, w in self.assigns: 51 | ph = tf.placeholder(tf.float32, w.shape) 52 | self.weight_assignment_placeholders.append(ph) 53 | self.weight_assignment_nodes.append( tf.assign(var, ph) ) 54 | 55 | self.load_weights() 56 | 57 | def load_weights(self): 58 | feed_dict = {} 59 | for (var, w), ph in zip(self.assigns, self.weight_assignment_placeholders): 60 | feed_dict[ph] = w 61 | tf.get_default_session().run(self.weight_assignment_nodes, feed_dict=feed_dict) 62 | 63 | def act(self, obs_data, cx): 64 | obs_data = [np.ones((1,)), obs_data] 65 | obs_data = [obs_data[0], obs_data[1]] 66 | # Because we need batch dimension, data[None] changes shape from [A] to [1,A] 67 | a = tf.get_default_session().run(self.pi, feed_dict=dict( (ph,data[None]) for ph,data in zip(self.obs_tuple, obs_data) )) 68 | return a[0] # return first in batch 69 | 70 | 71 | def demo_run(): 72 | config = tf.ConfigProto( 73 | inter_op_parallelism_threads=1, 74 | intra_op_parallelism_threads=1, 75 | device_count = { "GPU": 0 } ) 76 | sess = tf.InteractiveSession(config=config) 77 | 78 | env = gym.make("RoboschoolHopper-v1") 79 | 80 | pi = ZooPolicyTensorflow("mymodel1", env.observation_space, env.action_space) 81 | 82 | while 1: 83 | frame = 0 84 | score = 0 85 | restart_delay = 0 86 | obs = env.reset() 87 | 88 | while 1: 89 | a = pi.act(obs, env) 90 | 91 | obs, r, done, _ = env.step(a) 92 | 93 | score += r 94 | frame += 1 95 | still_open = env.render("human") 96 | if still_open==False: 97 | return 98 | if not done: continue 99 | if restart_delay==0: 100 | print("score=%0.2f in %i frames" % (score, frame)) 101 | if still_open!=True: # not True in multiplayer or non-Roboschool environment 102 | break 103 | restart_delay = 60*2 # 2 sec at 60 fps 104 | restart_delay -= 1 105 | if restart_delay==0: break 106 | 107 | if __name__=="__main__": 108 | demo_run() 109 | -------------------------------------------------------------------------------- /agent_zoo/RoboschoolHumanoidFlagrunHarder_v1_2017jul.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/agent_zoo/RoboschoolHumanoidFlagrunHarder_v1_2017jul.jpg -------------------------------------------------------------------------------- /agent_zoo/RoboschoolHumanoidFlagrunHarder_v1_2017jul.py: -------------------------------------------------------------------------------- 1 | import os.path, gym 2 | import numpy as np 3 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 4 | import tensorflow as tf 5 | import roboschool 6 | 7 | class ZooPolicyTensorflow(object): 8 | def __init__(self, name, ob_space, ac_space, take_weights_here=None): 9 | self.name = name 10 | 11 | with tf.variable_scope(name): 12 | obs_tuple = [ 13 | tf.placeholder(tf.float32, (None, 1), name="obs0"), 14 | tf.placeholder(tf.float32, (None, 44), name="obs1"), 15 | ] 16 | self.obs_tuple = obs_tuple 17 | 18 | actions_input = [] 19 | actions_input.append(obs_tuple[1]) 20 | 21 | x = tf.concat( actions_input, axis=1 ) 22 | dense1_w = tf.get_variable("dense1_w", [44,256]) 23 | dense1_b = tf.get_variable("dense1_b", [256]) 24 | x = tf.matmul(x, dense1_w) + dense1_b 25 | x = tf.nn.relu(x) 26 | dense2_w = tf.get_variable("dense2_w", [256,128]) 27 | dense2_b = tf.get_variable("dense2_b", [128]) 28 | x = tf.matmul(x, dense2_w) + dense2_b 29 | x = tf.nn.relu(x) 30 | final_w = tf.get_variable("final_w", [128,17]) 31 | final_b = tf.get_variable("final_b", [17]) 32 | x = tf.matmul(x, final_w) + final_b 33 | pi = x 34 | self.pi = pi 35 | 36 | if take_weights_here is None: 37 | take_weights_here = {} 38 | exec(open(os.path.splitext(__file__)[0] + ".weights").read(), take_weights_here) 39 | self.assigns = [ 40 | ( dense1_w, take_weights_here["weights_dense1_w"]), 41 | ( dense1_b, take_weights_here["weights_dense1_b"]), 42 | ( dense2_w, take_weights_here["weights_dense2_w"]), 43 | ( dense2_b, take_weights_here["weights_dense2_b"]), 44 | ( final_w, take_weights_here["weights_final_w"]), 45 | ( final_b, take_weights_here["weights_final_b"]), 46 | ] 47 | 48 | self.weight_assignment_placeholders = [] 49 | self.weight_assignment_nodes = [] 50 | for var, w in self.assigns: 51 | ph = tf.placeholder(tf.float32, w.shape) 52 | self.weight_assignment_placeholders.append(ph) 53 | self.weight_assignment_nodes.append( tf.assign(var, ph) ) 54 | 55 | self.load_weights() 56 | 57 | def load_weights(self): 58 | feed_dict = {} 59 | for (var, w), ph in zip(self.assigns, self.weight_assignment_placeholders): 60 | feed_dict[ph] = w 61 | tf.get_default_session().run(self.weight_assignment_nodes, feed_dict=feed_dict) 62 | 63 | def act(self, obs_data, cx): 64 | obs_data = [np.ones((1,)), obs_data] 65 | obs_data = [obs_data[0], obs_data[1]] 66 | # Because we need batch dimension, data[None] changes shape from [A] to [1,A] 67 | a = tf.get_default_session().run(self.pi, feed_dict=dict( (ph,data[None]) for ph,data in zip(self.obs_tuple, obs_data) )) 68 | return a[0] # return first in batch 69 | 70 | 71 | def demo_run(): 72 | config = tf.ConfigProto( 73 | inter_op_parallelism_threads=1, 74 | intra_op_parallelism_threads=1, 75 | device_count = { "GPU": 0 } ) 76 | sess = tf.InteractiveSession(config=config) 77 | 78 | env = gym.make("RoboschoolHumanoidFlagrunHarder-v1") 79 | 80 | pi = ZooPolicyTensorflow("mymodel1", env.observation_space, env.action_space) 81 | 82 | while 1: 83 | frame = 0 84 | score = 0 85 | restart_delay = 0 86 | obs = env.reset() 87 | 88 | while 1: 89 | a = pi.act(obs, env) 90 | 91 | obs, r, done, _ = env.step(a) 92 | 93 | score += r 94 | frame += 1 95 | still_open = env.render("human") 96 | if still_open==False: 97 | return 98 | if not done: continue 99 | if restart_delay==0: 100 | print("score=%0.2f in %i frames" % (score, frame)) 101 | if still_open!=True: # not True in multiplayer or non-Roboschool environment 102 | break 103 | restart_delay = 60*2 # 2 sec at 60 fps 104 | restart_delay -= 1 105 | if restart_delay==0: break 106 | 107 | if __name__=="__main__": 108 | demo_run() 109 | -------------------------------------------------------------------------------- /agent_zoo/RoboschoolHumanoidFlagrun_v1_2017jul.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/agent_zoo/RoboschoolHumanoidFlagrun_v1_2017jul.jpg -------------------------------------------------------------------------------- /agent_zoo/RoboschoolHumanoidFlagrun_v1_2017jul.py: -------------------------------------------------------------------------------- 1 | import os.path, gym 2 | import numpy as np 3 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 4 | import tensorflow as tf 5 | import roboschool 6 | 7 | class ZooPolicyTensorflow(object): 8 | def __init__(self, name, ob_space, ac_space, take_weights_here=None): 9 | self.name = name 10 | 11 | with tf.variable_scope(name): 12 | obs_tuple = [ 13 | tf.placeholder(tf.float32, (None, 1), name="obs0"), 14 | tf.placeholder(tf.float32, (None, 44), name="obs1"), 15 | ] 16 | self.obs_tuple = obs_tuple 17 | 18 | actions_input = [] 19 | actions_input.append(obs_tuple[1]) 20 | 21 | x = tf.concat( actions_input, axis=1 ) 22 | dense1_w = tf.get_variable("dense1_w", [44,256]) 23 | dense1_b = tf.get_variable("dense1_b", [256]) 24 | x = tf.matmul(x, dense1_w) + dense1_b 25 | x = tf.nn.relu(x) 26 | dense2_w = tf.get_variable("dense2_w", [256,128]) 27 | dense2_b = tf.get_variable("dense2_b", [128]) 28 | x = tf.matmul(x, dense2_w) + dense2_b 29 | x = tf.nn.relu(x) 30 | final_w = tf.get_variable("final_w", [128,17]) 31 | final_b = tf.get_variable("final_b", [17]) 32 | x = tf.matmul(x, final_w) + final_b 33 | pi = x 34 | self.pi = pi 35 | 36 | if take_weights_here is None: 37 | take_weights_here = {} 38 | exec(open(os.path.splitext(__file__)[0] + ".weights").read(), take_weights_here) 39 | self.assigns = [ 40 | ( dense1_w, take_weights_here["weights_dense1_w"]), 41 | ( dense1_b, take_weights_here["weights_dense1_b"]), 42 | ( dense2_w, take_weights_here["weights_dense2_w"]), 43 | ( dense2_b, take_weights_here["weights_dense2_b"]), 44 | ( final_w, take_weights_here["weights_final_w"]), 45 | ( final_b, take_weights_here["weights_final_b"]), 46 | ] 47 | 48 | self.weight_assignment_placeholders = [] 49 | self.weight_assignment_nodes = [] 50 | for var, w in self.assigns: 51 | ph = tf.placeholder(tf.float32, w.shape) 52 | self.weight_assignment_placeholders.append(ph) 53 | self.weight_assignment_nodes.append( tf.assign(var, ph) ) 54 | 55 | self.load_weights() 56 | 57 | def load_weights(self): 58 | feed_dict = {} 59 | for (var, w), ph in zip(self.assigns, self.weight_assignment_placeholders): 60 | feed_dict[ph] = w 61 | tf.get_default_session().run(self.weight_assignment_nodes, feed_dict=feed_dict) 62 | 63 | def act(self, obs_data, cx): 64 | obs_data = [np.ones((1,)), obs_data] 65 | obs_data = [obs_data[0], obs_data[1]] 66 | # Because we need batch dimension, data[None] changes shape from [A] to [1,A] 67 | a = tf.get_default_session().run(self.pi, feed_dict=dict( (ph,data[None]) for ph,data in zip(self.obs_tuple, obs_data) )) 68 | return a[0] # return first in batch 69 | 70 | 71 | def demo_run(): 72 | config = tf.ConfigProto( 73 | inter_op_parallelism_threads=1, 74 | intra_op_parallelism_threads=1, 75 | device_count = { "GPU": 0 } ) 76 | sess = tf.InteractiveSession(config=config) 77 | 78 | env = gym.make("RoboschoolHumanoidFlagrun-v1") 79 | 80 | pi = ZooPolicyTensorflow("mymodel1", env.observation_space, env.action_space) 81 | 82 | while 1: 83 | frame = 0 84 | score = 0 85 | restart_delay = 0 86 | obs = env.reset() 87 | 88 | while 1: 89 | a = pi.act(obs, env) 90 | 91 | obs, r, done, _ = env.step(a) 92 | 93 | score += r 94 | frame += 1 95 | still_open = env.render("human") 96 | if still_open==False: 97 | return 98 | if not done: continue 99 | if restart_delay==0: 100 | print("score=%0.2f in %i frames" % (score, frame)) 101 | if still_open!=True: # not True in multiplayer or non-Roboschool environment 102 | break 103 | restart_delay = 60*2 # 2 sec at 60 fps 104 | restart_delay -= 1 105 | if restart_delay==0: break 106 | 107 | if __name__=="__main__": 108 | demo_run() 109 | -------------------------------------------------------------------------------- /agent_zoo/RoboschoolHumanoid_v1_2017jul.py: -------------------------------------------------------------------------------- 1 | import os.path, gym 2 | import numpy as np 3 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 4 | import tensorflow as tf 5 | import roboschool 6 | 7 | class ZooPolicyTensorflow(object): 8 | def __init__(self, name, ob_space, ac_space, take_weights_here=None): 9 | self.name = name 10 | 11 | with tf.variable_scope(name): 12 | obs_tuple = [ 13 | tf.placeholder(tf.float32, (None, 1), name="obs0"), 14 | tf.placeholder(tf.float32, (None, 44), name="obs1"), 15 | ] 16 | self.obs_tuple = obs_tuple 17 | 18 | actions_input = [] 19 | actions_input.append(obs_tuple[1]) 20 | 21 | x = tf.concat( actions_input, axis=1 ) 22 | dense1_w = tf.get_variable("dense1_w", [44,256]) 23 | dense1_b = tf.get_variable("dense1_b", [256]) 24 | x = tf.matmul(x, dense1_w) + dense1_b 25 | x = tf.nn.relu(x) 26 | dense2_w = tf.get_variable("dense2_w", [256,128]) 27 | dense2_b = tf.get_variable("dense2_b", [128]) 28 | x = tf.matmul(x, dense2_w) + dense2_b 29 | x = tf.nn.relu(x) 30 | final_w = tf.get_variable("final_w", [128,17]) 31 | final_b = tf.get_variable("final_b", [17]) 32 | x = tf.matmul(x, final_w) + final_b 33 | pi = x 34 | self.pi = pi 35 | 36 | if take_weights_here is None: 37 | take_weights_here = {} 38 | exec(open(os.path.splitext(__file__)[0] + ".weights").read(), take_weights_here) 39 | self.assigns = [ 40 | ( dense1_w, take_weights_here["weights_dense1_w"]), 41 | ( dense1_b, take_weights_here["weights_dense1_b"]), 42 | ( dense2_w, take_weights_here["weights_dense2_w"]), 43 | ( dense2_b, take_weights_here["weights_dense2_b"]), 44 | ( final_w, take_weights_here["weights_final_w"]), 45 | ( final_b, take_weights_here["weights_final_b"]), 46 | ] 47 | 48 | self.weight_assignment_placeholders = [] 49 | self.weight_assignment_nodes = [] 50 | for var, w in self.assigns: 51 | ph = tf.placeholder(tf.float32, w.shape) 52 | self.weight_assignment_placeholders.append(ph) 53 | self.weight_assignment_nodes.append( tf.assign(var, ph) ) 54 | 55 | self.load_weights() 56 | 57 | def load_weights(self): 58 | feed_dict = {} 59 | for (var, w), ph in zip(self.assigns, self.weight_assignment_placeholders): 60 | feed_dict[ph] = w 61 | tf.get_default_session().run(self.weight_assignment_nodes, feed_dict=feed_dict) 62 | 63 | def act(self, obs_data, cx): 64 | obs_data = [np.ones((1,)), obs_data] 65 | obs_data = [obs_data[0], obs_data[1]] 66 | # Because we need batch dimension, data[None] changes shape from [A] to [1,A] 67 | a = tf.get_default_session().run(self.pi, feed_dict=dict( (ph,data[None]) for ph,data in zip(self.obs_tuple, obs_data) )) 68 | return a[0] # return first in batch 69 | 70 | 71 | def demo_run(): 72 | config = tf.ConfigProto( 73 | inter_op_parallelism_threads=1, 74 | intra_op_parallelism_threads=1, 75 | device_count = { "GPU": 0 } ) 76 | sess = tf.InteractiveSession(config=config) 77 | 78 | env = gym.make("RoboschoolHumanoid-v1") 79 | 80 | pi = ZooPolicyTensorflow("mymodel1", env.observation_space, env.action_space) 81 | 82 | while 1: 83 | frame = 0 84 | score = 0 85 | restart_delay = 0 86 | obs = env.reset() 87 | 88 | while 1: 89 | a = pi.act(obs, env) 90 | 91 | obs, r, done, _ = env.step(a) 92 | 93 | score += r 94 | frame += 1 95 | still_open = env.render("human") 96 | if still_open==False: 97 | return 98 | if not done: continue 99 | if restart_delay==0: 100 | print("score=%0.2f in %i frames" % (score, frame)) 101 | if still_open!=True: # not True in multiplayer or non-Roboschool environment 102 | break 103 | restart_delay = 60*2 # 2 sec at 60 fps 104 | restart_delay -= 1 105 | if restart_delay==0: break 106 | 107 | if __name__=="__main__": 108 | demo_run() 109 | -------------------------------------------------------------------------------- /agent_zoo/RoboschoolWalker2d_v1_2017jul.py: -------------------------------------------------------------------------------- 1 | import os.path, gym 2 | import numpy as np 3 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 4 | import tensorflow as tf 5 | import roboschool 6 | 7 | class ZooPolicyTensorflow(object): 8 | def __init__(self, name, ob_space, ac_space, take_weights_here=None): 9 | self.name = name 10 | 11 | with tf.variable_scope(name): 12 | obs_tuple = [ 13 | tf.placeholder(tf.float32, (None, 1), name="obs0"), 14 | tf.placeholder(tf.float32, (None, 22), name="obs1"), 15 | ] 16 | self.obs_tuple = obs_tuple 17 | 18 | actions_input = [] 19 | actions_input.append(obs_tuple[1]) 20 | 21 | x = tf.concat( actions_input, axis=1 ) 22 | dense1_w = tf.get_variable("dense1_w", [22,128]) 23 | dense1_b = tf.get_variable("dense1_b", [128]) 24 | x = tf.matmul(x, dense1_w) + dense1_b 25 | x = tf.nn.relu(x) 26 | dense2_w = tf.get_variable("dense2_w", [128,64]) 27 | dense2_b = tf.get_variable("dense2_b", [64]) 28 | x = tf.matmul(x, dense2_w) + dense2_b 29 | x = tf.nn.relu(x) 30 | final_w = tf.get_variable("final_w", [64,6]) 31 | final_b = tf.get_variable("final_b", [6]) 32 | x = tf.matmul(x, final_w) + final_b 33 | pi = x 34 | self.pi = pi 35 | 36 | if take_weights_here is None: 37 | take_weights_here = {} 38 | exec(open(os.path.splitext(__file__)[0] + ".weights").read(), take_weights_here) 39 | self.assigns = [ 40 | ( dense1_w, take_weights_here["weights_dense1_w"]), 41 | ( dense1_b, take_weights_here["weights_dense1_b"]), 42 | ( dense2_w, take_weights_here["weights_dense2_w"]), 43 | ( dense2_b, take_weights_here["weights_dense2_b"]), 44 | ( final_w, take_weights_here["weights_final_w"]), 45 | ( final_b, take_weights_here["weights_final_b"]), 46 | ] 47 | 48 | self.weight_assignment_placeholders = [] 49 | self.weight_assignment_nodes = [] 50 | for var, w in self.assigns: 51 | ph = tf.placeholder(tf.float32, w.shape) 52 | self.weight_assignment_placeholders.append(ph) 53 | self.weight_assignment_nodes.append( tf.assign(var, ph) ) 54 | 55 | self.load_weights() 56 | 57 | def load_weights(self): 58 | feed_dict = {} 59 | for (var, w), ph in zip(self.assigns, self.weight_assignment_placeholders): 60 | feed_dict[ph] = w 61 | tf.get_default_session().run(self.weight_assignment_nodes, feed_dict=feed_dict) 62 | 63 | def act(self, obs_data, cx): 64 | obs_data = [np.ones((1,)), obs_data] 65 | obs_data = [obs_data[0], obs_data[1]] 66 | # Because we need batch dimension, data[None] changes shape from [A] to [1,A] 67 | a = tf.get_default_session().run(self.pi, feed_dict=dict( (ph,data[None]) for ph,data in zip(self.obs_tuple, obs_data) )) 68 | return a[0] # return first in batch 69 | 70 | 71 | def demo_run(): 72 | config = tf.ConfigProto( 73 | inter_op_parallelism_threads=1, 74 | intra_op_parallelism_threads=1, 75 | device_count = { "GPU": 0 } ) 76 | sess = tf.InteractiveSession(config=config) 77 | 78 | env = gym.make("RoboschoolWalker2d-v1") 79 | 80 | pi = ZooPolicyTensorflow("mymodel1", env.observation_space, env.action_space) 81 | 82 | while 1: 83 | frame = 0 84 | score = 0 85 | restart_delay = 0 86 | obs = env.reset() 87 | 88 | while 1: 89 | a = pi.act(obs, env) 90 | 91 | obs, r, done, _ = env.step(a) 92 | 93 | score += r 94 | frame += 1 95 | still_open = env.render("human") 96 | if still_open==False: 97 | return 98 | if not done: continue 99 | if restart_delay==0: 100 | print("score=%0.2f in %i frames" % (score, frame)) 101 | if still_open!=True: # not True in multiplayer or non-Roboschool environment 102 | break 103 | restart_delay = 60*2 # 2 sec at 60 fps 104 | restart_delay -= 1 105 | if restart_delay==0: break 106 | 107 | if __name__=="__main__": 108 | demo_run() 109 | -------------------------------------------------------------------------------- /agent_zoo/demo_keyboard_humanoid1.py: -------------------------------------------------------------------------------- 1 | import gym, roboschool, sys, os 2 | import numpy as np 3 | import pyglet, pyglet.window as pw, pyglet.window.key as pwk 4 | from pyglet import gl 5 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 6 | import tensorflow as tf 7 | 8 | # 9 | # This opens a test window (not chase camera), allows to control humanoid using keyboard. 10 | # 11 | 12 | def demo_run(): 13 | env = gym.make("RoboschoolHumanoidFlagrun-v1") 14 | 15 | config = tf.ConfigProto( 16 | inter_op_parallelism_threads=1, 17 | intra_op_parallelism_threads=1, 18 | device_count = { "GPU": 0 } ) 19 | sess = tf.InteractiveSession(config=config) 20 | 21 | from RoboschoolHumanoidFlagrunHarder_v1_2017jul import ZooPolicyTensorflow 22 | pi = ZooPolicyTensorflow("humanoid1", env.observation_space, env.action_space) 23 | 24 | class TestKeyboardControl: 25 | def __init__(self): 26 | self.keys = {} 27 | self.control = np.zeros(2) 28 | def key(self, event_type, key, modifiers): 29 | self.keys[key] = +1 if event_type==6 else 0 30 | #print ("event_type", event_type, "key", key, "modifiers", modifiers) 31 | self.control[0] = self.keys.get(0x1000014, 0) - self.keys.get(0x1000012, 0) 32 | self.control[1] = self.keys.get(0x1000013, 0) - self.keys.get(0x1000015, 0) 33 | 34 | obs = env.reset() 35 | eu = env.unwrapped 36 | 37 | still_open = env.render("human") # This creates window to set callbacks on 38 | ctrl = TestKeyboardControl() 39 | eu.scene.cpp_world.set_key_callback(ctrl.key) 40 | 41 | while 1: 42 | a = pi.act(obs, env) 43 | 44 | if (ctrl.control != 0).any(): 45 | eu.walk_target_x = eu.body_xyz[0] + 2.0*ctrl.control[0] 46 | eu.walk_target_y = eu.body_xyz[1] + 2.0*ctrl.control[1] 47 | eu.flag = eu.scene.cpp_world.debug_sphere(eu.walk_target_x, eu.walk_target_y, 0.2, 0.2, 0xFF8080) 48 | eu.flag_timeout = 100500 49 | 50 | obs, r, done, _ = env.step(a) 51 | still_open = env.render("human") 52 | if still_open==False: 53 | return 54 | 55 | if __name__=="__main__": 56 | demo_run() 57 | -------------------------------------------------------------------------------- /agent_zoo/demo_keyboard_humanoid2.py: -------------------------------------------------------------------------------- 1 | import gym, roboschool, sys, os 2 | import numpy as np 3 | import pyglet, pyglet.window as pw, pyglet.window.key as pwk 4 | from pyglet import gl 5 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 6 | import tensorflow as tf 7 | 8 | # 9 | # This opens a third-party window (not test window), shows rendered chase camera, allows to control humanoid 10 | # using keyboard (in a different way) 11 | # 12 | 13 | class PygletInteractiveWindow(pw.Window): 14 | def __init__(self, env): 15 | pw.Window.__init__(self, width=600, height=400, vsync=False, resizable=True) 16 | self.theta = 0 17 | self.still_open = True 18 | 19 | @self.event 20 | def on_close(): 21 | self.still_open = False 22 | 23 | @self.event 24 | def on_resize(width, height): 25 | self.win_w = width 26 | self.win_h = height 27 | 28 | self.keys = {} 29 | self.human_pause = False 30 | self.human_done = False 31 | 32 | def imshow(self, arr): 33 | H, W, C = arr.shape 34 | assert C==3 35 | image = pyglet.image.ImageData(W, H, 'RGB', arr.tobytes(), pitch=W*-3) 36 | self.clear() 37 | self.switch_to() 38 | self.dispatch_events() 39 | texture = image.get_texture() 40 | gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST) 41 | texture.width = W 42 | texture.height = H 43 | texture.blit(0, 0, width=self.win_w, height=self.win_h) 44 | self.flip() 45 | 46 | def on_key_press(self, key, modifiers): 47 | self.keys[key] = +1 48 | if key==pwk.ESCAPE: self.still_open = False 49 | 50 | def on_key_release(self, key, modifiers): 51 | self.keys[key] = 0 52 | 53 | def each_frame(self): 54 | self.theta += 0.05 * (self.keys.get(pwk.LEFT, 0) - self.keys.get(pwk.RIGHT, 0)) 55 | 56 | def demo_run(): 57 | env = gym.make("RoboschoolHumanoidFlagrun-v1") 58 | 59 | config = tf.ConfigProto( 60 | inter_op_parallelism_threads=1, 61 | intra_op_parallelism_threads=1, 62 | device_count = { "GPU": 0 } ) 63 | sess = tf.InteractiveSession(config=config) 64 | 65 | from RoboschoolHumanoidFlagrunHarder_v1_2017jul import ZooPolicyTensorflow 66 | pi = ZooPolicyTensorflow("humanoid1", env.observation_space, env.action_space) 67 | 68 | control_me = PygletInteractiveWindow(env.unwrapped) 69 | 70 | env.reset() 71 | eu = env.unwrapped 72 | 73 | obs = env.reset() 74 | 75 | while 1: 76 | a = pi.act(obs, env) 77 | 78 | x, y, z = eu.body_xyz 79 | eu.walk_target_x = x + 1.1*np.cos(control_me.theta) # 1.0 or less will trigger flag reposition by env itself 80 | eu.walk_target_y = y + 1.1*np.sin(control_me.theta) 81 | eu.flag = eu.scene.cpp_world.debug_sphere(eu.walk_target_x, eu.walk_target_y, 0.2, 0.2, 0xFF8080) 82 | eu.flag_timeout = 100500 83 | 84 | obs, r, done, _ = env.step(a) 85 | img = env.render("rgb_array") 86 | control_me.imshow(img) 87 | control_me.each_frame() 88 | if control_me.still_open==False: break 89 | 90 | if __name__=="__main__": 91 | demo_run() 92 | -------------------------------------------------------------------------------- /agent_zoo/demo_pong.py: -------------------------------------------------------------------------------- 1 | import os, sys, subprocess 2 | import numpy as np 3 | import gym 4 | import roboschool 5 | 6 | def play(env, pi, video): 7 | episode_n = 0 8 | while 1: 9 | episode_n += 1 10 | obs = env.reset() 11 | if video: video_recorder = gym.monitoring.video_recorder.VideoRecorder(env=env, base_path=("/tmp/demo_pong_episode%i" % episode_n), enabled=True) 12 | while 1: 13 | a = pi.act(obs) 14 | obs, rew, done, info = env.step(a) 15 | if video: video_recorder.capture_frame() 16 | if done: break 17 | if video: video_recorder.close() 18 | break 19 | 20 | if len(sys.argv)==1: 21 | import roboschool.multiplayer 22 | game = roboschool.gym_pong.PongSceneMultiplayer() 23 | gameserver = roboschool.multiplayer.SharedMemoryServer(game, "pongdemo", want_test_window=True) 24 | for n in range(game.players_count): 25 | subprocess.Popen([sys.executable, sys.argv[0], "pongdemo", "%i"%n]) 26 | gameserver.serve_forever() 27 | 28 | else: 29 | player_n = int(sys.argv[2]) 30 | 31 | env = gym.make("RoboschoolPong-v1") 32 | env.unwrapped.multiplayer(env, game_server_guid=sys.argv[1], player_n=player_n) 33 | 34 | from RoboschoolPong_v0_2017may1 import SmallReactivePolicy as Pol1 35 | from RoboschoolPong_v0_2017may2 import SmallReactivePolicy as Pol2 36 | if player_n==0: 37 | pi = Pol1(env.observation_space, env.action_space) 38 | else: 39 | pi = Pol2(env.observation_space, env.action_space) 40 | play(env, pi, video=False) # set video = player_n==0 to record video 41 | 42 | -------------------------------------------------------------------------------- /agent_zoo/demo_race1.py: -------------------------------------------------------------------------------- 1 | import os, sys, subprocess 2 | import numpy as np 3 | import gym 4 | import roboschool 5 | 6 | if len(sys.argv)==1: 7 | import roboschool.multiplayer 8 | stadium = roboschool.scene_stadium.MultiplayerStadiumScene(gravity=9.8, timestep=0.0165/4, frame_skip=4) 9 | gameserver = roboschool.multiplayer.SharedMemoryServer(stadium, "race", want_test_window=True) 10 | # We start subprocesses between constructor and serve_forever(), because constructor creates necessary pipes to connect to 11 | for n in range(stadium.players_count): 12 | subprocess.Popen([sys.executable, sys.argv[0], "race", "%i"%n]) 13 | gameserver.serve_forever() 14 | 15 | else: 16 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 17 | import tensorflow as tf 18 | config = tf.ConfigProto( 19 | inter_op_parallelism_threads=1, 20 | intra_op_parallelism_threads=1, 21 | device_count = { "GPU": 0 } ) 22 | sess = tf.InteractiveSession(config=config) 23 | # If this gives you an error, try CUDA_VISIBLE_DEVICES= (nothing visible) 24 | 25 | from RoboschoolWalker2d_v1_2017jul import ZooPolicyTensorflow as PolWalker 26 | from RoboschoolHopper_v1_2017jul import ZooPolicyTensorflow as PolHopper 27 | from RoboschoolHalfCheetah_v1_2017jul import ZooPolicyTensorflow as PolHalfCheetah 28 | from RoboschoolHumanoid_v1_2017jul import ZooPolicyTensorflow as PolHumanoid1 29 | from RoboschoolHumanoidFlagrun_v1_2017jul import ZooPolicyTensorflow as PolHumanoid2 30 | # Flagrun and Harder is compatible with normal Humanoid in observations and actions. 31 | 32 | possible_participants = [ 33 | ("RoboschoolWalker2d-v1", PolWalker), 34 | ("RoboschoolHopper-v1", PolHopper), 35 | ("RoboschoolHalfCheetah-v1", PolHalfCheetah), 36 | ("RoboschoolHumanoid-v1", PolHumanoid1), 37 | ("RoboschoolHumanoid-v1", PolHumanoid2), 38 | ] 39 | env_id, PolicyClass = possible_participants[ np.random.randint(len(possible_participants)) ] 40 | env = gym.make(env_id) 41 | env.unwrapped.multiplayer(env, game_server_guid=sys.argv[1], player_n=int(sys.argv[2])) 42 | 43 | pi = PolicyClass("mymodel", env.observation_space, env.action_space) 44 | 45 | while 1: 46 | obs = env.reset() 47 | while 1: 48 | a = pi.act(obs, None) 49 | obs, rew, done, info = env.step(a) 50 | if done: break 51 | -------------------------------------------------------------------------------- /agent_zoo/demo_race2.py: -------------------------------------------------------------------------------- 1 | import os, gym, roboschool 2 | import numpy as np 3 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 4 | import tensorflow as tf 5 | config = tf.ConfigProto( 6 | inter_op_parallelism_threads=1, 7 | intra_op_parallelism_threads=1, 8 | device_count = { "GPU": 0 } ) 9 | sess = tf.InteractiveSession(config=config) 10 | 11 | from RoboschoolWalker2d_v1_2017jul import ZooPolicyTensorflow as PolWalker 12 | from RoboschoolHopper_v1_2017jul import ZooPolicyTensorflow as PolHopper 13 | from RoboschoolHalfCheetah_v1_2017jul import ZooPolicyTensorflow as PolHalfCheetah 14 | from RoboschoolHumanoid_v1_2017jul import ZooPolicyTensorflow as PolHumanoid1 15 | from RoboschoolHumanoidFlagrun_v1_2017jul import ZooPolicyTensorflow as PolHumanoid2 16 | # HumanoidFlagrun is compatible with normal Humanoid in observations and actions. 17 | 18 | possible_participants = [ 19 | ("RoboschoolHopper-v1", PolHopper), 20 | ("RoboschoolWalker2d-v1", PolWalker), 21 | ("RoboschoolHalfCheetah-v1", PolHalfCheetah), 22 | ("RoboschoolHumanoid-v1", PolHumanoid1), 23 | ("RoboschoolHumanoid-v1", PolHumanoid2), 24 | ] 25 | 26 | stadium = roboschool.scene_stadium.MultiplayerStadiumScene(gravity=9.8, timestep=0.0165/4, frame_skip=4) 27 | 28 | # This example shows inner workings of multiplayer scene, how you can run 29 | # several robots in one process. 30 | 31 | participants = [] 32 | for lane in range(3): 33 | env_id, PolicyClass = possible_participants[ np.random.randint(len(possible_participants)) ] 34 | env = gym.make(env_id) 35 | env.unwrapped.scene = stadium # if you set scene before first reset(), it will be used. 36 | env.unwrapped.player_n = lane # mutliplayer scenes will also use player_n 37 | pi = PolicyClass("mymodel%i" % lane, env.observation_space, env.action_space) 38 | participants.append( (env, pi) ) 39 | 40 | episode_n = 0 41 | video = False 42 | while 1: 43 | stadium.episode_restart() 44 | episode_n += 1 45 | 46 | multi_state = [env.reset() for env, _ in participants] 47 | frame = 0 48 | restart_delay = 0 49 | if video: video_recorder = gym.monitoring.video_recorder.VideoRecorder(env=participants[0][0], base_path=("/tmp/demo_race_episode%i" % episode_n), enabled=True) 50 | while 1: 51 | still_open = stadium.test_window() 52 | multi_action = [pi.act(s, None) for s, (env, pi) in zip(multi_state, participants)] 53 | 54 | for a, (env, pi) in zip(multi_action, participants): 55 | env.unwrapped.apply_action(a) # action sent in apply_action() must be the same that sent into step(), 56 | # some wrappers will not work 57 | 58 | stadium.global_step() 59 | 60 | state_reward_done_info = [env.step(a) for a, (env, pi) in zip(multi_action, participants)] 61 | multi_state = [x[0] for x in state_reward_done_info] 62 | multi_done = [x[2] for x in state_reward_done_info] 63 | 64 | if video: video_recorder.capture_frame() 65 | 66 | if sum(multi_done)==len(multi_done): 67 | break 68 | 69 | frame += 1 70 | stadium.cpp_world.test_window_score("%04i" % frame) 71 | if not still_open: break 72 | if frame==1000: break 73 | if video: video_recorder.close() 74 | if not still_open: break 75 | 76 | -------------------------------------------------------------------------------- /build_wheel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | if [ $(uname) == 'Linux' ]; then 5 | docker run -v $PWD:/io python:${MB_PYTHON_VERSION} /io/docker_build_wheel.sh 6 | fi 7 | 8 | if [ $(uname) == 'Darwin' ]; then 9 | ./osx_build_wheel.sh 10 | fi 11 | -------------------------------------------------------------------------------- /config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | function pre_build { 3 | echo "Hello world (this should not be run)" 4 | } 5 | 6 | function run_tests { 7 | echo "Hello world (this should not be run)" 8 | } 9 | 10 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | # !/bin/bash 2 | set -ex 3 | # ** HACK - rename linux wheels to manylinux1 wheels 4 | if [ $(uname) == 'Linux' ]; then 5 | cd wheelhouse 6 | for whl in $(ls roboschool-*linux*.whl); do 7 | echo "HACK!!! Renaming $whl --> ${whl%linux_x86_64.whl}manylinux1_x86_64.whl" 8 | sudo mv $whl ${whl%linux_x86_64.whl}manylinux1_x86_64.whl 9 | done 10 | cd .. 11 | pip install --user bleach==3.0.2 12 | pip install --user twine==1.12.1 13 | fi 14 | # ** END HACK 15 | 16 | if [ $(uname) == 'Darwin' ]; then 17 | export PATH=$PWD/venv/bin:$PATH 18 | pip install twine 19 | fi 20 | 21 | if [[ ! -z "$TRAVIS_TAG" ]]; then 22 | python -m twine upload wheelhouse/* 23 | 24 | if [[ ! -z "$DEPLOY_SDIST" ]]; then 25 | python setup.py sdist 26 | python -m twine upload dist/* 27 | fi 28 | fi 29 | 30 | -------------------------------------------------------------------------------- /docker_build_wheel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | apt-get update && apt-get install -y libgl1-mesa-dev qtbase5-dev libqt5opengl5-dev libassimp-dev patchelf cmake > /dev/null 4 | 5 | cd $(dirname "$0") 6 | . ./exports.sh 7 | 8 | ./install_boost.sh 9 | ./install_bullet.sh 10 | ./roboschool_compile_and_graft.sh 11 | 12 | pip wheel --no-deps -w /io/wheelhouse . 13 | 14 | 15 | -------------------------------------------------------------------------------- /docker_test_wheel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | apt-get update && apt-get install -y libgl1-mesa-dev > /dev/null 4 | pip install /io/wheelhouse/roboschool*.whl 5 | 6 | python -c "import roboschool, gym; gym.make('RoboschoolAnt-v1')" 7 | 8 | -------------------------------------------------------------------------------- /exports.sh: -------------------------------------------------------------------------------- 1 | export ROBOSCHOOL_PATH=$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P ) 2 | export CPP_HOUSEHOLD=$ROBOSCHOOL_PATH/roboschool/cpp-household 3 | export BULLET_PATH=$HOME/.forked_bullet 4 | 5 | if [[ $(uname) == 'Linux' ]]; then 6 | PYTHON_BIN=$(readlink -f $(which python)) 7 | PYTHON_ROOT=${PYTHON_BIN%/bin/python*} 8 | PYTHON_VER=${PYTHON_BIN#$PYTHON_ROOT/bin/python} 9 | fi 10 | if [[ $(uname) == 'Darwin' ]]; then 11 | brew install coreutils 12 | PYTHON_BIN=$(greadlink -f $(which python)) 13 | PYTHON_ROOT=${PYTHON_BIN%/bin/python*} 14 | PYTHON_VER=${PYTHON_BIN#$PYTHON_ROOT/bin/python} 15 | export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/qt/lib/pkgconfig:/Library/Frameworks/Python.framework/Versions/${PYTHON_VER}/lib/pkgconfig/ 16 | fi 17 | 18 | 19 | export PKG_CONFIG_PATH=${PYTHON_ROOT}/lib/pkgconfig:$BULLET_PATH/lib/pkgconfig/:$PKG_CONFIG_PATH 20 | export CPATH=$CPATH:${PYTHON_ROOT}/include/python${PYTHON_VER}m:$HOME/.boost/include 21 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BULLET_PATH/lib:$HOME/.boost/lib 22 | 23 | -------------------------------------------------------------------------------- /install_boost.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ $(uname) == 'Linux' ]; then 3 | source ./exports.sh 4 | BOOST_SRCDIR=$HOME/.boost_src 5 | mkdir -p $BOOST_SRCDIR && cd $BOOST_SRCDIR 6 | # curl -OL https://storage.googleapis.com/games-src/boost/boost_1_58_0.tar.bz2 7 | curl -OL https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.gz 8 | tar -xf boost_1_69_0.tar.gz 9 | cd boost_1_69_0 10 | 11 | ./bootstrap.sh --with-python=$(which python) --with-libraries=python --prefix=$HOME/.boost --with-python-root=$PYTHON_ROOT 12 | ./b2 install > $BOOST_SRCDIR/boost_make.log || (tail -100 $BOOST_SRCDIR/boost_make.log; exit 1) 13 | fi 14 | -------------------------------------------------------------------------------- /install_bullet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BULLET_SRCDIR=$(mktemp -d)/bullet3 4 | BULLET_PATH=$HOME/.forked_bullet 5 | 6 | rm -rf $BULLET_SRCDIR 7 | mkdir -p $BULLET_SRCDIR && cd $BULLET_SRCDIR 8 | git clone https://github.com/olegklimov/bullet3 -b roboschool_self_collision . 9 | 10 | mkdir build && cd build 11 | cmake -DBUILD_SHARED_LIBS=ON -DUSE_DOUBLE_PRECISION=1 -DCMAKE_INSTALL_PREFIX:PATH=$BULLET_PATH -DBUILD_CPU_DEMOS=OFF -DBUILD_BULLET2_DEMOS=OFF -DBUILD_EXTRAS=OFF -DBUILD_UNIT_TESTS=OFF -DBUILD_CLSOCKET=OFF -DBUILD_ENET=OFF -DBUILD_OPENGL3_DEMOS=OFF .. 12 | 13 | make -j4 > /tmp/bullet_make.log || (tail -100 /tmp/bullet_make.log; exit 1) 14 | make install > /tmp/bullet_install.log || (tail -100 /tmp/bullet_install.log; exit 1) 15 | 16 | if [ $(uname) == 'Darwin' ]; then 17 | 18 | for lib in $(find $BULLET_PATH/lib -name "*.dylib"); do 19 | install_name_tool -id $lib $lib 20 | for dep in $(otool -L $lib | grep "@rpath" | awk '{print $1}'); do 21 | install_name_tool -change $dep "$BULLET_PATH/lib/${dep##@rpath/}" $lib 22 | done 23 | done 24 | fi 25 | if [ $(uname) == 'Linux' ]; then 26 | 27 | for lib in $(find $BULLET_PATH/lib -name "*.so.2.87"); do 28 | patchelf --set-rpath $BULLET_PATH/lib $lib 29 | done 30 | fi 31 | 32 | -------------------------------------------------------------------------------- /osx_build_wheel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git clone https://github.com/matthew-brett/multibuild && cd multibuild && git checkout 254ad28 && cd .. 4 | . multibuild/common_utils.sh 5 | . multibuild/travis_steps.sh 6 | before_install 7 | 8 | brew install qt assimp boost-python3 || echo "warning - brew returned non-zero exit code. \nThis may be a sign of error, but may also be because brew wants to point something out. Please inspect logs above" 9 | 10 | . ./exports.sh 11 | ./install_bullet.sh 12 | ./roboschool_compile_and_graft.sh 13 | pip wheel --no-deps -w wheelhouse . 14 | 15 | -------------------------------------------------------------------------------- /osx_test_wheel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | . multibuild/common_utils.sh 4 | . multibuild/travis_steps.sh 5 | before_install 6 | 7 | pip install wheelhouse/roboschool*.whl 8 | 9 | python -c "import roboschool, gym; gym.make('RoboschoolAnt-v1')" 10 | 11 | -------------------------------------------------------------------------------- /roboschool/__init__.py: -------------------------------------------------------------------------------- 1 | from gym.envs.registration import register 2 | #from gym.scoreboard.registration import add_task, add_group 3 | 4 | import os 5 | import os.path as osp 6 | import subprocess 7 | 8 | os.environ['QT_PLUGIN_PATH'] = osp.join(osp.dirname(osp.abspath(__file__)), '.qt_plugins') + ':' + \ 9 | os.environ.get('QT_PLUGIN_PATH','') 10 | 11 | register( 12 | id='RoboschoolInvertedPendulum-v1', 13 | entry_point='roboschool:RoboschoolInvertedPendulum', 14 | max_episode_steps=1000, 15 | reward_threshold=950.0, 16 | tags={ "pg_complexity": 1*1000000 }, 17 | ) 18 | register( 19 | id='RoboschoolInvertedPendulumSwingup-v1', 20 | entry_point='roboschool:RoboschoolInvertedPendulumSwingup', 21 | max_episode_steps=1000, 22 | reward_threshold=800.0, 23 | tags={ "pg_complexity": 1*1000000 }, 24 | ) 25 | register( 26 | id='RoboschoolInvertedDoublePendulum-v1', 27 | entry_point='roboschool:RoboschoolInvertedDoublePendulum', 28 | max_episode_steps=1000, 29 | reward_threshold=9100.0, 30 | tags={ "pg_complexity": 1*1000000 }, 31 | ) 32 | 33 | register( 34 | id='RoboschoolReacher-v1', 35 | entry_point='roboschool:RoboschoolReacher', 36 | max_episode_steps=150, 37 | reward_threshold=18.0, 38 | tags={ "pg_complexity": 1*1000000 }, 39 | ) 40 | 41 | register( 42 | id='RoboschoolHopper-v1', 43 | entry_point='roboschool:RoboschoolHopper', 44 | max_episode_steps=1000, 45 | reward_threshold=2500.0, 46 | tags={ "pg_complexity": 8*1000000 }, 47 | ) 48 | register( 49 | id='RoboschoolWalker2d-v1', 50 | entry_point='roboschool:RoboschoolWalker2d', 51 | max_episode_steps=1000, 52 | reward_threshold=2500.0, 53 | tags={ "pg_complexity": 8*1000000 }, 54 | ) 55 | register( 56 | id='RoboschoolHalfCheetah-v1', 57 | entry_point='roboschool:RoboschoolHalfCheetah', 58 | max_episode_steps=1000, 59 | reward_threshold=3000.0, 60 | tags={ "pg_complexity": 8*1000000 }, 61 | ) 62 | 63 | register( 64 | id='RoboschoolAnt-v1', 65 | entry_point='roboschool:RoboschoolAnt', 66 | max_episode_steps=1000, 67 | reward_threshold=2500.0, 68 | tags={ "pg_complexity": 8*1000000 }, 69 | ) 70 | 71 | register( 72 | id='RoboschoolHumanoid-v1', 73 | entry_point='roboschool:RoboschoolHumanoid', 74 | max_episode_steps=1000, 75 | reward_threshold=3500.0, 76 | tags={ "pg_complexity": 100*1000000 }, 77 | ) 78 | register( 79 | id='RoboschoolHumanoidFlagrun-v1', 80 | entry_point='roboschool:RoboschoolHumanoidFlagrun', 81 | max_episode_steps=1000, 82 | reward_threshold=2000.0, 83 | tags={ "pg_complexity": 200*1000000 }, 84 | ) 85 | register( 86 | id='RoboschoolHumanoidFlagrunHarder-v1', 87 | entry_point='roboschool:RoboschoolHumanoidFlagrunHarder', 88 | max_episode_steps=1000, 89 | tags={ "pg_complexity": 300*1000000 }, 90 | ) 91 | 92 | 93 | # Atlas 94 | 95 | register( 96 | id='RoboschoolAtlasForwardWalk-v1', 97 | entry_point='roboschool:RoboschoolAtlasForwardWalk', 98 | max_episode_steps=1000, 99 | tags={ "pg_complexity": 200*1000000 }, 100 | ) 101 | 102 | 103 | # Multiplayer 104 | 105 | register( 106 | id='RoboschoolPong-v1', 107 | entry_point='roboschool:RoboschoolPong', 108 | max_episode_steps=1000, 109 | tags={ "pg_complexity": 20*1000000 }, 110 | ) 111 | 112 | from roboschool.gym_pendulums import RoboschoolInvertedPendulum 113 | from roboschool.gym_pendulums import RoboschoolInvertedPendulumSwingup 114 | from roboschool.gym_pendulums import RoboschoolInvertedDoublePendulum 115 | from roboschool.gym_reacher import RoboschoolReacher 116 | from roboschool.gym_mujoco_walkers import RoboschoolHopper 117 | from roboschool.gym_mujoco_walkers import RoboschoolWalker2d 118 | from roboschool.gym_mujoco_walkers import RoboschoolHalfCheetah 119 | from roboschool.gym_mujoco_walkers import RoboschoolAnt 120 | from roboschool.gym_mujoco_walkers import RoboschoolHumanoid 121 | from roboschool.gym_humanoid_flagrun import RoboschoolHumanoidFlagrun 122 | from roboschool.gym_humanoid_flagrun import RoboschoolHumanoidFlagrunHarder 123 | from roboschool.gym_atlas import RoboschoolAtlasForwardWalk 124 | from roboschool.gym_pong import RoboschoolPong 125 | -------------------------------------------------------------------------------- /roboschool/cpp-household/Makefile: -------------------------------------------------------------------------------- 1 | UNAME := $(shell uname -s) 2 | OBJDIRR=.build-release 3 | OBJDIRD=.build-debug 4 | 5 | ifeq ($(UNAME),Linux) 6 | PKG =pkg-config 7 | MOC =moc -qt=5 8 | LIBS =-L/usr/lib64 -lm -lGL -L$(HOME)/.boost/lib 9 | INC =-I/usr/include 10 | BOOST_MT= 11 | ifneq ($(USE_PYTHON3),0) 12 | HAVE_PYTHON3=$(shell which python3) 13 | endif 14 | ifneq ($(HAVE_PYTHON3),) 15 | PYTHON = $(shell python3 -c "import sys; print('%i.%i' % sys.version_info[:2])") 16 | ifneq (,$(findstring linuxbrew,$(HAVE_PYTHON3))) 17 | $(info Linux, python3, linuxbrew branch) 18 | BOOST_PYTHON3_POSTFIX = 3 19 | else ifneq (,$(findstring conda,$(HAVE_PYTHON3))) 20 | $(info Linux, python3, anaconda branch, will query Ubuntu python3 for boost_python) 21 | BOOST_PYTHON3_POSTFIX = -py$(shell /usr/bin/python3 -c "import sys; print('%i%i' % sys.version_info[:2])") 22 | else 23 | $(info Linux, python3, Ubuntu branch) 24 | BOOST_PYTHON3_POSTFIX = $(shell python3 -c "import sys; print('%i%i' % sys.version_info[:2])") 25 | # BOOST_PYTHON3_POSTFIX = 3 26 | endif 27 | else 28 | $(info Linux, python 2 branch) 29 | PYTHON = $(shell python -c "import sys; print('%i.%i' % sys.version_info[:2])") 30 | endif 31 | RPATH=-Wl,-z,origin -Wl,--disable-new-dtags,-rpath,'$(BULLET_PATH)/lib',-rpath,'$(HOME)/.boost/lib' 32 | endif 33 | 34 | ifeq ($(UNAME),Darwin) 35 | ifneq ("$(wildcard /usr/local/opt/qt5/bin/moc"), "") 36 | $(info Mac, assumed python3, homebrew branch) 37 | MOC =/usr/local/opt/qt5/bin/moc 38 | else 39 | $(info Mac, assumed python3, anaconda branch) 40 | MOC =moc 41 | endif 42 | PKG =pkg-config 43 | LIBS =-framework OpenGL 44 | INC =-I/System/Library/Frameworks/OpenGL.framework/Headers 45 | BOOST_PYTHON3_POSTFIX = 3 46 | BOOST_MT=-mt 47 | PYTHON = $(shell python3 -c "import sys; print('%i.%i' % sys.version_info[:2])") 48 | RPATH = -Wl,-undefined,dynamic_lookup 49 | endif 50 | 51 | INC += `$(PKG) --cflags Qt5Widgets Qt5OpenGL assimp bullet` 52 | LIBS += `$(PKG) --libs Qt5Widgets Qt5OpenGL assimp bullet` 53 | LIBS += -lstdc++ 54 | INC += -I/usr/local/include/bullet 55 | LIBS += $(RPATH) -lLinearMath -lBullet3Common -lBulletCollision -lBulletDynamics -lBulletInverseDynamics -lBulletSoftBody -lPhysicsClientC_API 56 | 57 | ifeq ($(PYTHON),2.7) 58 | BOOST_PYTHON = -lboost_python 59 | else 60 | BOOST_PYTHON = -lboost_python$(BOOST_PYTHON3_POSTFIX) 61 | endif 62 | 63 | CC=gcc 64 | LINK=gcc 65 | AR=ar r 66 | AR_OUT= 67 | LINK_OUT= -o 68 | MINUS_O = -o 69 | CFLAGS = -std=c++11 -Wall -Wno-unused-variable -Wno-unused-function -Wno-deprecated-register -fPIC -DBT_USE_DOUBLE_PRECISION -g -O3 -march=native $(INC) 70 | CFLAGSD = -std=c++11 -Wall -Wno-unused-variable -Wno-unused-function -Wno-deprecated-register -fPIC -DBT_USE_DOUBLE_PRECISION -g -DDEBUG $(INC) 71 | 72 | SHARED = -shared 73 | DEPENDS = -MMD -MF $@.dep 74 | 75 | EVERY_BIN=../robot-test-tool ../robot-test-tool_d ../cpp_household.so ../cpp_household_d.so 76 | 77 | SIM = \ 78 | physics-bullet.cpp \ 79 | assets-mesh.cpp \ 80 | random-world-tools.cpp \ 81 | render-glwidget.cpp \ 82 | render-hud.cpp \ 83 | render-simple.cpp \ 84 | render-simple-primitives.cpp 85 | 86 | ENABLE_HARDWARE_RENDER=1 87 | ifdef ROBOSCHOOL_DISABLE_HARDWARE_RENDER 88 | ENABLE_HARDWARE_RENDER=0 89 | endif 90 | 91 | ifeq ("$(wildcard /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.0)", "") 92 | ENABLE_HARDWARE_RENDER=0 93 | endif 94 | 95 | ifneq ($(ENABLE_HARDWARE_RENDER), 0) 96 | $(info Hardware render (turn on shadows)) 97 | SIM += render-ssao.cpp 98 | CFLAGS += -DUSE_SSAO 99 | CFLAGSD += -DUSE_SSAO 100 | else 101 | $(info Slow hardware or software render (no shadows)) 102 | endif 103 | 104 | TWND = \ 105 | test-tool-qt4.cpp 106 | 107 | PYTH = python-binding.cpp 108 | 109 | SIM_R = $(patsubst %.cpp, $(OBJDIRR)/%.o, $(SIM)) 110 | SIM_D = $(patsubst %.cpp, $(OBJDIRD)/%.o, $(SIM)) 111 | TWND_R = $(patsubst %.cpp, $(OBJDIRR)/%.o, $(TWND)) 112 | TWND_D = $(patsubst %.cpp, $(OBJDIRD)/%.o, $(TWND)) 113 | PYTH_R = $(patsubst %.cpp, $(OBJDIRR)/%.o, $(PYTH)) 114 | PYTH_D = $(patsubst %.cpp, $(OBJDIRD)/%.o, $(PYTH)) 115 | 116 | EVERY_OBJ_R = $(SIM_R) $(TWND_R) $(PYTH_R) 117 | EVERY_OBJ_D = $(SIM_D) $(TWND_D) $(PYTH_D) 118 | DEP = $(patsubst %.o,%.o.dep, $(EVERY_OBJ_R) $(EVERY_OBJ_D)) 119 | 120 | all: dirs $(EVERY_BIN) 121 | 122 | $(OBJDIRR)/test-tool-qt4.o: .generated/test-tool-qt4.moc 123 | .generated/test-tool-qt4.moc: test-tool-qt4.cpp 124 | $(MOC) -o $@ $< 125 | 126 | ../robot-test-tool: $(SIM_R) $(TWND_R) 127 | ../robot-test-tool_d: $(SIM_D) $(TWND_D) 128 | 129 | ../robot-test-tool: $(SIM_R) $(TWND_R) 130 | $(LINK) $(LINK_OUT)$@ $^ $(LIBS) 131 | ../robot-test-tool_d: $(SIM_D) $(TWND_D) 132 | $(LINK) $(LINK_OUT)$@ $^ $(LIBS) 133 | 134 | ../cpp_household.so: $(SIM_R) $(PYTH_R) 135 | $(LINK) $(SHARED) $(LINK_OUT)$@ $^ $(LIBS) $(BOOST_PYTHON) 136 | ../cpp_household_d.so: $(SIM_D) $(PYTH_D) 137 | $(LINK) $(SHARED) $(LINK_OUT)$@ $^ $(LIBS) $(BOOST_PYTHON) 138 | 139 | $(OBJDIRR)/%.o: %.cpp 140 | $(CC) $(CFLAGS) -c $< $(MINUS_O)$@ $(DEPENDS) 141 | $(OBJDIRD)/%.o: %.cpp 142 | $(CC) $(CFLAGSD) -c $< $(MINUS_O)$@ $(DEPENDS) 143 | 144 | .PHONY: depends clean dirs 145 | 146 | clean: 147 | $(RM) $(EVERY_BIN) $(EVERY_OBJ_R) $(EVERY_OBJ_D) .generated/*.moc *.ilk *.pdb $(DEP) 148 | rm -rf .generated 149 | rm -rf $(OBJDIRD) 150 | rm -rf $(OBJDIRR) 151 | 152 | depends: 153 | cat $(DEP) > Makefile.dep 154 | 155 | .generated: 156 | mkdir -p .generated 157 | $(OBJDIRR): 158 | mkdir -p $@ 159 | $(OBJDIRD): 160 | mkdir -p $@ 161 | 162 | dirs: .generated $(OBJDIRR) $(OBJDIRD) 163 | 164 | -include Makefile.dep 165 | -------------------------------------------------------------------------------- /roboschool/cpp-household/assets.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace SimpleRender { 10 | struct VAO; 11 | struct Buffer; 12 | struct Context; 13 | class ContextViewport; 14 | } 15 | 16 | struct App; 17 | 18 | namespace Household { 19 | 20 | using boost::shared_ptr; 21 | 22 | struct Material { 23 | Material(const std::string& name): name(name) { } 24 | std::string name; 25 | uint32_t texture = 0; 26 | bool texture_loaded = false; 27 | std::string diffuse_texture_image_fn; 28 | uint32_t diffuse_color = 0x00FF00; 29 | uint32_t multiply_color = 0xFFFFFF; 30 | }; 31 | 32 | struct Cylinder { 33 | btScalar radius; 34 | btScalar length; 35 | }; 36 | 37 | struct Sphere { 38 | btScalar radius; 39 | }; 40 | 41 | struct Box { 42 | btScalar size_x; 43 | btScalar size_y; 44 | btScalar size_z; 45 | }; 46 | 47 | struct Shape { 48 | btTransform origin; 49 | enum { MESH, STATIC_MESH, CYLINDER, SPHERE, CAPSULE, BOX, DEBUG_LINES }; 50 | int primitive_type = MESH; 51 | 52 | shared_ptr cylinder; 53 | shared_ptr sphere; 54 | shared_ptr box; 55 | 56 | bool converted_to_mesh = false; 57 | void convert_primitive_to_mesh(); 58 | 59 | std::vector raw_vertexes; // minimal number of vertices, intended for convex hull 60 | 61 | std::vector v; // v, t, norm, color -- all prepared for rendering 62 | std::vector t; 63 | std::vector norm; 64 | std::vector lines; // same facets walked around to draw lines 65 | uint32_t lines_color = 0xFFFFFF; 66 | void push_vertex(btScalar vx, btScalar vy, btScalar vz); // utilities for mesh generation 67 | void push_normal(btScalar nx, btScalar ny, btScalar nz); 68 | void push_tex(btScalar u, btScalar v); 69 | void push_lines(btScalar x, btScalar y, btScalar z); 70 | 71 | shared_ptr material; 72 | shared_ptr vao; 73 | shared_ptr buf_v; 74 | shared_ptr buf_n; 75 | shared_ptr buf_t; 76 | shared_ptr buf_l; 77 | 78 | Shape() { origin.setIdentity(); } 79 | }; 80 | 81 | const int DETAIL_LEVELS = 2; 82 | const int DETAIL_BEST = 0; 83 | const int DETAIL_LOWER = 1; 84 | 85 | struct MaterialNamespace { 86 | std::map> name2mtl; 87 | }; 88 | 89 | struct ShapeDetailLevels { 90 | bool load_later_on = false; 91 | std::string load_later_fn; 92 | btTransform load_later_transform; 93 | shared_ptr materials; 94 | std::vector> detail_levels[DETAIL_LEVELS]; 95 | }; 96 | 97 | void load_model(const shared_ptr& result, const std::string& fn, btScalar scale, const btTransform& transform); 98 | bool load_collision_shape_from_OFF_files(const shared_ptr& result, const std::string& fn_template, btScalar scale, const btTransform& viz_frame); 99 | 100 | } // namespace Household 101 | -------------------------------------------------------------------------------- /roboschool/cpp-household/glsl/common.h: -------------------------------------------------------------------------------- 1 | //#line 2 "glsl/common.h" 2 | 3 | #define AO_RANDOMTEX_SIZE 4 4 | 5 | #ifdef __cplusplus 6 | namespace ssao 7 | { 8 | using namespace nv_math; 9 | #endif 10 | 11 | struct HBAOData { 12 | float RadiusToScreen; // radius 13 | float R2; // 1/radius 14 | float NegInvR2; // radius * radius 15 | float NDotVBias; 16 | 17 | float InvFullResolution[2]; 18 | float InvQuarterResolution[2]; 19 | 20 | float AOMultiplier; 21 | float PowExponent; 22 | 23 | float projInfo[4]; 24 | float projScale[2]; 25 | int projOrtho; 26 | 27 | float float2Offsets[4*AO_RANDOMTEX_SIZE*AO_RANDOMTEX_SIZE]; // 4 == vec4 28 | float jitters[4*AO_RANDOMTEX_SIZE*AO_RANDOMTEX_SIZE]; 29 | }; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | /*----------------------------------------------------------------------- 36 | Copyright (c) 2014, NVIDIA. All rights reserved. 37 | 38 | Redistribution and use in source and binary forms, with or without 39 | modification, are permitted provided that the following conditions 40 | are met: 41 | * Redistributions of source code must retain the above copyright 42 | notice, this list of conditions and the following disclaimer. 43 | * Neither the name of its contributors may be used to endorse 44 | or promote products derived from this software without specific 45 | prior written permission. 46 | 47 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 48 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 49 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 50 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 51 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 52 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 53 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 54 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 55 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 56 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 57 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 | -----------------------------------------------------------------------*/ 59 | -------------------------------------------------------------------------------- /roboschool/cpp-household/glsl/displaytex.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 330 2 | //#line 3 "displaytex.frag.glsl" // mac doesn't like #line instruction 3 | 4 | uniform sampler2D inputTexture; 5 | 6 | out vec4 out_Color; 7 | 8 | in vec2 texCoord; 9 | 10 | void main() 11 | { 12 | out_Color = texture(inputTexture, texCoord); 13 | //out_Color.a = 0.5; 14 | } 15 | -------------------------------------------------------------------------------- /roboschool/cpp-household/glsl/fullscreen_triangle.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 330 2 | //#line 3 "fullscreen_triangle.vert.glsl" 3 | 4 | out vec2 texCoord; 5 | 6 | void main() 7 | { 8 | uint idx = uint(gl_VertexID % 3); 9 | vec4 pos = vec4( 10 | (float( idx &1U)) * 4.0 - 1.0, // one big triangle stratches further than -1 (not to use quad) 11 | (float((idx>>1U)&1U)) * 4.0 - 1.0, 12 | 0, 1.0); 13 | gl_Position = pos; 14 | texCoord = pos.xy * 0.5 + 0.5; 15 | } 16 | -------------------------------------------------------------------------------- /roboschool/cpp-household/glsl/hud.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 330 2 | //#line 3 "hud.vert.glsl" 3 | 4 | uniform vec4 xywh; 5 | uniform float zpos; 6 | 7 | layout(location=0) in highp vec4 input_vertex; 8 | 9 | out vec2 texCoord; 10 | 11 | void main() 12 | { 13 | float x = xywh.x; 14 | float y = xywh.y; 15 | float w = xywh.z; 16 | float h = xywh.w; 17 | gl_Position = vec4( 18 | x + input_vertex.x*w, 19 | -y - input_vertex.y*h, 20 | 0, 1.0); 21 | texCoord = vec2( 22 | (x + input_vertex.x*w) / 2 + 0.5, 23 | (y + input_vertex.y*h) / 2 + 0.5 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /roboschool/cpp-household/glsl/nv_math_glsltypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 NVIDIA Corporation. All rights reserved. 2 | // 3 | // TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED 4 | // *AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS 5 | // OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT,IMPLIED WARRANTIES OF 6 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA 7 | // OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT, OR 8 | // CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS 9 | // OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY 10 | // OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, 11 | // EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 12 | // 13 | // Please direct any bugs or questions to SDKFeedback@nvidia.com 14 | 15 | #ifndef NV_SHADER_TYPES_H 16 | #define NV_SHADER_TYPES_H 17 | 18 | #include "NvFoundation.h" 19 | #include "nv_math_types.h" 20 | 21 | namespace nv_math { 22 | 23 | #if defined(__amd64__) || defined(__x86_64__) || defined(_M_X64) || defined(__AMD64__) 24 | // Matrices, must align to 4 vector (16 bytes) 25 | NV_ALIGN(16, typedef mat4f mat4); 26 | 27 | // vectors, 4-tuples and 3-tuples must align to 16 bytes 28 | // 2-vectors must align to 8 bytes 29 | NV_ALIGN(16, typedef vec4f vec4 ); 30 | NV_ALIGN(16, typedef vec3f vec3 ); 31 | NV_ALIGN(8 , typedef vec2f vec2 ); 32 | 33 | NV_ALIGN(16, typedef vec4i ivec4 ); 34 | NV_ALIGN(16, typedef vec3i ivec3 ); 35 | NV_ALIGN(8 , typedef vec2i ivec2 ); 36 | 37 | NV_ALIGN(16, typedef vec4ui uvec4 ); 38 | NV_ALIGN(16, typedef vec3ui uvec3 ); 39 | NV_ALIGN(8, typedef vec2ui uvec2 ); 40 | #else 41 | // Matrices, must align to 4 vector (16 bytes) 42 | typedef mat4f mat4; 43 | 44 | // vectors, 4-tuples and 3-tuples must align to 16 bytes 45 | // 2-vectors must align to 8 bytes 46 | typedef vec4f vec4; 47 | typedef vec3f vec3; 48 | typedef vec2f vec2; 49 | 50 | typedef vec4i ivec4; 51 | typedef vec3i ivec3; 52 | typedef vec2i ivec2; 53 | 54 | typedef vec4ui uvec4; 55 | typedef vec3ui uvec3; 56 | typedef vec2ui uvec2; 57 | #endif 58 | 59 | //class to make uint look like bool to make GLSL packing rules happy 60 | struct boolClass 61 | { 62 | unsigned int _rep; 63 | 64 | boolClass() : _rep(false) {} 65 | boolClass( bool b) : _rep(b) {} 66 | operator bool() { return _rep == 0 ? false : true; } 67 | boolClass& operator=( bool b) { _rep = b; return *this; } 68 | }; 69 | 70 | //NVP_ALIGN_V(4, typedef boolClass bool32); 71 | 72 | } 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /roboschool/cpp-household/glsl/simple_texturing.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 330 2 | //#line 3 "simple_texturing.frag.glsl" 3 | 4 | 5 | 6 | 7 | uniform bool enable_texture; 8 | uniform sampler2D texture_id; 9 | 10 | in Interpolants { 11 | //vec3 pos; 12 | vec3 normal; 13 | flat vec4 color; 14 | vec3 N; 15 | vec2 texcoord; 16 | } IN; 17 | 18 | layout(location=0,index=0) out vec4 out_Color; 19 | 20 | 21 | void main() 22 | { 23 | vec4 c = IN.color; 24 | //vec3 n1 = normalize(IN.normal); 25 | if (enable_texture) { 26 | c = texture(texture_id, IN.texcoord); 27 | } 28 | //out_Color = (0.3 + 0.72*max(0.5, dot(IN.N, vec3(0,0,-1))) + 0.72*max(0.2, dot(vec3(n1), vec3(0,1,0))) ) * c; 29 | //out_Color = (0.3 + 0.72*max(0.5, dot(IN.N, vec3(0,0,-1))) ) * c; 30 | //out_Color = (0.3 + 0.72*max(0.2, dot(vec3(n1), vec3(0,1,0))) ) * c; 31 | if (false) { 32 | out_Color.r = IN.N[0]; 33 | out_Color.g = IN.N[1]; 34 | out_Color.b = IN.N[2]; 35 | out_Color.a = 1; 36 | } else { 37 | float to_screen = max(0.0, dot(normalize(IN.N), vec3(0,0,-1))); 38 | out_Color = (0.9 + 0.1*pow(to_screen, 100)) * c; 39 | out_Color.a = c.a; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /roboschool/cpp-household/glsl/simple_texturing.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 330 2 | //#line 3 "simple_texturing.vert.glsl" 3 | 4 | uniform highp mat4 input_matrix_modelview; 5 | uniform highp mat4 input_matrix_modelview_inverse_transpose; 6 | uniform highp vec4 uni_color; 7 | uniform bool enable_texture; 8 | 9 | layout(location=0) in highp vec4 input_vertex; 10 | layout(location=1) in mediump vec4 input_normal; 11 | layout(location=2) in mediump vec2 input_texcoord; 12 | 13 | out Interpolants { 14 | //vec3 pos; 15 | vec3 normal; 16 | flat vec4 color; 17 | vec3 N; 18 | vec2 texcoord; 19 | } OUT; 20 | 21 | void main(void) 22 | { 23 | //mat4 t = input_matrix_modelview_inverse_transpose; 24 | OUT.N = vec3( normalize(mat3(input_matrix_modelview_inverse_transpose) * vec3(input_normal)) ); 25 | gl_Position = input_matrix_modelview * input_vertex; 26 | //OUT.pos = vec3(input_vertex); 27 | //vec3(input_vertex.x, input_vertex.y, input_vertex.z); 28 | OUT.normal = vec3(input_normal); 29 | OUT.color = uni_color; 30 | if (enable_texture) { 31 | OUT.texcoord = vec2(input_texcoord); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /roboschool/cpp-household/glsl/ssao_depthlinearize.frag.glsl: -------------------------------------------------------------------------------- 1 | //#line 2 "ssao_depthlinearize.frag.glsl" 2 | // no #version here, to insert #define's in C++ code 3 | 4 | #ifndef DEPTHLINEARIZE_MSAA 5 | #define DEPTHLINEARIZE_MSAA 0 6 | #endif 7 | 8 | uniform vec4 clipInfo; // z_n * z_f, z_n - z_f, z_f, perspective = 1 : 0 9 | 10 | //#if DEPTHLINEARIZE_MSAA 11 | //layout(location=1) uniform int sampleIndex; 12 | //layout(binding=0) uniform sampler2DMS inputTexture; 13 | //#else 14 | uniform sampler2D inputTexture; 15 | //#endif 16 | 17 | out highp vec4 out_Color; 18 | 19 | float reconstructCSZ(float d, vec4 clipInfo) { 20 | if (clipInfo[3] != 0) { 21 | return (clipInfo[0] / (clipInfo[1] * d + clipInfo[2])); 22 | } 23 | else { 24 | return (clipInfo[1]+clipInfo[2] - d * clipInfo[1]); 25 | } 26 | } 27 | /* 28 | if (in_perspective == 1.0) // perspective 29 | { 30 | ze = (zNear * zFar) / (zFar - zb * (zFar - zNear)); 31 | } 32 | else // orthographic proj 33 | { 34 | ze = zNear + zb * (zFar - zNear); 35 | } 36 | */ 37 | void main() { 38 | //#if DEPTHLINEARIZE_MSAA 39 | // float depth = texelFetch(inputTexture, ivec2(gl_FragCoord.xy), sampleIndex).x; 40 | //#else 41 | float depth = texelFetch(inputTexture, ivec2(gl_FragCoord.xy), 0).x; 42 | //#endif 43 | out_Color = vec4(reconstructCSZ(depth, clipInfo), 0,0,1); 44 | } 45 | 46 | /*----------------------------------------------------------------------- 47 | Copyright (c) 2014, NVIDIA. All rights reserved. 48 | 49 | Redistribution and use in source and binary forms, with or without 50 | modification, are permitted provided that the following conditions 51 | are met: 52 | * Redistributions of source code must retain the above copyright 53 | notice, this list of conditions and the following disclaimer. 54 | * Neither the name of its contributors may be used to endorse 55 | or promote products derived from this software without specific 56 | prior written permission. 57 | 58 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 59 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 60 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 61 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 62 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 63 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 64 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 65 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 66 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 67 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 68 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 69 | -----------------------------------------------------------------------*/ 70 | -------------------------------------------------------------------------------- /roboschool/cpp-household/glsl/ssao_hbao_blur.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 430 2 | 3 | const float KERNEL_RADIUS = 3; 4 | 5 | layout(location=0) uniform float g_Sharpness; 6 | layout(location=1) uniform vec2 g_InvResolutionDirection; // either set x to 1/width or y to 1/height 7 | 8 | layout(binding=0) uniform sampler2D texSource; 9 | 10 | in vec2 texCoord; 11 | 12 | layout(location=0,index=0) out vec4 out_Color; 13 | 14 | #ifndef AO_BLUR_PRESENT 15 | #define AO_BLUR_PRESENT 1 16 | #endif 17 | 18 | 19 | //------------------------------------------------------------------------- 20 | 21 | float BlurFunction(vec2 uv, float r, float center_c, float center_d, inout float w_total) 22 | { 23 | vec2 aoz = texture2D( texSource, uv ).xy; 24 | float c = aoz.x; 25 | float d = aoz.y; 26 | 27 | const float BlurSigma = float(KERNEL_RADIUS) * 0.5; 28 | const float BlurFalloff = 1.0 / (2.0*BlurSigma*BlurSigma); 29 | 30 | float ddiff = (d - center_d) * g_Sharpness; 31 | float w = exp2(-r*r*BlurFalloff - ddiff*ddiff); 32 | w_total += w; 33 | 34 | return c*w; 35 | } 36 | 37 | void main() 38 | { 39 | vec2 aoz = texture2D( texSource, texCoord ).xy; 40 | float center_c = aoz.x; 41 | float center_d = aoz.y; 42 | 43 | float c_total = center_c; 44 | float w_total = 1.0; 45 | 46 | for (float r = 1; r <= KERNEL_RADIUS; ++r) 47 | { 48 | vec2 uv = texCoord + g_InvResolutionDirection * r; 49 | c_total += BlurFunction(uv, r, center_c, center_d, w_total); 50 | } 51 | 52 | for (float r = 1; r <= KERNEL_RADIUS; ++r) 53 | { 54 | vec2 uv = texCoord - g_InvResolutionDirection * r; 55 | c_total += BlurFunction(uv, r, center_c, center_d, w_total); 56 | } 57 | 58 | #if AO_BLUR_PRESENT 59 | out_Color = vec4(c_total/w_total); 60 | #else 61 | out_Color = vec4(c_total/w_total, center_d, 0, 0); 62 | #endif 63 | } 64 | 65 | /*----------------------------------------------------------------------- 66 | Copyright (c) 2014, NVIDIA. All rights reserved. 67 | 68 | Redistribution and use in source and binary forms, with or without 69 | modification, are permitted provided that the following conditions 70 | are met: 71 | * Redistributions of source code must retain the above copyright 72 | notice, this list of conditions and the following disclaimer. 73 | * Neither the name of its contributors may be used to endorse 74 | or promote products derived from this software without specific 75 | prior written permission. 76 | 77 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 78 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 79 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 80 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 81 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 82 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 83 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 84 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 85 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 86 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 87 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 88 | -----------------------------------------------------------------------*/ -------------------------------------------------------------------------------- /roboschool/cpp-household/render-glwidget.h: -------------------------------------------------------------------------------- 1 | #include "render-simple.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | using boost::shared_ptr; 9 | 10 | struct KeyCallback { 11 | virtual ~KeyCallback() { } 12 | virtual void key_callback(int event_type, int key, int modifiers) =0; 13 | }; 14 | 15 | struct ConsoleMessage { 16 | QString msg_text; 17 | QImage msg_image; 18 | qint64 ts; 19 | btVector3 pos; 20 | void render(uint32_t color, int width=0); 21 | }; 22 | 23 | class Viz: public QOpenGLWidget { 24 | public: 25 | shared_ptr cx; 26 | shared_ptr render_viewport; 27 | bool render_viewport_resized = true; 28 | shared_ptr dummy_fbuf; 29 | QFont font_score; 30 | 31 | void render_on_offscreen_surface(); 32 | 33 | Viz(const shared_ptr& cx); 34 | ~Viz(); 35 | void initializeGL(); 36 | void _render_on_correctly_set_up_context(); 37 | void _paint_hud(); 38 | void paintGL(); 39 | void resizeGL(int w, int h); 40 | void keyPressEvent(QKeyEvent* kev); 41 | void keyReleaseEvent(QKeyEvent* kev); 42 | void wheelEvent(QWheelEvent* wev); 43 | void mousePressEvent(QMouseEvent* mev); 44 | void mouseReleaseEvent(QMouseEvent* mev); 45 | void mouseMoveEvent(QMouseEvent* mev); 46 | bool event(QEvent* ev); 47 | void timeout(); 48 | 49 | float user_x = 0; 50 | float user_z = 0; 51 | float user_y = 0; 52 | float yrot = -60; 53 | float zrot = 0; 54 | float wheel = 10.00; 55 | float ruler_size = 1.0; 56 | int floor_visible = 10; 57 | void user_move(float hor, float vert); 58 | 59 | enum { DRAG_NONE, DRAG_ROTATE, DRAG_MOVE }; 60 | int drag = 0; 61 | double mouse_prev_x = 0; 62 | double mouse_prev_y = 0; 63 | double mouse_init_x = 0; 64 | double mouse_init_y = 0; 65 | 66 | double ms_render = 0; 67 | int ms_render_objectcount = 0; 68 | 69 | uint32_t view_options = 0; 70 | float dup_opacity = 0.5; 71 | int dup_transparent_mode = 0; 72 | 73 | //shared_ptr camera; 74 | 75 | std::vector obs; 76 | std::vector obs_hist; 77 | std::vector action; 78 | std::vector action_hist; 79 | std::vector reward; 80 | std::vector reward_hist; 81 | std::string score; 82 | void history_advance(bool only_ensure_correct_sizes); 83 | void drawhist(QPainter& p, const char* label, int bracketn, const QRect& r, const float* sensors_hist, const float* sensors); 84 | 85 | int win_w, win_h; 86 | bool resized = false; 87 | std::list console; 88 | void test_window_print(const std::string& msg); 89 | 90 | std::list billboards; 91 | void test_window_billboard(const btVector3& pos, const std::string& s, uint32_t color); 92 | 93 | ConsoleMessage caption; 94 | void test_window_big_caption(const std::string& s); 95 | 96 | boost::weak_ptr key_callback; 97 | void activate_key_callback(int event_type, int key, int modifiers); 98 | }; 99 | 100 | class VizCamera: public QWidget { 101 | public: 102 | boost::weak_ptr cref; 103 | boost::weak_ptr key_callback; 104 | std::string score; 105 | const int MARGIN = 20; 106 | 107 | VizCamera(const shared_ptr& cref): cref(cref) { } 108 | void paintEvent(QPaintEvent* ev); 109 | void keyPressEvent(QKeyEvent* kev); 110 | void keyReleaseEvent(QKeyEvent* kev); 111 | QSize sizeHint() const; 112 | 113 | void activate_key_callback(int event_type, int key, int modifiers); 114 | }; 115 | -------------------------------------------------------------------------------- /roboschool/cpp-household/roboschool.config: -------------------------------------------------------------------------------- 1 | // Add predefined macros for your project here. For example: 2 | // #define THE_ANSWER 42 3 | -------------------------------------------------------------------------------- /roboschool/cpp-household/roboschool.creator: -------------------------------------------------------------------------------- 1 | [General] 2 | -------------------------------------------------------------------------------- /roboschool/cpp-household/roboschool.files: -------------------------------------------------------------------------------- 1 | Makefile 2 | household.h 3 | assets.h 4 | assets-mesh.cpp 5 | physics-bullet.cpp 6 | render-simple.h 7 | render-simple.cpp 8 | render-simple-primitives.cpp 9 | render-ssao.cpp 10 | render-hud.cpp 11 | render-glwidget.h 12 | render-glwidget.cpp 13 | test-tool-qt4.cpp 14 | random-world-tools.cpp 15 | python-binding.cpp 16 | ../random_stadium.py 17 | ../random_stadium_kernel.pyx 18 | ../gym_mujoco_xml_env.py 19 | ../gym_urdf_robot_env.py 20 | ../gym_pendulums.py 21 | ../gym_reacher.py 22 | ../gym_forward_walker.py 23 | ../gym_mujoco_walkers.py 24 | ../mujoco_assets/humanoid_symmetric.xml 25 | ../gym_humanoid_flagrun.py 26 | ../gym_atlas.py 27 | ../models_robot/atlas_description/urdf/atlas_v4_with_multisense.urdf 28 | ../gym_pong.py 29 | ../models_robot/roboschool_pong.xml 30 | ../gym_pong_trainservers.py 31 | ../scene_abstract.py 32 | ../scene_stadium.py 33 | ../multiplayer.py 34 | ../test_manual.py 35 | ../__init__.py 36 | ../../agent_zoo/demo_race1.py 37 | ../../agent_zoo/demo_race2.py 38 | ../../agent_zoo/demo_pong.py 39 | ../../agent_zoo/demo_keyboard_humanoid1.py 40 | ../../agent_zoo/demo_keyboard_humanoid2.py 41 | 42 | glsl/common.h 43 | glsl/displaytex.frag.glsl 44 | glsl/fullscreen_triangle.vert.glsl 45 | glsl/NvFoundation.h 46 | glsl/nv_math_glsltypes.h 47 | glsl/nv_math.h 48 | glsl/nv_math.inl 49 | glsl/nv_math_types.h 50 | glsl/simple_texturing.frag.glsl 51 | glsl/simple_texturing.vert.glsl 52 | glsl/ssao_bilateralblur.frag.glsl 53 | glsl/ssao_depthlinearize.frag.glsl 54 | glsl/ssao_hbao_blur.frag.glsl 55 | glsl/ssao_hbao_deinterleave.frag.glsl 56 | glsl/ssao_hbao.frag.glsl 57 | glsl/ssao_hbao_reinterleave.frag.glsl 58 | glsl/viewnormal.frag.glsl 59 | glsl/hud.vert.glsl 60 | -------------------------------------------------------------------------------- /roboschool/cpp-household/roboschool.includes: -------------------------------------------------------------------------------- 1 | /usr/include/bullet 2 | /usr/local/include/ 3 | /usr/local/include/bullet 4 | ~/.linuxbrew/include/bullet 5 | /usr/include/x86_64-linux-gnu/qt5 6 | /usr/include/x86_64-linux-gnu/qt5/QtWidgets 7 | /usr/include/x86_64-linux-gnu/qt5/QtOpenGL 8 | /usr/include/x86_64-linux-gnu/qt5/QtGui 9 | -------------------------------------------------------------------------------- /roboschool/gym_atlas.py: -------------------------------------------------------------------------------- 1 | from roboschool.gym_forward_walker import RoboschoolForwardWalker 2 | from roboschool.gym_urdf_robot_env import RoboschoolUrdfEnv 3 | from roboschool.scene_abstract import cpp_household 4 | from roboschool.scene_stadium import SinglePlayerStadiumScene 5 | import numpy as np 6 | 7 | class RoboschoolAtlasForwardWalk(RoboschoolForwardWalker, RoboschoolUrdfEnv): 8 | ''' 9 | 3-D humanoid robot similar to Boston Dynamics ATLAS robot. 10 | The task is to make the robot run as fast as possible 11 | ''' 12 | random_yaw = False 13 | foot_list = ["r_foot", "l_foot"] 14 | 15 | def __init__(self): 16 | RoboschoolForwardWalker.__init__(self, power=0.30) 17 | RoboschoolUrdfEnv.__init__(self, 18 | "atlas_description/urdf/atlas_v4_with_multisense.urdf", 19 | "pelvis", 20 | action_dim=30, obs_dim=70, 21 | fixed_base=False, 22 | self_collision=True) 23 | 24 | def create_single_player_scene(self): 25 | return SinglePlayerStadiumScene(gravity=9.8, timestep=0.0165/8, frame_skip=8) # 8 instead of 4 here 26 | 27 | def alive_bonus(self, z, pitch): 28 | # This is debug code to fix unwanted self-collisions: 29 | #for part in self.parts.values(): 30 | # contact_names = set(x.name for x in part.contact_list()) 31 | # if contact_names: 32 | # print("CONTACT OF '%s' WITH '%s'" % (part.name, ",".join(contact_names)) ) 33 | 34 | x,y,z = self.head.pose().xyz() 35 | # Failure mode: robot doesn't bend knees, tries to walk using hips. 36 | # We fix that by a bit of reward engineering. 37 | knees = np.array([j.current_relative_position() for j in [self.jdict["l_leg_kny"], self.jdict["r_leg_kny"]]], dtype=np.float32).flatten() 38 | knees_at_limit = np.count_nonzero(np.abs(knees[0::2]) > 0.99) 39 | return +4-knees_at_limit if z > 1.3 else -1 40 | 41 | def robot_specific_reset(self): 42 | RoboschoolForwardWalker.robot_specific_reset(self) 43 | self.set_initial_orientation(yaw_center=0, yaw_random_spread=np.pi) 44 | self.head = self.parts["head"] 45 | 46 | random_yaw = False 47 | 48 | def set_initial_orientation(self, yaw_center, yaw_random_spread): 49 | cpose = cpp_household.Pose() 50 | if not self.random_yaw: 51 | yaw = yaw_center 52 | else: 53 | yaw = yaw_center + self.np_random.uniform(low=-yaw_random_spread, high=yaw_random_spread) 54 | 55 | cpose.set_xyz(self.start_pos_x, self.start_pos_y, self.start_pos_z + 1.0) 56 | cpose.set_rpy(0, 0, yaw) # just face random direction, but stay straight otherwise 57 | self.cpp_robot.set_pose_and_speed(cpose, 0,0,0) 58 | self.initial_z = 1.5 59 | -------------------------------------------------------------------------------- /roboschool/gym_mujoco_xml_env.py: -------------------------------------------------------------------------------- 1 | import gym, gym.spaces, gym.utils, gym.utils.seeding 2 | import numpy as np 3 | import os 4 | import warnings 5 | 6 | 7 | class RoboschoolMujocoXmlEnv(gym.Env): 8 | """ 9 | Base class for MuJoCo .xml actors in a Scene. 10 | These environments create single-player scenes and behave like normal Gym environments, if 11 | you don't use multiplayer. 12 | """ 13 | 14 | metadata = { 15 | 'render.modes': ['human', 'rgb_array'], 16 | 'video.frames_per_second': 60 17 | } 18 | 19 | VIDEO_W = 600 # for video showing the robot, not for camera ON the robot 20 | VIDEO_H = 400 21 | 22 | def __init__(self, model_xml, robot_name, action_dim, obs_dim): 23 | warnings.warn("roboschool has been deprecated in favor of PyBullet, see https://github.com/openai/roboschool#news") 24 | self.scene = None 25 | 26 | high = np.ones([action_dim]) 27 | self.action_space = gym.spaces.Box(-high, high, dtype=np.float32) 28 | high = np.inf*np.ones([obs_dim]) 29 | self.observation_space = gym.spaces.Box(-high, high, dtype=np.float32) 30 | self.seed() 31 | 32 | self.model_xml = model_xml 33 | self.robot_name = robot_name 34 | 35 | def seed(self, seed=None): 36 | self.np_random, seed = gym.utils.seeding.np_random(seed) 37 | return [seed] 38 | 39 | def reset(self): 40 | if self.scene is None: 41 | self.scene = self.create_single_player_scene() 42 | if not self.scene.multiplayer: 43 | self.scene.episode_restart() 44 | self.mjcf = self.scene.cpp_world.load_mjcf(os.path.join(os.path.dirname(__file__), "mujoco_assets", self.model_xml)) 45 | self.ordered_joints = [] 46 | self.jdict = {} 47 | self.parts = {} 48 | self.frame = 0 49 | self.done = 0 50 | self.reward = 0 51 | dump = 0 52 | for r in self.mjcf: 53 | if dump: print("ROBOT '%s'" % r.root_part.name) 54 | if r.root_part.name==self.robot_name: 55 | self.cpp_robot = r 56 | self.robot_body = r.root_part 57 | for part in r.parts: 58 | if dump: print("\tPART '%s'" % part.name) 59 | self.parts[part.name] = part 60 | if part.name==self.robot_name: 61 | self.cpp_robot = r 62 | self.robot_body = part 63 | for j in r.joints: 64 | if dump: print("\tALL JOINTS '%s' limits = %+0.2f..%+0.2f effort=%0.3f speed=%0.3f" % ((j.name,) + j.limits()) ) 65 | if j.name[:6]=="ignore": 66 | j.set_motor_torque(0) 67 | continue 68 | j.power_coef = 100.0 69 | self.ordered_joints.append(j) 70 | self.jdict[j.name] = j 71 | assert(self.cpp_robot) 72 | self.robot_specific_reset() 73 | for r in self.mjcf: 74 | r.query_position() 75 | s = self.calc_state() # optimization: calc_state() can calculate something in self.* for calc_potential() to use 76 | self.potential = self.calc_potential() 77 | self.camera = self.scene.cpp_world.new_camera_free_float(self.VIDEO_W, self.VIDEO_H, "video_camera") 78 | return s 79 | 80 | def render(self, mode='human'): 81 | if mode=="human": 82 | self.scene.human_render_detected = True 83 | return self.scene.cpp_world.test_window() 84 | elif mode=="rgb_array": 85 | self.camera_adjust() 86 | rgb, _, _, _, _ = self.camera.render(False, False, False) # render_depth, render_labeling, print_timing) 87 | rendered_rgb = np.fromstring(rgb, dtype=np.uint8).reshape( (self.VIDEO_H,self.VIDEO_W,3) ) 88 | return rendered_rgb 89 | else: 90 | assert(0) 91 | 92 | def calc_potential(self): 93 | return 0 94 | 95 | def HUD(self, s, a, done): 96 | active = self.scene.actor_is_active(self) 97 | if active and self.done<=2: 98 | self.scene.cpp_world.test_window_history_advance() 99 | self.scene.cpp_world.test_window_observations(s.tolist()) 100 | self.scene.cpp_world.test_window_actions(a.tolist()) 101 | self.scene.cpp_world.test_window_rewards(self.rewards) 102 | if self.done<=1: # Only post score on first time done flag is seen, keep this score if user continues to use env 103 | s = "%04i %07.1f %s" % (self.frame, self.reward, "DONE" if self.done else "") 104 | if active: 105 | self.scene.cpp_world.test_window_score(s) 106 | #self.camera.test_window_score(s) # will appear on video ("rgb_array"), but not on cameras istalled on the robot (because that would be different camera) 107 | 108 | -------------------------------------------------------------------------------- /roboschool/gym_pendulums.py: -------------------------------------------------------------------------------- 1 | from roboschool.scene_abstract import SingleRobotEmptyScene 2 | from roboschool.gym_mujoco_xml_env import RoboschoolMujocoXmlEnv 3 | import gym, gym.spaces, gym.utils, gym.utils.seeding 4 | import numpy as np 5 | import os, sys 6 | 7 | class RoboschoolInvertedDoublePendulum(RoboschoolMujocoXmlEnv): 8 | ''' 9 | Two-link continuous control version of classic cartpole problem. 10 | Keep two-link pendulum upright by moving the 1-D cart. 11 | Similar to MuJoCo InvertedDoublePendulum task. 12 | ''' 13 | def __init__(self): 14 | RoboschoolMujocoXmlEnv.__init__(self, 'inverted_double_pendulum.xml', 'cart', action_dim=1, obs_dim=9) 15 | 16 | def create_single_player_scene(self): 17 | return SingleRobotEmptyScene(gravity=9.8, timestep=0.0165, frame_skip=1) 18 | 19 | def robot_specific_reset(self): 20 | self.pole2 = self.parts["pole2"] 21 | self.slider = self.jdict["slider"] 22 | self.j1 = self.jdict["hinge"] 23 | self.j2 = self.jdict["hinge2"] 24 | u = self.np_random.uniform(low=-.1, high=.1, size=[2]) 25 | self.j1.reset_current_position(float(u[0]), 0) 26 | self.j2.reset_current_position(float(u[1]), 0) 27 | self.j1.set_motor_torque(0) 28 | self.j2.set_motor_torque(0) 29 | 30 | def apply_action(self, a): 31 | assert( np.isfinite(a).all() ) 32 | self.slider.set_motor_torque( 200*float(np.clip(a[0], -1, +1)) ) 33 | 34 | def calc_state(self): 35 | theta, theta_dot = self.j1.current_position() 36 | gamma, gamma_dot = self.j2.current_position() 37 | x, vx = self.slider.current_position() 38 | self.pos_x, _, self.pos_y = self.pole2.pose().xyz() 39 | assert( np.isfinite(x) ) 40 | return np.array([ 41 | x, vx, 42 | self.pos_x, 43 | np.cos(theta), np.sin(theta), theta_dot, 44 | np.cos(gamma), np.sin(gamma), gamma_dot, 45 | ]) 46 | 47 | def step(self, a): 48 | self.apply_action(a) 49 | self.scene.global_step() 50 | state = self.calc_state() # sets self.pos_x self.pos_y 51 | # upright position: 0.6 (one pole) + 0.6 (second pole) * 0.5 (middle of second pole) = 0.9 52 | # using tag in original xml, upright position is 0.6 + 0.6 = 1.2, difference +0.3 53 | dist_penalty = 0.01 * self.pos_x ** 2 + (self.pos_y + 0.3 - 2) ** 2 54 | # v1, v2 = self.model.data.qvel[1:3] TODO when this fixed https://github.com/bulletphysics/bullet3/issues/1040 55 | #vel_penalty = 1e-3 * v1**2 + 5e-3 * v2**2 56 | vel_penalty = 0 57 | alive_bonus = 10 58 | done = self.pos_y + 0.3 <= 1 59 | self.rewards = [float(alive_bonus), float(-dist_penalty), float(-vel_penalty)] 60 | self.frame += 1 61 | self.done += done # 2 == 1+True 62 | self.reward += sum(self.rewards) 63 | self.HUD(state, a, done) 64 | return state, sum(self.rewards), done, {} 65 | 66 | def camera_adjust(self): 67 | self.camera.move_and_look_at(0,1.2,1.2, 0,0,0.5) 68 | 69 | class RoboschoolInvertedPendulum(RoboschoolMujocoXmlEnv): 70 | ''' 71 | Continuous control version of classic cartpole problem. 72 | Keep a pole upright by moving the 1-D cart. 73 | Similar to MuJoCo InvertedPendulum task. Has an optional version 74 | where the pole starts pointing downward and needs to be swung up and kept that way. 75 | ''' 76 | def __init__(self, swingup=False): 77 | self.swingup = swingup 78 | RoboschoolMujocoXmlEnv.__init__(self, 'inverted_pendulum.xml', 'cart', action_dim=1, obs_dim=5) 79 | 80 | def create_single_player_scene(self): 81 | return SingleRobotEmptyScene(gravity=9.8, timestep=0.0165, frame_skip=1) 82 | 83 | def robot_specific_reset(self): 84 | self.pole = self.parts["pole"] 85 | self.slider = self.jdict["slider"] 86 | self.j1 = self.jdict["hinge"] 87 | u = self.np_random.uniform(low=-.1, high=.1) 88 | self.j1.reset_current_position( u if not self.swingup else 3.1415+u , 0) 89 | self.j1.set_motor_torque(0) 90 | 91 | def apply_action(self, a): 92 | assert( np.isfinite(a).all() ) 93 | self.slider.set_motor_torque( 100*float(np.clip(a[0], -1, +1)) ) 94 | 95 | def calc_state(self): 96 | self.theta, theta_dot = self.j1.current_position() 97 | x, vx = self.slider.current_position() 98 | assert( np.isfinite(x) ) 99 | return np.array([ 100 | x, vx, 101 | np.cos(self.theta), np.sin(self.theta), theta_dot 102 | ]) 103 | 104 | def step(self, a): 105 | self.apply_action(a) 106 | self.scene.global_step() 107 | state = self.calc_state() # sets self.pos_x self.pos_y 108 | vel_penalty = 0 109 | if self.swingup: 110 | reward = np.cos(self.theta) 111 | done = False 112 | else: 113 | reward = 1.0 114 | done = np.abs(self.theta) > .2 115 | self.rewards = [float(reward)] 116 | self.frame += 1 117 | self.done += done # 2 == 1+True 118 | self.reward += sum(self.rewards) 119 | self.HUD(state, a, done) 120 | return state, sum(self.rewards), done, {} 121 | 122 | def camera_adjust(self): 123 | self.camera.move_and_look_at(0,1.2,1.0, 0,0,0.5) 124 | 125 | class RoboschoolInvertedPendulumSwingup(RoboschoolInvertedPendulum): 126 | swingup = True 127 | 128 | -------------------------------------------------------------------------------- /roboschool/gym_pong_trainservers.py: -------------------------------------------------------------------------------- 1 | import os, sys, subprocess 2 | import gym, roboschool 3 | import roboschool.multiplayer 4 | import numpy as np 5 | import random 6 | 7 | servers_to_start = 4 # set to CPU count (real cores, hyperthreading vCPUs/2) 8 | 9 | if len(sys.argv) in [1,2]: 10 | # Without parameters, this script runs itself servers_to_start times, with game id and adversary policy script from agent_zoo. 11 | if len(sys.argv)==2: 12 | servers_to_start = int(sys.argv[1]) 13 | skilled_adversaries = [] 14 | zoo_path = os.path.join(os.path.dirname(__file__), "../agent_zoo") 15 | for f in os.listdir(zoo_path): 16 | if not f.startswith("RoboschoolPong"): continue 17 | skilled_adversaries.append(os.path.join(zoo_path, f)) 18 | random.shuffle(skilled_adversaries) 19 | skilled_adversaries_count = len(skilled_adversaries) 20 | 21 | proclist = [] 22 | for i in range(servers_to_start): 23 | run_myself = [sys.executable, sys.argv[0], "pong_training%02i" % i, skilled_adversaries[i % skilled_adversaries_count]] 24 | print("EXEC %s" % " ".join(run_myself)) 25 | proclist.append( subprocess.Popen(run_myself) ) 26 | 27 | # Subprocesses work here, until one of players disconnects. 28 | # 29 | # After servers fire up, start here your training. 30 | # Play with all started adversaries simultaneously using one shared policy, apply joined gradient to your weights. 31 | # (manually in different console, or write startup code here.) 32 | 33 | for p in proclist: 34 | p.wait() 35 | 36 | elif len(sys.argv)==3: 37 | game_server_guid = sys.argv[1] 38 | adversary_script = sys.argv[2] 39 | 40 | game = roboschool.gym_pong.PongSceneMultiplayer() 41 | gameserver = roboschool.multiplayer.SharedMemoryServer(game, game_server_guid, want_test_window=False) 42 | # Shared memory files and pipes are ready here 43 | 44 | run_adv = [sys.executable, adversary_script, game_server_guid, "0"] # plays for player 0, connect your agent as player 1 45 | print("EXEC %s" % " ".join(run_adv)) 46 | subprocess.Popen(run_adv) 47 | # Adversary script must support two command line parameters: game_server_guid and player_n. 48 | # Inside, it must call: 49 | # env.unwrapped.multiplayer(env, game_server_guid, int(player_n)) 50 | 51 | gameserver.serve_forever() 52 | 53 | else: 54 | raise ValueError("run this script with zero parameters or 3 parameters") 55 | -------------------------------------------------------------------------------- /roboschool/gym_reacher.py: -------------------------------------------------------------------------------- 1 | from roboschool.scene_abstract import SingleRobotEmptyScene 2 | from roboschool.gym_mujoco_xml_env import RoboschoolMujocoXmlEnv 3 | import gym, gym.spaces, gym.utils, gym.utils.seeding 4 | import numpy as np 5 | import os, sys 6 | 7 | class RoboschoolReacher(RoboschoolMujocoXmlEnv): 8 | ''' 9 | Get the end of two-link robotic arm to a given spot. 10 | Similar to MuJoCo reacher. 11 | ''' 12 | def __init__(self): 13 | RoboschoolMujocoXmlEnv.__init__(self, 'reacher.xml', 'body0', action_dim=2, obs_dim=9) 14 | 15 | def create_single_player_scene(self): 16 | return SingleRobotEmptyScene(gravity=0.0, timestep=0.0165, frame_skip=1) 17 | 18 | TARG_LIMIT = 0.27 19 | def robot_specific_reset(self): 20 | self.jdict["target_x"].reset_current_position(self.np_random.uniform( low=-self.TARG_LIMIT, high=self.TARG_LIMIT ), 0) 21 | self.jdict["target_y"].reset_current_position(self.np_random.uniform( low=-self.TARG_LIMIT, high=self.TARG_LIMIT ), 0) 22 | self.fingertip = self.parts["fingertip"] 23 | self.target = self.parts["target"] 24 | self.central_joint = self.jdict["joint0"] 25 | self.elbow_joint = self.jdict["joint1"] 26 | self.central_joint.reset_current_position(self.np_random.uniform( low=-3.14, high=3.14 ), 0) 27 | self.elbow_joint.reset_current_position(self.np_random.uniform( low=-3.14, high=3.14 ), 0) 28 | 29 | def apply_action(self, a): 30 | assert( np.isfinite(a).all() ) 31 | self.central_joint.set_motor_torque( 0.05*float(np.clip(a[0], -1, +1)) ) 32 | self.elbow_joint.set_motor_torque( 0.05*float(np.clip(a[1], -1, +1)) ) 33 | 34 | def calc_state(self): 35 | theta, self.theta_dot = self.central_joint.current_relative_position() 36 | self.gamma, self.gamma_dot = self.elbow_joint.current_relative_position() 37 | target_x, _ = self.jdict["target_x"].current_position() 38 | target_y, _ = self.jdict["target_y"].current_position() 39 | self.to_target_vec = np.array(self.fingertip.pose().xyz()) - np.array(self.target.pose().xyz()) 40 | return np.array([ 41 | target_x, 42 | target_y, 43 | self.to_target_vec[0], 44 | self.to_target_vec[1], 45 | np.cos(theta), 46 | np.sin(theta), 47 | self.theta_dot, 48 | self.gamma, 49 | self.gamma_dot, 50 | ]) 51 | 52 | def calc_potential(self): 53 | return -100 * np.linalg.norm(self.to_target_vec) 54 | 55 | def step(self, a): 56 | assert(not self.scene.multiplayer) 57 | self.apply_action(a) 58 | self.scene.global_step() 59 | 60 | state = self.calc_state() # sets self.to_target_vec 61 | 62 | potential_old = self.potential 63 | self.potential = self.calc_potential() 64 | 65 | electricity_cost = ( 66 | -0.10*(np.abs(a[0]*self.theta_dot) + np.abs(a[1]*self.gamma_dot)) # work torque*angular_velocity 67 | -0.01*(np.abs(a[0]) + np.abs(a[1])) # stall torque require some energy 68 | ) 69 | stuck_joint_cost = -0.1 if np.abs(np.abs(self.gamma)-1) < 0.01 else 0.0 70 | self.rewards = [float(self.potential - potential_old), float(electricity_cost), float(stuck_joint_cost)] 71 | self.frame += 1 72 | self.done += 0 73 | self.reward += sum(self.rewards) 74 | self.HUD(state, a, False) 75 | return state, sum(self.rewards), False, {} 76 | 77 | def camera_adjust(self): 78 | x, y, z = self.fingertip.pose().xyz() 79 | x *= 0.5 80 | y *= 0.5 81 | self.camera.move_and_look_at(0.3, 0.3, 0.3, x, y, z) 82 | -------------------------------------------------------------------------------- /roboschool/gym_urdf_robot_env.py: -------------------------------------------------------------------------------- 1 | import gym, gym.spaces, gym.utils, gym.utils.seeding 2 | from roboschool.scene_abstract import cpp_household 3 | import numpy as np 4 | import os 5 | 6 | class RoboschoolUrdfEnv(gym.Env): 7 | """ 8 | Base class for URDF robot actor in a Scene. 9 | """ 10 | 11 | metadata = { 12 | 'render.modes': ['human', 'rgb_array'], 13 | 'video.frames_per_second': 60 14 | } 15 | 16 | VIDEO_W = 600 # for video showing the robot, not for camera ON the robot 17 | VIDEO_H = 400 18 | 19 | def __init__(self, model_urdf, robot_name, action_dim, obs_dim, fixed_base, self_collision): 20 | self.scene = None 21 | 22 | high = np.ones([action_dim]) 23 | self.action_space = gym.spaces.Box(-high, high) 24 | high = np.inf*np.ones([obs_dim]) 25 | self.observation_space = gym.spaces.Box(-high, high) 26 | self.seed() 27 | 28 | self.model_urdf = model_urdf 29 | self.fixed_base = fixed_base 30 | self.self_collision = self_collision 31 | self.robot_name = robot_name 32 | 33 | def seed(self, seed=None): 34 | self.np_random, seed = gym.utils.seeding.np_random(seed) 35 | return [seed] 36 | 37 | def reset(self): 38 | if self.scene is None: 39 | self.scene = self.create_single_player_scene() 40 | if not self.scene.multiplayer: 41 | self.scene.episode_restart() 42 | 43 | pose = cpp_household.Pose() 44 | #import time 45 | #t1 = time.time() 46 | self.urdf = self.scene.cpp_world.load_urdf( 47 | os.path.join(os.path.dirname(__file__), "models_robot", self.model_urdf), 48 | pose, 49 | self.fixed_base, 50 | self.self_collision) 51 | #t2 = time.time() 52 | #print("URDF load %0.2fms" % ((t2-t1)*1000)) 53 | 54 | self.ordered_joints = [] 55 | self.jdict = {} 56 | self.parts = {} 57 | self.frame = 0 58 | self.done = 0 59 | self.reward = 0 60 | dump = 0 61 | r = self.urdf 62 | self.cpp_robot = r 63 | if dump: print("ROBOT '%s'" % r.root_part.name) 64 | if r.root_part.name==self.robot_name: 65 | self.robot_body = r.root_part 66 | for part in r.parts: 67 | if dump: print("\tPART '%s'" % part.name) 68 | self.parts[part.name] = part 69 | if part.name==self.robot_name: 70 | self.robot_body = part 71 | for j in r.joints: 72 | if dump: print("\tALL JOINTS '%s' limits = %+0.2f..%+0.2f effort=%0.3f speed=%0.3f" % ((j.name,) + j.limits()) ) 73 | if j.name[:6]=="ignore": 74 | j.set_motor_torque(0) 75 | continue 76 | j.power_coef, j.max_velocity = j.limits()[2:4] 77 | self.ordered_joints.append(j) 78 | self.jdict[j.name] = j 79 | #print("ordered_joints", len(self.ordered_joints)) 80 | self.robot_specific_reset() 81 | self.cpp_robot.query_position() 82 | s = self.calc_state() # optimization: calc_state() can calculate something in self.* for calc_potential() to use 83 | self.potential = self.calc_potential() 84 | self.camera = self.scene.cpp_world.new_camera_free_float(self.VIDEO_W, self.VIDEO_H, "video_camera") 85 | return s 86 | 87 | def render(self, mode='human'): 88 | if mode=="human": 89 | self.scene.human_render_detected = True 90 | return self.scene.cpp_world.test_window() 91 | elif mode=="rgb_array": 92 | self.camera_adjust() 93 | rgb, _, _, _, _ = self.camera.render(False, False, False) # render_depth, render_labeling, print_timing) 94 | rendered_rgb = np.fromstring(rgb, dtype=np.uint8).reshape( (self.VIDEO_H,self.VIDEO_W,3) ) 95 | return rendered_rgb 96 | else: 97 | assert(0) 98 | 99 | def calc_potential(self): 100 | return 0 101 | 102 | def HUD(self, s, a, done): 103 | active = self.scene.actor_is_active(self) 104 | if active and self.done<=2: 105 | self.scene.cpp_world.test_window_history_advance() 106 | self.scene.cpp_world.test_window_observations(s.tolist()) 107 | self.scene.cpp_world.test_window_actions(a.tolist()) 108 | self.scene.cpp_world.test_window_rewards(self.rewards) 109 | if self.done<=1: # Only post score on first time done flag is seen, keep this score if user continues to use env 110 | s = "%04i %07.1f %s" % (self.frame, self.reward, "DONE" if self.done else "") 111 | if active: 112 | self.scene.cpp_world.test_window_score(s) 113 | #self.camera.test_window_score(s) # will appear on video ("rgb_array"), but not on cameras istalled on the robot (because that would be different camera) 114 | 115 | -------------------------------------------------------------------------------- /roboschool/models_household/ball.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /roboschool/models_household/bottle/bottle.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /roboschool/models_household/bottle/glass_tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_household/bottle/glass_tex.png -------------------------------------------------------------------------------- /roboschool/models_household/bottle/glasscontent_tex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_household/bottle/glasscontent_tex.jpg -------------------------------------------------------------------------------- /roboschool/models_household/bottle/potionbottleglass.mtl: -------------------------------------------------------------------------------- 1 | newmtl bottlemat 2 | Ka 0.000000 0.000000 0.000000 3 | Kd 1.000000 1.000000 1.000000 0.5 4 | Ks 0.000000 0.000000 0.000000 5 | d 1.000000 6 | illum 2 7 | Ns 0.000000 8 | map_Kd glass_tex.png 9 | -------------------------------------------------------------------------------- /roboschool/models_household/bottle/potionbottlesolid.mtl: -------------------------------------------------------------------------------- 1 | newmtl solidpart 2 | Ka 0.000000 0.000000 0.000000 3 | Kd 1.000000 1.000000 1.000000 4 | Ks 0.000000 0.000000 0.000000 5 | d 1.000000 6 | illum 2 7 | Ns 0.000000 8 | map_Kd glasscontent_tex.jpg 9 | -------------------------------------------------------------------------------- /roboschool/models_household/cube.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/dinnerware.mtl: -------------------------------------------------------------------------------- 1 | newmtl porcelain 2 | Ka 0.000000 0.000000 0.000000 3 | Kd 1.000000 1.000000 1.000000 4 | Ks 0.200000 0.200000 0.200000 5 | d 1.000000 6 | illum 2 7 | Ns 0.000000 8 | 9 | newmtl solid_color 10 | Ka 0.000000 0.000000 0.000000 11 | Kd 1.000000 1.000000 1.000000 12 | Ks 0.200000 0.200000 0.200000 13 | d 1.000000 14 | illum 2 15 | Ns 0.000000 16 | 17 | newmtl pan_tefal 18 | Ka 0.000000 0.000000 0.000000 19 | Kd 0.609804 0.494118 0.486275 20 | Ks 0.330000 0.330000 0.330000 21 | map_Kd pan_tefal.jpg 22 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/pan_tefal-collision01.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v 0.066236 0.112453 0.075000 4 | v 0.070225 0.121633 0.075000 5 | v 0.063600 0.110158 0.000000 6 | v 0.060950 0.105568 0.000000 7 | v 0.131811 0.001125 0.075750 8 | v 0.141855 0.000000 0.075750 9 | v 0.128472 0.000000 0.000000 10 | v 0.123119 0.000000 0.000000 11 | vn 0.166577 -0.705775 0.688573 12 | vn -0.727212 0.200240 0.656556 13 | vn 0.637357 -0.756451 -0.146827 14 | vn -0.340753 -0.711716 0.614286 15 | vn 0.122979 0.860640 0.494141 16 | vn 0.770289 -0.238643 0.591358 17 | vn -0.635571 -0.120420 0.762594 18 | vn -0.070367 0.649517 -0.757084 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 4//4 8//8 24 | f 1//1 5//5 6//6 25 | f 1//1 8//8 5//5 26 | f 2//2 3//3 4//4 27 | f 2//2 7//7 3//3 28 | f 2//2 5//5 6//6 29 | f 2//2 6//6 7//7 30 | f 3//3 7//7 4//4 31 | f 3//3 8//8 4//4 32 | f 3//3 7//7 8//8 33 | f 4//4 8//8 5//5 34 | f 4//4 7//7 8//8 35 | f 5//5 8//8 6//6 36 | f 6//6 8//8 7//7 37 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/pan_tefal-collision02.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v -0.064269 0.113589 0.075000 4 | v -0.070225 0.121633 0.075000 5 | v -0.063600 0.110158 0.000000 6 | v -0.060950 0.105568 0.000000 7 | v 0.064932 0.114714 0.075750 8 | v 0.070927 0.122850 0.075750 9 | v 0.064236 0.111260 0.000000 10 | v 0.061560 0.106624 0.000000 11 | vn -0.693799 -0.019731 0.719898 12 | vn -0.782132 -0.410509 0.468776 13 | vn 0.057085 0.837906 0.542821 14 | vn 0.549444 0.695908 -0.462410 15 | vn -0.488898 0.761278 -0.425951 16 | vn 0.527121 -0.833525 0.165465 17 | vn 0.764499 0.413217 0.494766 18 | vn -0.190845 -0.280421 -0.940714 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 4//4 8//8 24 | f 1//1 5//5 6//6 25 | f 1//1 8//8 5//5 26 | f 2//2 3//3 4//4 27 | f 2//2 7//7 3//3 28 | f 2//2 5//5 6//6 29 | f 2//2 6//6 7//7 30 | f 3//3 7//7 4//4 31 | f 3//3 8//8 4//4 32 | f 3//3 7//7 8//8 33 | f 4//4 8//8 5//5 34 | f 4//4 7//7 8//8 35 | f 5//5 8//8 6//6 36 | f 6//6 8//8 7//7 37 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/pan_tefal-collision03.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v -0.130506 0.001136 0.075000 4 | v -0.140450 0.000000 0.075000 5 | v -0.127200 0.000000 0.000000 6 | v -0.121900 0.000000 0.000000 7 | v -0.066879 0.113589 0.075750 8 | v -0.070927 0.122850 0.075750 9 | v -0.064236 0.111260 0.000000 10 | v -0.061559 0.106624 0.000000 11 | vn -0.005755 -0.840864 -0.541216 12 | vn -0.393829 -0.423425 0.815849 13 | vn 0.855454 0.357218 -0.374959 14 | vn -0.535483 -0.042852 -0.843458 15 | vn 0.593436 -0.341238 0.728966 16 | vn -0.684303 -0.643863 0.342301 17 | vn -0.543719 -0.112982 0.831628 18 | vn -0.432322 -0.733068 0.525080 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 4//4 8//8 24 | f 1//1 5//5 6//6 25 | f 1//1 8//8 5//5 26 | f 2//2 3//3 4//4 27 | f 2//2 7//7 3//3 28 | f 2//2 5//5 6//6 29 | f 2//2 6//6 7//7 30 | f 3//3 7//7 4//4 31 | f 3//3 8//8 4//4 32 | f 3//3 7//7 8//8 33 | f 4//4 8//8 5//5 34 | f 4//4 7//7 8//8 35 | f 5//5 8//8 6//6 36 | f 6//6 8//8 7//7 37 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/pan_tefal-collision04.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v -0.066236 -0.112453 0.075000 4 | v -0.070225 -0.121633 0.075000 5 | v -0.063600 -0.110158 0.000000 6 | v -0.060950 -0.105568 0.000000 7 | v -0.131811 -0.001125 0.075750 8 | v -0.141855 0.000000 0.075750 9 | v -0.128472 0.000000 0.000000 10 | v -0.123119 0.000000 0.000000 11 | vn -0.706733 -0.191066 0.681192 12 | vn 0.444900 -0.691793 0.568758 13 | vn 0.088502 0.609907 0.787515 14 | vn -0.441942 -0.815296 0.374139 15 | vn -0.595750 0.064829 0.800549 16 | vn -0.683770 -0.459760 -0.566639 17 | vn -0.132581 -0.607583 0.783112 18 | vn -0.220415 -0.970551 0.097201 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 4//4 8//8 24 | f 1//1 5//5 6//6 25 | f 1//1 8//8 5//5 26 | f 2//2 3//3 4//4 27 | f 2//2 7//7 3//3 28 | f 2//2 5//5 6//6 29 | f 2//2 6//6 7//7 30 | f 3//3 7//7 4//4 31 | f 3//3 8//8 4//4 32 | f 3//3 7//7 8//8 33 | f 4//4 8//8 5//5 34 | f 4//4 7//7 8//8 35 | f 5//5 8//8 6//6 36 | f 6//6 8//8 7//7 37 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/pan_tefal-collision05.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v 0.064269 -0.113589 0.075000 4 | v 0.070225 -0.121633 0.075000 5 | v 0.063600 -0.110158 0.000000 6 | v 0.060950 -0.105568 0.000000 7 | v -0.064932 -0.114714 0.075750 8 | v -0.070927 -0.122850 0.075750 9 | v -0.064236 -0.111260 0.000000 10 | v -0.061560 -0.106624 0.000000 11 | vn 0.337731 -0.812635 0.474934 12 | vn -0.151863 -0.910103 0.385551 13 | vn -0.786673 0.591186 -0.177887 14 | vn 0.661692 0.712532 0.233371 15 | vn -0.904799 0.159708 -0.394757 16 | vn 0.641963 -0.023667 -0.766370 17 | vn -0.472889 -0.878846 0.063294 18 | vn 0.722857 0.565784 -0.396694 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 4//4 8//8 24 | f 1//1 5//5 6//6 25 | f 1//1 8//8 5//5 26 | f 2//2 3//3 4//4 27 | f 2//2 7//7 3//3 28 | f 2//2 5//5 6//6 29 | f 2//2 6//6 7//7 30 | f 3//3 7//7 4//4 31 | f 3//3 8//8 4//4 32 | f 3//3 7//7 8//8 33 | f 4//4 8//8 5//5 34 | f 4//4 7//7 8//8 35 | f 5//5 8//8 6//6 36 | f 6//6 8//8 7//7 37 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/pan_tefal-collision06.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v 0.130506 -0.001136 0.075000 4 | v 0.140450 -0.000000 0.075000 5 | v 0.127200 -0.000000 0.000000 6 | v 0.121900 -0.000000 0.000000 7 | v 0.066879 -0.113589 0.075750 8 | v 0.070927 -0.122850 0.075750 9 | v 0.064236 -0.111260 0.000000 10 | v 0.061560 -0.106624 0.000000 11 | vn -0.793944 -0.586742 -0.159329 12 | vn 0.466324 0.641735 -0.608867 13 | vn -0.911102 -0.220305 -0.348365 14 | vn -0.616532 -0.769008 0.168863 15 | vn -0.642390 0.561142 0.521973 16 | vn -0.527497 0.482140 0.699491 17 | vn -0.264570 0.491705 0.829596 18 | vn -0.595670 0.662065 0.454804 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 4//4 8//8 24 | f 1//1 5//5 6//6 25 | f 1//1 8//8 5//5 26 | f 2//2 3//3 4//4 27 | f 2//2 7//7 3//3 28 | f 2//2 5//5 6//6 29 | f 2//2 6//6 7//7 30 | f 3//3 7//7 4//4 31 | f 3//3 8//8 4//4 32 | f 3//3 7//7 8//8 33 | f 4//4 8//8 5//5 34 | f 4//4 7//7 8//8 35 | f 5//5 8//8 6//6 36 | f 6//6 8//8 7//7 37 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/pan_tefal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_household/dinnerware/pan_tefal.jpg -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/pan_tefal.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/plate-collision01.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v 0.049745 0.084455 0.060000 4 | v 0.051940 0.089963 0.060000 5 | v 0.029150 0.050489 0.000000 6 | v 0.027560 0.047735 0.000000 7 | v 0.098993 0.000845 0.060600 8 | v 0.104919 0.000000 0.060600 9 | v 0.058883 0.000000 0.000000 10 | v 0.055671 0.000000 0.000000 11 | vn -0.962255 -0.069189 0.263208 12 | vn 0.888900 -0.266051 0.372926 13 | vn -0.704117 -0.151605 -0.693711 14 | vn -0.096471 -0.952673 -0.288284 15 | vn 0.353510 0.535276 0.767144 16 | vn 0.049583 0.551162 -0.832924 17 | vn -0.080990 0.081838 -0.993349 18 | vn 0.250326 0.614585 -0.748080 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 5//5 6//6 24 | f 2//2 3//3 4//4 25 | f 2//2 7//7 3//3 26 | f 2//2 5//5 6//6 27 | f 2//2 6//6 7//7 28 | f 3//3 7//7 4//4 29 | f 3//3 8//8 4//4 30 | f 3//3 7//7 8//8 31 | f 4//4 8//8 5//5 32 | f 4//4 7//7 8//8 33 | f 5//5 8//8 6//6 34 | f 6//6 8//8 7//7 35 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/plate-collision02.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v -0.048268 0.085308 0.060000 4 | v -0.051940 0.089963 0.060000 5 | v -0.029150 0.050489 0.000000 6 | v -0.027560 0.047735 0.000000 7 | v 0.048765 0.086152 0.060600 8 | v 0.052459 0.090862 0.060600 9 | v 0.029442 0.050994 0.000000 10 | v 0.027836 0.048213 0.000000 11 | vn -0.471567 -0.127056 -0.872629 12 | vn 0.616670 0.313448 -0.722127 13 | vn 0.434277 -0.589449 -0.681141 14 | vn -0.696898 0.673938 -0.245235 15 | vn -0.964280 0.142499 -0.223288 16 | vn -0.118273 0.245678 -0.962109 17 | vn 0.333505 0.310546 -0.890133 18 | vn 0.592935 -0.751851 -0.288355 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 5//5 6//6 24 | f 2//2 3//3 4//4 25 | f 2//2 7//7 3//3 26 | f 2//2 5//5 6//6 27 | f 2//2 6//6 7//7 28 | f 3//3 7//7 4//4 29 | f 3//3 8//8 4//4 30 | f 3//3 7//7 8//8 31 | f 4//4 8//8 5//5 32 | f 4//4 7//7 8//8 33 | f 5//5 8//8 6//6 34 | f 6//6 8//8 7//7 35 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/plate-collision03.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v -0.098012 0.000853 0.060000 4 | v -0.103880 0.000000 0.060000 5 | v -0.058300 0.000000 0.000000 6 | v -0.055120 0.000000 0.000000 7 | v -0.050228 0.085308 0.060600 8 | v -0.052459 0.090862 0.060600 9 | v -0.029441 0.050994 0.000000 10 | v -0.027836 0.048213 0.000000 11 | vn -0.570326 0.565919 -0.595368 12 | vn -0.987481 0.122113 -0.099846 13 | vn 0.256877 0.509622 0.821157 14 | vn -0.149510 -0.272737 0.950401 15 | vn 0.250981 -0.885212 0.391675 16 | vn 0.623883 0.757497 -0.192269 17 | vn 0.116527 -0.876135 -0.467769 18 | vn -0.474452 0.562082 -0.677466 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 5//5 6//6 24 | f 2//2 3//3 4//4 25 | f 2//2 7//7 3//3 26 | f 2//2 5//5 6//6 27 | f 2//2 6//6 7//7 28 | f 3//3 7//7 4//4 29 | f 3//3 8//8 4//4 30 | f 3//3 7//7 8//8 31 | f 4//4 8//8 5//5 32 | f 4//4 7//7 8//8 33 | f 5//5 8//8 6//6 34 | f 6//6 8//8 7//7 35 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/plate-collision04.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v -0.049745 -0.084455 0.060000 4 | v -0.051940 -0.089963 0.060000 5 | v -0.029150 -0.050489 0.000000 6 | v -0.027560 -0.047735 0.000000 7 | v -0.098993 -0.000845 0.060600 8 | v -0.104919 0.000000 0.060600 9 | v -0.058883 0.000000 0.000000 10 | v -0.055671 0.000000 0.000000 11 | vn -0.454516 0.625342 -0.634321 12 | vn -0.518286 -0.578386 0.629959 13 | vn -0.173259 0.226757 -0.958417 14 | vn -0.247982 -0.510538 -0.823320 15 | vn -0.417030 0.446958 0.791400 16 | vn -0.004783 -0.717725 -0.696310 17 | vn 0.273713 0.103751 0.956199 18 | vn 0.429490 0.309534 -0.848367 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 5//5 6//6 24 | f 2//2 3//3 4//4 25 | f 2//2 7//7 3//3 26 | f 2//2 5//5 6//6 27 | f 2//2 6//6 7//7 28 | f 3//3 7//7 4//4 29 | f 3//3 8//8 4//4 30 | f 3//3 7//7 8//8 31 | f 4//4 8//8 5//5 32 | f 4//4 7//7 8//8 33 | f 5//5 8//8 6//6 34 | f 6//6 8//8 7//7 35 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/plate-collision05.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v 0.048268 -0.085308 0.060000 4 | v 0.051940 -0.089963 0.060000 5 | v 0.029150 -0.050489 0.000000 6 | v 0.027560 -0.047735 0.000000 7 | v -0.048765 -0.086152 0.060600 8 | v -0.052459 -0.090862 0.060600 9 | v -0.029442 -0.050994 0.000000 10 | v -0.027836 -0.048213 0.000000 11 | vn 0.404852 0.441710 0.800617 12 | vn -0.882548 -0.029017 0.469326 13 | vn 0.182767 0.981935 0.048984 14 | vn -0.768458 0.392626 -0.505290 15 | vn 0.592713 0.805382 -0.007215 16 | vn 0.400028 0.869068 0.291031 17 | vn -0.642772 0.691166 0.330355 18 | vn 0.104670 0.652086 -0.750885 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 5//5 6//6 24 | f 2//2 3//3 4//4 25 | f 2//2 7//7 3//3 26 | f 2//2 5//5 6//6 27 | f 2//2 6//6 7//7 28 | f 3//3 7//7 4//4 29 | f 3//3 8//8 4//4 30 | f 3//3 7//7 8//8 31 | f 4//4 8//8 5//5 32 | f 4//4 7//7 8//8 33 | f 5//5 8//8 6//6 34 | f 6//6 8//8 7//7 35 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/plate-collision06.obj: -------------------------------------------------------------------------------- 1 | mtllib dinnerware.mtl 2 | usemtl pan_tefal 3 | v 0.098012 -0.000853 0.060000 4 | v 0.103880 -0.000000 0.060000 5 | v 0.058300 -0.000000 0.000000 6 | v 0.055120 -0.000000 0.000000 7 | v 0.050228 -0.085308 0.060600 8 | v 0.052459 -0.090862 0.060600 9 | v 0.029442 -0.050994 0.000000 10 | v 0.027836 -0.048213 0.000000 11 | vn 0.692885 0.707963 -0.136739 12 | vn 0.408978 0.907585 0.095006 13 | vn -0.212286 -0.468709 0.857465 14 | vn 0.297056 -0.618852 0.727172 15 | vn 0.708170 0.492350 -0.506050 16 | vn 0.745762 -0.289343 -0.600100 17 | vn 0.808951 0.000863 -0.587876 18 | vn 0.926527 0.350079 -0.137811 19 | f 1//1 2//2 4//4 20 | f 1//1 5//5 2//2 21 | f 1//1 6//6 2//2 22 | f 1//1 4//4 5//5 23 | f 1//1 5//5 6//6 24 | f 2//2 3//3 4//4 25 | f 2//2 7//7 3//3 26 | f 2//2 5//5 6//6 27 | f 2//2 6//6 7//7 28 | f 3//3 7//7 4//4 29 | f 3//3 8//8 4//4 30 | f 3//3 7//7 8//8 31 | f 4//4 8//8 5//5 32 | f 4//4 7//7 8//8 33 | f 5//5 8//8 6//6 34 | f 6//6 8//8 7//7 35 | -------------------------------------------------------------------------------- /roboschool/models_household/dinnerware/plate.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /roboschool/models_household/duck/duckCM.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_household/duck/duckCM.jpg -------------------------------------------------------------------------------- /roboschool/models_household/joypad/joypad.mtl: -------------------------------------------------------------------------------- 1 | # Wavefront MTL file 2 | # Creator: Ultimate Unwrap3D Pro v3.47 3 | # URL: http://www.unwrap3d.com 4 | # Time: Mon Jan 13 10:41:58 2014 5 | # num_materials: 1 6 | 7 | newmtl joypad_mat 8 | Ka 0.000000 0.000000 0.000000 9 | Kd 1.000000 1.000000 1.000000 10 | Ks 0.600000 0.600000 0.600000 11 | d 1.000000 12 | illum 2 13 | Ns 0.000000 14 | map_Kd joypad_tex.jpg 15 | 16 | # num_materials: 1 17 | -------------------------------------------------------------------------------- /roboschool/models_household/joypad/joypad_tex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_household/joypad/joypad_tex.jpg -------------------------------------------------------------------------------- /roboschool/models_household/keyboard/keyboard.mtl: -------------------------------------------------------------------------------- 1 | # Wavefront MTL file 2 | # Creator: Ultimate Unwrap3D Pro v3.47 3 | # URL: http://www.unwrap3d.com 4 | # Time: Tue Jan 14 13:52:18 2014 5 | # num_materials: 1 6 | 7 | newmtl keyboard_mat 8 | Ka 0.000000 0.000000 0.000000 9 | Kd 1.000000 1.000000 1.000000 10 | Ks 0.200000 0.200000 0.200000 11 | d 1.000000 12 | illum 2 13 | Ns 0.000000 14 | map_Kd keyboard_tex.jpg 15 | 16 | # num_materials: 1 17 | -------------------------------------------------------------------------------- /roboschool/models_household/keyboard/keyboard_tex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_household/keyboard/keyboard_tex.jpg -------------------------------------------------------------------------------- /roboschool/models_household/tablelamp/tablelamp-collision00.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 64 124 0 3 | 0.645888 -1.8539 0.147036 4 | -0.0699812 -1.8539 -1.31016 5 | -0.0699812 -1.75153 -1.31016 6 | -0.811507 -1.75153 -0.108687 7 | 0.108777 -1.34253 -0.364409 8 | 0.799157 -1.75158 -0.798718 9 | -0.274563 -1.8539 0.377102 10 | -0.785851 -1.8539 -0.824206 11 | -0.0699812 -1.34253 -0.568652 12 | -0.0444923 -1.726 0.40259 13 | -0.632582 -1.726 -1.02878 14 | 0.773668 -1.726 -0.0830307 15 | 0.824814 -1.8539 -0.722085 16 | 0.389993 -1.726 -1.20787 17 | 0.364504 -1.726 0.325957 18 | -0.55578 -1.726 0.19818 19 | -0.837164 -1.726 -0.568652 20 | -0.121294 -1.34253 -0.389898 21 | -0.811507 -1.8539 -0.108687 22 | 0.134265 -1.34253 -0.466363 23 | 0.85047 -1.726 -0.389898 24 | 0.569086 -1.8539 -1.10558 25 | -0.351198 -1.726 -1.23336 26 | 0.262213 -1.8539 0.377102 27 | 0.645888 -1.726 -1.00346 28 | -0.0190034 -1.34253 -0.313265 29 | -0.606925 -1.8539 -1.07993 30 | 0.594743 -1.726 0.172692 31 | 0.824814 -1.8539 -0.185487 32 | -0.300052 -1.726 0.351613 33 | -0.785851 -1.726 -0.798718 34 | 0.057631 -1.34253 -0.568652 35 | 0.108777 -1.726 -1.28451 36 | 0.338848 -1.8539 -1.25902 37 | -0.55578 -1.8539 0.223668 38 | 0.799157 -1.726 -0.747573 39 | -0.862653 -1.8539 -0.517507 40 | -0.785851 -1.726 -0.108687 41 | -0.121294 -1.34253 -0.517507 42 | -0.837164 -1.726 -0.338753 43 | -0.121294 -1.726 -1.28451 44 | -0.325709 -1.8539 -1.25902 45 | -0.658071 -1.726 0.0958911 46 | 0.057631 -1.726 0.40259 47 | 0.364504 -1.75153 0.351613 48 | 0.85047 -1.726 -0.491851 49 | 0.543597 -1.726 -1.10558 50 | 0.799157 -1.75158 -0.0830307 51 | 0.85047 -1.8539 -0.313265 52 | 0.134265 -1.8539 0.40259 53 | -0.862653 -1.75153 -0.364409 54 | 0.799157 -1.726 -0.134175 55 | 0.671377 -1.8539 -1.00346 56 | -0.402343 -1.75153 0.325957 57 | -0.581269 -1.726 -1.07993 58 | 0.338848 -1.75153 -1.25902 59 | 0.313359 -1.726 0.351613 60 | 0.08312 -1.75153 -1.31016 61 | 0.08312 -1.34253 -0.338753 62 | -0.658071 -1.75153 0.121379 63 | 0.364504 -1.8539 0.351613 64 | 0.594743 -1.75158 0.19818 65 | -0.811507 -1.75153 -0.773062 66 | 0.338848 -1.726 -1.23336 67 | 3 13 55 63 68 | 3 1 0 6 69 | 3 1 6 7 70 | 3 0 1 12 71 | 3 4 8 17 72 | 3 7 6 18 73 | 3 8 4 19 74 | 3 12 1 21 75 | 3 6 0 23 76 | 3 4 17 25 77 | 3 17 15 25 78 | 3 1 7 26 79 | 3 7 10 26 80 | 3 11 4 27 81 | 3 0 12 28 82 | 3 6 9 29 83 | 3 9 25 29 84 | 3 25 15 29 85 | 3 8 19 31 86 | 3 19 24 31 87 | 3 8 31 32 88 | 3 21 1 33 89 | 3 18 6 34 90 | 3 5 24 35 91 | 3 24 19 35 92 | 3 7 18 36 93 | 3 8 10 38 94 | 3 17 8 38 95 | 3 16 17 38 96 | 3 10 30 38 97 | 3 30 16 38 98 | 3 17 16 39 99 | 3 3 37 39 100 | 3 37 17 39 101 | 3 2 22 40 102 | 3 22 8 40 103 | 3 32 2 40 104 | 3 8 32 40 105 | 3 2 1 41 106 | 3 22 2 41 107 | 3 1 26 41 108 | 3 26 22 41 109 | 3 15 17 42 110 | 3 37 3 42 111 | 3 17 37 42 112 | 3 25 9 43 113 | 3 27 14 44 114 | 3 12 5 45 115 | 3 19 20 45 116 | 3 5 35 45 117 | 3 35 19 45 118 | 3 24 21 46 119 | 3 13 31 46 120 | 3 31 24 46 121 | 3 11 27 47 122 | 3 0 28 47 123 | 3 47 28 48 124 | 3 28 12 48 125 | 3 12 45 48 126 | 3 45 20 48 127 | 3 20 47 48 128 | 3 9 6 49 129 | 3 6 23 49 130 | 3 43 9 49 131 | 3 23 44 49 132 | 3 44 43 49 133 | 3 18 3 50 134 | 3 16 36 50 135 | 3 36 18 50 136 | 3 39 16 50 137 | 3 3 39 50 138 | 3 4 11 51 139 | 3 19 4 51 140 | 3 20 19 51 141 | 3 11 47 51 142 | 3 47 20 51 143 | 3 5 12 52 144 | 3 12 21 52 145 | 3 24 5 52 146 | 3 21 24 52 147 | 3 6 29 53 148 | 3 29 15 53 149 | 3 15 34 53 150 | 3 34 6 53 151 | 3 10 8 54 152 | 3 8 22 54 153 | 3 26 10 54 154 | 3 22 26 54 155 | 3 21 33 55 156 | 3 46 21 55 157 | 3 13 46 55 158 | 3 25 43 56 159 | 3 44 14 56 160 | 3 43 44 56 161 | 3 1 2 57 162 | 3 2 32 57 163 | 3 33 1 57 164 | 3 32 55 57 165 | 3 55 33 57 166 | 3 4 25 58 167 | 3 27 4 58 168 | 3 14 27 58 169 | 3 56 14 58 170 | 3 25 56 58 171 | 3 3 18 59 172 | 3 34 15 59 173 | 3 18 34 59 174 | 3 15 42 59 175 | 3 42 3 59 176 | 3 23 0 60 177 | 3 44 23 60 178 | 3 44 60 61 179 | 3 27 44 61 180 | 3 47 27 61 181 | 3 0 47 61 182 | 3 60 0 61 183 | 3 10 7 62 184 | 3 30 10 62 185 | 3 16 30 62 186 | 3 36 16 62 187 | 3 7 36 62 188 | 3 31 13 63 189 | 3 32 31 63 190 | 3 55 32 63 191 | -------------------------------------------------------------------------------- /roboschool/models_household/tablelamp/tablelamp-collision01.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 44 84 0 3 | 0.0321539 1.8539 -0.287531 4 | -0.2746 1.49565 -0.210788 5 | -0.2746 1.49565 -0.185207 6 | 0.134423 -1.34248 -0.440917 7 | -0.0444689 1.72593 -0.696627 8 | 0.262285 1.6233 -0.185207 9 | -0.121197 -1.34248 -0.51761 10 | -0.018928 -1.34248 -0.313062 11 | 0.262285 1.59796 -0.466448 12 | -0.2746 1.6233 -0.440917 13 | 0.0577474 -1.34248 -0.568722 14 | 0.0577474 1.72593 -0.696627 15 | -0.121197 -1.34248 -0.389805 16 | 0.0321539 1.13772 -0.185207 17 | -0.146738 1.77662 -0.185207 18 | 0.0832884 -1.34248 -0.338693 19 | -0.0700625 -1.34248 -0.568722 20 | 0.262285 1.44465 -0.185207 21 | 0.185557 1.80258 -0.389805 22 | -0.146738 1.82824 -0.364224 23 | 0.108882 -1.34248 -0.51761 24 | 0.185557 1.75158 -0.185207 25 | -0.172331 1.21437 -0.185207 26 | -0.249007 1.72593 -0.415386 27 | 0.262285 1.52131 -0.466448 28 | 0.00661296 1.8539 -0.389805 29 | -0.0444689 1.64927 -0.696627 30 | -0.0700625 -1.34248 -0.338693 31 | 0.108882 -1.34248 -0.364224 32 | -0.249007 1.67462 -0.210788 33 | 0.160016 1.18903 -0.185207 34 | -0.2746 1.57199 -0.440917 35 | 0.00661296 -1.34248 -0.313062 36 | 0.262285 1.67462 -0.415386 37 | 0.0577474 1.67462 -0.696627 38 | 0.134423 -1.34248 -0.466448 39 | -0.018928 1.82824 -0.210788 40 | 0.0832884 1.8539 -0.364224 41 | -0.018928 1.75158 -0.671046 42 | 0.211151 1.77662 -0.338693 43 | -0.197872 1.77662 -0.287531 44 | -0.0700625 1.8539 -0.313062 45 | 0.108882 1.82824 -0.262 46 | 0.262285 1.44465 -0.262 47 | 3 35 24 43 48 | 3 2 1 6 49 | 3 6 3 7 50 | 3 1 2 9 51 | 3 3 6 10 52 | 3 2 6 12 53 | 3 6 7 12 54 | 3 5 2 13 55 | 3 2 5 14 56 | 3 7 3 15 57 | 3 10 6 16 58 | 3 8 5 17 59 | 3 5 13 17 60 | 3 3 10 20 61 | 3 14 5 21 62 | 3 2 7 22 63 | 3 13 2 22 64 | 3 7 13 22 65 | 3 4 9 23 66 | 3 19 4 23 67 | 3 11 8 24 68 | 3 8 17 24 69 | 3 9 4 26 70 | 3 4 11 26 71 | 3 16 6 26 72 | 3 10 16 26 73 | 3 7 2 27 74 | 3 2 12 27 75 | 3 12 7 27 76 | 3 15 3 28 77 | 3 3 17 28 78 | 3 17 15 28 79 | 3 9 2 29 80 | 3 2 14 29 81 | 3 23 9 29 82 | 3 17 13 30 83 | 3 6 1 31 84 | 3 1 9 31 85 | 3 9 26 31 86 | 3 26 6 31 87 | 3 13 7 32 88 | 3 7 15 32 89 | 3 15 17 32 90 | 3 30 13 32 91 | 3 17 30 32 92 | 3 5 8 33 93 | 3 8 11 33 94 | 3 11 18 33 95 | 3 20 10 34 96 | 3 11 24 34 97 | 3 24 20 34 98 | 3 10 26 34 99 | 3 26 11 34 100 | 3 17 3 35 101 | 3 3 20 35 102 | 3 20 24 35 103 | 3 14 21 36 104 | 3 18 11 37 105 | 3 25 0 37 106 | 3 25 37 38 107 | 3 11 4 38 108 | 3 4 19 38 109 | 3 19 25 38 110 | 3 37 11 38 111 | 3 21 5 39 112 | 3 5 33 39 113 | 3 33 18 39 114 | 3 14 19 40 115 | 3 19 23 40 116 | 3 29 14 40 117 | 3 23 29 40 118 | 3 19 14 41 119 | 3 0 25 41 120 | 3 25 19 41 121 | 3 36 0 41 122 | 3 14 36 41 123 | 3 0 36 42 124 | 3 36 21 42 125 | 3 18 37 42 126 | 3 37 0 42 127 | 3 21 39 42 128 | 3 39 18 42 129 | 3 24 17 43 130 | 3 17 35 43 131 | -------------------------------------------------------------------------------- /roboschool/models_household/tablelamp/tablelamp-collision02.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 64 124 0 3 | -0.274713 1.54703 -0.185062 4 | 0.645903 1.138 1.01656 5 | 0.645903 1.08685 1.01656 6 | -0.60699 1.26568 1.11891 7 | -0.146808 0.549776 0.658555 8 | 0.083346 1.64932 1.29791 9 | 0.262313 1.59818 -0.185062 10 | 0.160064 1.16351 -0.185062 11 | -0.121277 1.77712 -0.133815 12 | 0.466811 0.70321 0.735208 13 | -0.60699 0.882399 0.888659 14 | -0.146808 1.16351 -0.185062 15 | 0.466811 1.49576 1.22111 16 | -0.300244 1.59818 1.27221 17 | 0.134408 1.77712 -0.185062 18 | 0.160064 0.549776 0.709657 19 | -0.453555 0.677699 0.735208 20 | 0.594716 0.856766 0.837557 21 | -0.530272 1.41899 1.14446 22 | 0.339031 1.52128 1.27221 23 | 0.594716 1.31682 1.04211 24 | -0.632647 1.138 0.939906 25 | -0.249057 1.64932 -0.185062 26 | 0.236782 1.62369 1.27221 27 | 0.236782 0.57541 0.658555 28 | 0.262313 1.41899 -0.185062 29 | -0.044559 1.80275 -0.159366 30 | -0.249057 1.39348 -0.185062 31 | 0.0578151 0.549776 0.633004 32 | -0.223526 1.62369 1.29791 33 | 0.236782 1.67483 -0.185062 34 | -0.58146 0.856766 0.888659 35 | -0.274713 0.57541 0.684106 36 | -0.172339 1.75161 -0.185062 37 | -0.58146 0.856766 0.812006 38 | -0.58146 1.34233 1.04211 39 | -0.325775 1.52128 1.27221 40 | 0.594716 0.856766 0.888659 41 | -0.428024 1.52128 1.22111 42 | 0.645903 1.11237 0.965457 43 | 0.0578151 1.80275 -0.159366 44 | -0.0700899 1.64932 1.29791 45 | -0.0956208 0.984566 0.965457 46 | -0.146808 0.549776 0.709657 47 | 0.569185 1.36797 1.14446 48 | 0.313375 0.600921 0.684106 49 | -0.60699 0.882399 0.863108 50 | 0.339031 1.57242 1.27221 51 | 0.492342 0.728843 0.812006 52 | -0.274713 1.49576 -0.185062 53 | 0.262313 1.57242 1.29791 54 | 0.620247 0.958932 0.888659 55 | -0.632647 1.03583 0.991008 56 | -0.402493 0.652065 0.760904 57 | -0.197995 1.72598 -0.185062 58 | -0.044559 0.549776 0.633004 59 | 0.032159 1.138 -0.159366 60 | -0.632647 1.18902 1.01656 61 | 0.594716 1.26568 1.11876 62 | 0.466811 1.49576 1.14446 63 | -0.479211 1.47013 1.22111 64 | 0.645903 1.138 0.991008 65 | -0.249057 0.57541 0.658555 66 | -0.172339 1.21453 -0.185062 67 | 3 34 27 63 68 | 3 0 6 7 69 | 3 0 7 11 70 | 3 6 0 14 71 | 3 9 7 17 72 | 3 14 0 22 73 | 3 0 21 22 74 | 3 7 6 25 75 | 3 17 7 25 76 | 3 0 11 27 77 | 3 15 4 28 78 | 3 7 24 28 79 | 3 24 15 28 80 | 3 8 13 29 81 | 3 26 8 29 82 | 3 6 14 30 83 | 3 10 16 31 84 | 3 16 11 32 85 | 3 13 8 33 86 | 3 14 22 33 87 | 3 8 26 33 88 | 3 26 14 33 89 | 3 3 18 35 90 | 3 2 19 37 91 | 3 13 33 38 92 | 3 33 18 38 93 | 3 1 2 39 94 | 3 25 6 39 95 | 3 5 23 40 96 | 3 23 14 40 97 | 3 26 5 40 98 | 3 14 26 40 99 | 3 5 26 41 100 | 3 29 5 41 101 | 3 26 29 41 102 | 3 19 36 42 103 | 3 36 31 42 104 | 3 15 37 42 105 | 3 37 19 42 106 | 3 4 15 43 107 | 3 32 4 43 108 | 3 15 42 43 109 | 3 42 31 43 110 | 3 1 20 44 111 | 3 20 30 44 112 | 3 7 9 45 113 | 3 24 7 45 114 | 3 15 24 45 115 | 3 16 10 46 116 | 3 34 16 46 117 | 3 12 14 47 118 | 3 19 12 47 119 | 3 14 23 47 120 | 3 9 17 48 121 | 3 37 15 48 122 | 3 17 37 48 123 | 3 45 9 48 124 | 3 15 45 48 125 | 3 21 0 49 126 | 3 0 27 49 127 | 3 27 34 49 128 | 3 46 21 49 129 | 3 34 46 49 130 | 3 23 5 50 131 | 3 5 29 50 132 | 3 29 36 50 133 | 3 36 19 50 134 | 3 19 47 50 135 | 3 47 23 50 136 | 3 17 25 51 137 | 3 2 37 51 138 | 3 37 17 51 139 | 3 39 2 51 140 | 3 25 39 51 141 | 3 10 31 52 142 | 3 36 3 52 143 | 3 31 36 52 144 | 3 46 10 52 145 | 3 21 46 52 146 | 3 31 16 53 147 | 3 16 32 53 148 | 3 43 31 53 149 | 3 32 43 53 150 | 3 18 33 54 151 | 3 33 22 54 152 | 3 35 18 54 153 | 3 22 35 54 154 | 3 4 11 55 155 | 3 28 4 55 156 | 3 28 55 56 157 | 3 11 7 56 158 | 3 7 28 56 159 | 3 55 11 56 160 | 3 22 21 57 161 | 3 3 35 57 162 | 3 35 22 57 163 | 3 52 3 57 164 | 3 21 52 57 165 | 3 2 1 58 166 | 3 19 2 58 167 | 3 12 19 58 168 | 3 1 44 58 169 | 3 44 12 58 170 | 3 14 12 59 171 | 3 30 14 59 172 | 3 12 44 59 173 | 3 44 30 59 174 | 3 18 3 60 175 | 3 29 13 60 176 | 3 3 36 60 177 | 3 36 29 60 178 | 3 38 18 60 179 | 3 13 38 60 180 | 3 20 1 61 181 | 3 6 30 61 182 | 3 30 20 61 183 | 3 1 39 61 184 | 3 39 6 61 185 | 3 11 4 62 186 | 3 4 32 62 187 | 3 32 11 62 188 | 3 11 16 63 189 | 3 27 11 63 190 | 3 16 34 63 191 | -------------------------------------------------------------------------------- /roboschool/models_household/tablelamp/tablelamp.obj.mtl: -------------------------------------------------------------------------------- 1 | # 2 | # Wavefront material file 3 | # Converted by Meshlab Group 4 | # 5 | 6 | newmtl material_0 7 | Ka 0.200000 0.200000 0.200000 8 | Kd 1.000000 1.000000 1.000000 9 | Ks 1.000000 1.000000 1.000000 10 | Tr 0.992157 11 | illum 2 12 | Ns 0.000000 13 | map_Kd tablelamptex.jpg 14 | 15 | -------------------------------------------------------------------------------- /roboschool/models_household/tablelamp/tablelamptex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_household/tablelamp/tablelamptex.jpg -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox-collision00.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 15 26 0 3 | -0.909953 -0.151388 0.607276 4 | -0.997138 -0.409053 -0.69707 5 | -1.00507 -0.401083 -0.701065 6 | -0.905967 -0.151388 -0.709053 7 | -0.905967 -0.409053 0.607276 8 | -1.00904 -0.151363 0.607276 9 | -1.00904 -0.397097 0.607276 10 | -1.00904 -0.151388 -0.69707 11 | -0.905967 -0.409053 -0.69707 12 | -0.997148 -0.409053 0.607276 13 | -1.00904 -0.397148 -0.69707 14 | -0.905978 -0.325763 0.607276 15 | -0.997138 -0.397122 -0.709053 16 | -0.997138 -0.151388 -0.709053 17 | -0.905967 -0.397122 -0.709053 18 | 3 8 12 14 19 | 3 0 3 5 20 | 3 4 0 5 21 | 3 4 5 6 22 | 3 6 5 7 23 | 3 3 4 8 24 | 3 4 1 8 25 | 3 1 4 9 26 | 3 4 6 9 27 | 3 9 6 10 28 | 3 2 1 10 29 | 3 6 7 10 30 | 3 1 9 10 31 | 3 3 0 11 32 | 3 0 4 11 33 | 3 4 3 11 34 | 3 1 2 12 35 | 3 8 1 12 36 | 3 2 10 12 37 | 3 10 7 12 38 | 3 5 3 13 39 | 3 7 5 13 40 | 3 3 12 13 41 | 3 12 7 13 42 | 3 3 8 14 43 | 3 12 3 14 44 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox-collision01.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 14 24 0 3 | -1.00896 -0.397122 0.607276 4 | 0.905967 -0.151364 0.710362 5 | 0.905967 -0.397122 0.710362 6 | 0.905967 -0.325763 0.607276 7 | -0.99696 -0.151364 0.710362 8 | -1.00896 -0.151364 0.607276 9 | -0.99696 -0.397122 0.710362 10 | 0.905967 -0.151364 0.611241 11 | 0.905967 -0.409053 0.607276 12 | -0.99696 -0.409053 0.698465 13 | 0.905967 -0.409053 0.698465 14 | -0.99696 -0.409053 0.607276 15 | -1.00896 -0.397122 0.698465 16 | -1.00896 -0.151364 0.698465 17 | 3 5 12 13 18 | 3 1 2 3 19 | 3 2 1 4 20 | 3 4 1 5 21 | 3 3 0 5 22 | 3 2 4 6 23 | 3 1 3 7 24 | 3 5 1 7 25 | 3 3 5 7 26 | 3 3 2 8 27 | 3 0 3 8 28 | 3 2 6 9 29 | 3 9 8 10 30 | 3 8 2 10 31 | 3 2 9 10 32 | 3 0 8 11 33 | 3 9 0 11 34 | 3 8 9 11 35 | 3 5 0 12 36 | 3 6 4 12 37 | 3 0 9 12 38 | 3 9 6 12 39 | 3 4 5 13 40 | 3 12 4 13 41 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox-collision02.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 14 24 0 3 | -0.90578 -0.409053 -0.697139 4 | 1.00887 -0.151364 -0.605988 5 | 1.00887 -0.397122 -0.605988 6 | 0.997056 -0.151364 -0.709053 7 | -0.90578 -0.151364 -0.609952 8 | -0.90578 -0.151364 -0.709053 9 | 0.997056 -0.397122 -0.709053 10 | -0.90578 -0.409053 -0.605988 11 | -0.90578 -0.397122 -0.709053 12 | 0.997056 -0.409053 -0.697139 13 | 0.997056 -0.409053 -0.605988 14 | -0.90578 -0.325763 -0.605988 15 | 1.00887 -0.397122 -0.697139 16 | 1.00887 -0.151364 -0.697139 17 | 3 12 3 13 18 | 3 1 3 4 19 | 3 0 4 5 20 | 3 4 3 5 21 | 3 5 3 6 22 | 3 2 1 7 23 | 3 4 0 7 24 | 3 0 5 8 25 | 3 6 0 8 26 | 3 5 6 8 27 | 3 0 6 9 28 | 3 7 0 9 29 | 3 7 9 10 30 | 3 2 7 10 31 | 3 9 2 10 32 | 3 1 4 11 33 | 3 7 1 11 34 | 3 4 7 11 35 | 3 1 2 12 36 | 3 6 3 12 37 | 3 9 6 12 38 | 3 2 9 12 39 | 3 3 1 13 40 | 3 1 12 13 41 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox-collision03.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 14 24 0 3 | 1.00904 -0.151338 0.698379 4 | 0.905978 -0.409053 -0.605967 5 | 0.905978 -0.325755 -0.605967 6 | 0.905967 -0.151364 0.710362 7 | 0.997153 -0.409053 0.698379 8 | 1.00905 -0.151364 -0.605967 9 | 1.00905 -0.397121 -0.605967 10 | 0.905967 -0.409053 0.698379 11 | 0.909943 -0.151364 -0.605967 12 | 1.00904 -0.397096 0.698379 13 | 0.997153 -0.409053 -0.605967 14 | 0.997153 -0.397146 0.710362 15 | 0.905967 -0.397146 0.710362 16 | 0.997153 -0.151364 0.710362 17 | 3 3 11 13 18 | 3 1 2 5 19 | 3 5 0 6 20 | 3 1 5 6 21 | 3 2 1 7 22 | 3 3 2 7 23 | 3 1 4 7 24 | 3 2 3 8 25 | 3 3 0 8 26 | 3 5 2 8 27 | 3 0 5 8 28 | 3 6 0 9 29 | 3 4 6 9 30 | 3 4 1 10 31 | 3 6 4 10 32 | 3 1 6 10 33 | 3 7 4 11 34 | 3 9 0 11 35 | 3 4 9 11 36 | 3 3 7 12 37 | 3 11 3 12 38 | 3 7 11 12 39 | 3 0 3 13 40 | 3 11 0 13 41 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox-collision04.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 15 26 0 3 | -1.00896 0.395776 -0.697148 4 | -0.0179388 0.407705 -0.621828 5 | -0.0179388 0.395776 -0.609933 6 | -0.0179388 -0.151338 -0.709053 7 | -1.00896 -0.151338 -0.605977 8 | -0.997119 -0.151338 -0.709043 9 | -0.0179388 -0.151338 -0.609933 10 | -0.0179388 0.395776 -0.709053 11 | -0.997119 0.407705 -0.605977 12 | -0.997119 0.395776 -0.709043 13 | -0.997119 0.407705 -0.697148 14 | -0.0179388 0.407705 -0.697158 15 | -1.00896 0.395776 -0.605977 16 | -1.00896 -0.151338 -0.697148 17 | -0.909894 -0.151338 -0.605977 18 | 3 8 4 14 19 | 3 1 2 3 20 | 3 3 4 5 21 | 3 3 2 6 22 | 3 4 3 6 23 | 3 1 3 7 24 | 3 3 5 7 25 | 3 2 1 8 26 | 3 5 0 9 27 | 3 7 5 9 28 | 3 8 1 10 29 | 3 0 8 10 30 | 3 9 0 10 31 | 3 7 9 10 32 | 3 1 7 11 33 | 3 10 1 11 34 | 3 7 10 11 35 | 3 0 4 12 36 | 3 8 0 12 37 | 3 4 8 12 38 | 3 4 0 13 39 | 3 0 5 13 40 | 3 5 4 13 41 | 3 6 2 14 42 | 3 4 6 14 43 | 3 2 8 14 44 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox-collision05.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 12 20 0 3 | -0.921837 0.407705 0.607276 4 | -1.00905 -0.151338 -0.605967 5 | -1.00905 0.395776 -0.605967 6 | -0.909932 -0.151338 -0.605967 7 | -1.00905 -0.151338 0.607276 8 | -0.909932 -0.151338 0.607276 9 | -0.909932 0.395776 -0.605967 10 | -1.00905 0.395776 0.607276 11 | -0.909932 0.395776 0.607276 12 | -0.997158 0.407705 -0.605967 13 | -0.921837 0.407705 -0.605967 14 | -0.997148 0.407705 0.607276 15 | 3 9 7 11 16 | 3 1 2 3 17 | 3 2 1 4 18 | 3 1 3 4 19 | 3 0 4 5 20 | 3 4 3 5 21 | 3 3 2 6 22 | 3 5 3 6 23 | 3 4 0 7 24 | 3 2 4 7 25 | 3 0 5 8 26 | 3 6 0 8 27 | 3 5 6 8 28 | 3 6 2 9 29 | 3 2 7 9 30 | 3 0 6 10 31 | 3 9 0 10 32 | 3 6 9 10 33 | 3 7 0 11 34 | 3 0 9 11 35 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox-collision06.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 15 26 0 3 | -0.0178418 -0.151338 0.611241 4 | 0.997092 0.407705 0.698465 5 | 0.997092 0.395776 0.710362 6 | 1.00905 -0.151338 0.607276 7 | 0.997092 -0.151338 0.710362 8 | -0.0178418 0.395776 0.710352 9 | -0.0178418 0.395776 0.611241 10 | -0.0178418 -0.151338 0.710352 11 | 0.997092 0.407705 0.607276 12 | -0.0178418 0.407705 0.698465 13 | 1.00905 0.395776 0.698455 14 | -0.0178418 0.407705 0.623138 15 | 1.00905 -0.151338 0.698465 16 | 1.00905 0.395776 0.607276 17 | 0.909842 -0.151338 0.607276 18 | 3 6 8 14 19 | 3 0 3 4 20 | 3 4 2 5 21 | 3 0 5 6 22 | 3 0 4 7 23 | 3 4 5 7 24 | 3 5 0 7 25 | 3 2 1 9 26 | 3 5 2 9 27 | 3 6 5 9 28 | 3 1 8 9 29 | 3 1 2 10 30 | 3 8 1 10 31 | 3 8 6 11 32 | 3 6 9 11 33 | 3 9 8 11 34 | 3 4 3 12 35 | 3 2 4 12 36 | 3 10 2 12 37 | 3 3 10 12 38 | 3 3 8 13 39 | 3 10 3 13 40 | 3 8 10 13 41 | 3 3 0 14 42 | 3 0 6 14 43 | 3 8 3 14 44 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox-collision07.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 15 26 0 3 | -1.00896 -0.151338 0.607276 4 | -0.0179388 0.407705 0.698465 5 | -0.0179388 0.395776 0.710352 6 | -0.0179388 -0.151338 0.611241 7 | -0.997119 -0.151338 0.710362 8 | -0.997119 0.407705 0.607276 9 | -0.997119 0.395776 0.710362 10 | -0.0179388 -0.151338 0.710352 11 | -0.0179388 0.395776 0.611241 12 | -1.00896 0.395776 0.698465 13 | -0.997119 0.407705 0.698465 14 | -0.0179388 0.407705 0.623138 15 | -1.00896 -0.151338 0.698465 16 | -1.00896 0.395776 0.607276 17 | -0.909894 -0.151338 0.607276 18 | 3 5 8 14 19 | 3 1 2 3 20 | 3 0 3 4 21 | 3 2 1 6 22 | 3 4 2 6 23 | 3 3 2 7 24 | 3 4 3 7 25 | 3 2 4 7 26 | 3 1 3 8 27 | 3 4 6 9 28 | 3 9 6 10 29 | 3 1 5 10 30 | 3 6 1 10 31 | 3 5 9 10 32 | 3 5 1 11 33 | 3 1 8 11 34 | 3 8 5 11 35 | 3 0 4 12 36 | 3 9 0 12 37 | 3 4 9 12 38 | 3 5 0 13 39 | 3 0 9 13 40 | 3 9 5 13 41 | 3 3 0 14 42 | 3 0 5 14 43 | 3 8 3 14 44 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox-collision08.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 15 26 0 3 | -0.0178418 -0.151338 -0.709053 4 | 0.997092 0.407705 -0.605988 5 | 1.00905 0.395776 -0.605977 6 | 0.997092 0.395776 -0.709043 7 | -0.0178418 0.407705 -0.62183 8 | 1.00905 -0.151338 -0.605988 9 | -0.0178418 -0.151338 -0.609933 10 | 0.997092 -0.151338 -0.709043 11 | -0.0178418 0.395776 -0.709053 12 | -0.0178418 0.395776 -0.609933 13 | 0.997092 0.407705 -0.697146 14 | 1.00905 0.395776 -0.697146 15 | -0.0178418 0.407705 -0.697157 16 | 1.00905 -0.151338 -0.697146 17 | 0.909842 -0.151338 -0.605988 18 | 3 9 6 14 19 | 3 0 5 6 20 | 3 4 0 6 21 | 3 0 3 7 22 | 3 5 0 7 23 | 3 3 0 8 24 | 3 0 4 8 25 | 3 1 4 9 26 | 3 4 6 9 27 | 3 1 2 10 28 | 3 4 1 10 29 | 3 3 8 10 30 | 3 2 5 11 31 | 3 7 3 11 32 | 3 10 2 11 33 | 3 3 10 11 34 | 3 8 4 12 35 | 3 4 10 12 36 | 3 10 8 12 37 | 3 5 7 13 38 | 3 11 5 13 39 | 3 7 11 13 40 | 3 2 1 14 41 | 3 5 2 14 42 | 3 6 5 14 43 | 3 1 9 14 44 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox-collision09.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 13 22 0 3 | 0.997158 0.407705 0.607217 4 | 0.909932 -0.151338 -0.605967 5 | 0.909932 0.308548 -0.605967 6 | 1.00905 -0.151338 -0.605967 7 | 0.909932 -0.151338 0.607217 8 | 1.00905 -0.151338 0.607217 9 | 1.00905 0.395776 -0.605967 10 | 0.909952 0.395776 0.607217 11 | 0.921837 0.407705 -0.605967 12 | 1.00905 0.395776 0.607217 13 | 0.909952 0.395776 -0.605967 14 | 0.997158 0.407705 -0.605967 15 | 0.921837 0.407705 0.607217 16 | 3 8 7 12 17 | 3 1 2 3 18 | 3 2 1 4 19 | 3 1 3 4 20 | 3 0 4 5 21 | 3 4 3 5 22 | 3 3 2 6 23 | 3 5 3 6 24 | 3 4 0 7 25 | 3 2 4 7 26 | 3 6 2 8 27 | 3 0 5 9 28 | 3 6 0 9 29 | 3 5 6 9 30 | 3 2 7 10 31 | 3 8 2 10 32 | 3 7 8 10 33 | 3 0 6 11 34 | 3 8 0 11 35 | 3 6 8 11 36 | 3 7 0 12 37 | 3 0 8 12 38 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox-collision10.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 8 12 0 3 | 0.905613 -0.325792 0.607157 4 | -0.905967 -0.409053 -0.605967 5 | -0.905967 -0.409053 0.607276 6 | 0.905967 -0.409053 -0.605967 7 | -0.905967 -0.325792 -0.605967 8 | 0.905967 -0.325792 -0.605967 9 | 0.90579 -0.409053 0.607157 10 | -0.905967 -0.325792 0.607276 11 | 3 2 6 7 12 | 3 2 1 3 13 | 3 1 2 4 14 | 3 3 1 4 15 | 3 4 0 5 16 | 3 3 4 5 17 | 3 2 3 6 18 | 3 5 0 6 19 | 3 3 5 6 20 | 3 0 4 7 21 | 3 4 2 7 22 | 3 6 0 7 23 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox.mtl: -------------------------------------------------------------------------------- 1 | # Wavefront MTL file 2 | # Creator: Ultimate Unwrap3D Pro v3.50.01 3 | # URL: http://www.unwrap3d.com 4 | # Time: Thu Jul 17 13:28:22 2014 5 | # num_materials: 1 6 | 7 | newmtl woodenboxmat 8 | Ka 0.000000 0.000000 0.000000 9 | Kd 1.000000 1.000000 1.000000 10 | Ks 0.000000 0.000000 0.000000 11 | d 1.000000 12 | illum 2 13 | Ns 0.000000 14 | map_Kd woodenbox_tex.jpg 15 | map_Bump woodenbox_NM.png 16 | 17 | # num_materials: 1 18 | -------------------------------------------------------------------------------- /roboschool/models_household/woodenbox/woodenbox_tex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_household/woodenbox/woodenbox_tex.jpg -------------------------------------------------------------------------------- /roboschool/models_household/zucchini/zucchini.mtl: -------------------------------------------------------------------------------- 1 | # Wavefront MTL file 2 | # Creator: Ultimate Unwrap3D Pro v3.47 3 | # URL: http://www.unwrap3d.com 4 | # Time: Sat Nov 30 11:13:04 2013 5 | # num_materials: 1 6 | 7 | newmtl NoName_1 8 | Ka 0.000000 0.000000 0.000000 9 | Kd 0.800000 0.800000 0.800000 10 | Ks 0.000000 0.000000 0.000000 11 | d 1.000000 12 | illum 2 13 | Ns 0.000000 14 | map_Kd zucchini_tex_green.jpg 15 | 16 | # num_materials: 1 17 | -------------------------------------------------------------------------------- /roboschool/models_household/zucchini/zucchini_tex_green.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_household/zucchini/zucchini_tex_green.jpg -------------------------------------------------------------------------------- /roboschool/models_outdoor/stadium/stadium.mtl: -------------------------------------------------------------------------------- 1 | newmtl stadium_white 2 | Ns 96.078431 3 | Ka 0.000000 0.000000 0.000000 4 | Kd 1.000000 1.000000 1.000000 5 | Ks 0.500000 0.500000 0.500000 6 | 7 | newmtl stadium_grass 8 | Ka 0.000000 0.000000 0.000000 9 | Kd 0.000000 0.500000 0.000000 10 | Ks 0.000000 0.000000 0.000000 11 | map_Kd stadium_grass.jpg 12 | 13 | newmtl stadium_dirt 14 | Ka 0.000000 0.000000 0.000000 15 | Kd 0.600000 0.400000 0.000000 16 | Ks 0.000000 0.000000 0.000000 17 | -------------------------------------------------------------------------------- /roboschool/models_outdoor/stadium/stadium_grass.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_outdoor/stadium/stadium_grass.jpg -------------------------------------------------------------------------------- /roboschool/models_robot/atlas_description/materials/textures/drc_extremities_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/atlas_description/materials/textures/drc_extremities_diffuse.jpg -------------------------------------------------------------------------------- /roboschool/models_robot/atlas_description/materials/textures/extremities_diffuse_unplugged.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/atlas_description/materials/textures/extremities_diffuse_unplugged.jpg -------------------------------------------------------------------------------- /roboschool/models_robot/atlas_description/materials/textures/right_leg_diffuse_unplugged.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/atlas_description/materials/textures/right_leg_diffuse_unplugged.jpg -------------------------------------------------------------------------------- /roboschool/models_robot/atlas_description/materials/textures/torso_diffuse_unplugged.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/atlas_description/materials/textures/torso_diffuse_unplugged.jpg -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/base_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/base_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/base_link_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/base_link_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/bellows_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/bellows_link.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/bellows_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/bellows_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/elbow_flex_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/elbow_flex_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/elbow_flex_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/elbow_flex_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/estop_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/estop_link.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/forearm_roll_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/forearm_roll_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/forearm_roll_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/forearm_roll_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/gripper_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/gripper_link.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/gripper_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/gripper_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/head_pan_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/head_pan_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/head_pan_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/head_pan_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/head_tilt_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/head_tilt_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/head_tilt_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/head_tilt_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/l_gripper_finger_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/l_gripper_finger_link.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/l_wheel_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/l_wheel_link.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/l_wheel_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/l_wheel_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/laser_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/laser_link.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/r_gripper_finger_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/r_gripper_finger_link.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/r_wheel_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/r_wheel_link.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/r_wheel_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/r_wheel_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/shoulder_lift_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/shoulder_lift_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/shoulder_lift_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/shoulder_lift_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/shoulder_pan_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/shoulder_pan_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/shoulder_pan_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/shoulder_pan_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/torso_fixed_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/torso_fixed_link.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/torso_fixed_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/torso_fixed_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/torso_lift_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/torso_lift_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/torso_lift_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/torso_lift_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/upperarm_roll_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/upperarm_roll_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/upperarm_roll_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/upperarm_roll_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/wrist_flex_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/wrist_flex_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/wrist_flex_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/wrist_flex_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/wrist_roll_link_collision.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/wrist_roll_link_collision.STL -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/meshes/wrist_roll_uv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/fetch_description/meshes/wrist_roll_uv.png -------------------------------------------------------------------------------- /roboschool/models_robot/fetch_description/robots/FETCH_MODIFICATIONS.md: -------------------------------------------------------------------------------- 1 | 2 | Original code taken from: 3 | 4 | https://github.com/fetchrobotics/fetch_ros 5 | 6 | Modifications: 7 | 8 | * Comment out `bellows_link` and `bellows_joint`. You can push off the ground using this strange thing! 9 | 10 | * Set moments of inertia of `r_gripper_finger_link` and `l_gripper_finger_link` to non-zero. 11 | 12 | * Set moments of inertia of `base_link` to zero, except for Z-axis, to disable rotation other than around Z axis. 13 | 14 | * Added `` for camera, turn `head_camera_rgb_optical_frame` 180 degrees as camera was facing backwards. 15 | 16 | * Spheres are now collision shape for wheels (fixes jumping). 17 | 18 | * Boxes for fingers collision shape. 19 | -------------------------------------------------------------------------------- /roboschool/models_robot/multisense_sl_description/materials/textures/drc_torso_head_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/roboschool/d32bcb2b35b94168b5ce27233ca62f3c8678886f/roboschool/models_robot/multisense_sl_description/materials/textures/drc_torso_head_diffuse.jpg -------------------------------------------------------------------------------- /roboschool/models_robot/roboschool_pong.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /roboschool/mujoco_assets/ant.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 72 | -------------------------------------------------------------------------------- /roboschool/mujoco_assets/ground_plane.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /roboschool/mujoco_assets/half_cheetah.xml: -------------------------------------------------------------------------------- 1 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 89 | -------------------------------------------------------------------------------- /roboschool/mujoco_assets/hopper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 40 | -------------------------------------------------------------------------------- /roboschool/mujoco_assets/inverted_double_pendulum.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 48 | -------------------------------------------------------------------------------- /roboschool/mujoco_assets/inverted_pendulum.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 28 | -------------------------------------------------------------------------------- /roboschool/mujoco_assets/reacher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 40 | -------------------------------------------------------------------------------- /roboschool/mujoco_assets/walker2d.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 53 | -------------------------------------------------------------------------------- /roboschool/scene_abstract.py: -------------------------------------------------------------------------------- 1 | # This is the only place cpp_household really imported. From other places, it is referenced as scene_abstract.cpp_household 2 | # If this doesn't work, the checklist is: 3 | # 1) Build local Bullet physics library (instructions in README) 4 | # 2) ldd cpp_household.so 5 | # 3) In case of python 2.7 when using pip2 install without -e, the C++ module gets built in python2.7/site-packages, 6 | # but when you have roboschool directory in cwd or in parent(s) of cwd, python2 will use that and fail to reach site-packages. 7 | # No such behavior in Python3. For example, no zoo scripts will work if you install without -e and run them from 8 | # source tree. If you copy zoo script elsewhere, it will work. (upgrade to Python3 if you can.) 9 | import sys, os 10 | sys.path.append(os.path.dirname(__file__)) 11 | #from roboschool import cpp_household_d as cpp_household # you can debug C++ code 12 | from roboschool import cpp_household as cpp_household 13 | 14 | import gym 15 | 16 | class Scene: 17 | "A base class for single- and multiplayer scenes" 18 | 19 | def __init__(self, gravity, timestep, frame_skip): 20 | self.np_random, seed = gym.utils.seeding.np_random(None) 21 | self.timestep = timestep 22 | self.frame_skip = frame_skip 23 | self.dt = self.timestep * self.frame_skip 24 | self.cpp_world = cpp_household.World(gravity, timestep) 25 | self.cpp_world.set_glsl_path(os.path.join(os.path.dirname(__file__), "cpp-household/glsl")) 26 | 27 | self.big_caption = self.cpp_world.test_window_big_caption # that's a function you can call 28 | self.console_print = self.cpp_world.test_window_print # this too 29 | 30 | self.test_window_still_open = True # or never opened 31 | self.human_render_detected = False # if user wants render("human"), we open test window 32 | 33 | self.multiplayer_robots = {} 34 | 35 | def test_window(self): 36 | "Call this function every frame, to see what's going on. Not necessary in learning." 37 | self.human_render_detected = True 38 | return self.test_window_still_open 39 | 40 | def actor_introduce(self, robot): 41 | "Usually after scene reset" 42 | if not self.multiplayer: return 43 | self.multiplayer_robots[robot.player_n] = robot 44 | 45 | def actor_is_active(self, robot): 46 | """ 47 | Used by robots to see if they are free to exclusiveley put their HUD on the test window. 48 | Later can be used for click-focus robots. 49 | """ 50 | return not self.multiplayer 51 | 52 | def episode_restart(self): 53 | "This function gets overridden by specific scene, to reset specific objects into their start positions" 54 | self.cpp_world.clean_everything() 55 | self.cpp_world.test_window_history_reset() 56 | 57 | def global_step(self): 58 | """ 59 | The idea is: apply motor torques for all robots, then call global_step(), then collect 60 | observations from robots using step() with the same action. 61 | """ 62 | if self.human_render_detected: 63 | self.test_window_still_open = self.cpp_world.test_window() 64 | self.cpp_world.step(self.frame_skip) 65 | 66 | class SingleRobotEmptyScene(Scene): 67 | multiplayer = False # this class is used "as is" for InvertedPundulum, Reacher 68 | -------------------------------------------------------------------------------- /roboschool/scene_stadium.py: -------------------------------------------------------------------------------- 1 | import os 2 | from roboschool.scene_abstract import Scene, cpp_household 3 | 4 | class StadiumScene(Scene): 5 | zero_at_running_strip_start_line = True # if False, center of coordinates (0,0,0) will be at the middle of the stadium 6 | stadium_halflen = 105*0.25 # FOOBALL_FIELD_HALFLEN 7 | stadium_halfwidth = 50*0.25 # FOOBALL_FIELD_HALFWID 8 | 9 | def episode_restart(self): 10 | Scene.episode_restart(self) # contains cpp_world.clean_everything() 11 | stadium_pose = cpp_household.Pose() 12 | if self.zero_at_running_strip_start_line: 13 | stadium_pose.set_xyz(27, 21, 0) # see RUN_STARTLINE, RUN_RAD constants 14 | self.stadium = self.cpp_world.load_thingy( 15 | os.path.join(os.path.dirname(__file__), "models_outdoor/stadium/stadium1.obj"), 16 | stadium_pose, 1.0, 0, 0xFFFFFF, True) 17 | self.ground_plane_mjcf = self.cpp_world.load_mjcf(os.path.join(os.path.dirname(__file__), "mujoco_assets/ground_plane.xml")) 18 | 19 | class SinglePlayerStadiumScene(StadiumScene): 20 | "This scene created by environment, to work in a way as if there was no concept of scene visible to user." 21 | multiplayer = False 22 | 23 | class MultiplayerStadiumScene(StadiumScene): 24 | multiplayer = True 25 | players_count = 3 26 | def actor_introduce(self, robot): 27 | StadiumScene.actor_introduce(self, robot) 28 | i = robot.player_n - 1 # 0 1 2 => -1 0 +1 29 | robot.move_robot(0, i, 0) 30 | -------------------------------------------------------------------------------- /roboschool/test_manual.py: -------------------------------------------------------------------------------- 1 | import roboschool, gym, gym.spaces, gym.utils, gym.utils.seeding 2 | import numpy as np 3 | import sys 4 | 5 | # 6 | # Run this file to test environments using manual control: 7 | # 8 | # python test_manual.py RoboschoolHopper-v0 9 | # 10 | 11 | class TestKeyboardControl: 12 | def __init__(self): 13 | self.keys = {} 14 | self.control = np.zeros(9) 15 | self.human_pause = False 16 | self.human_done = False 17 | def key(self, event_type, key, modifiers): 18 | self.keys[key] = +1 if event_type==6 else 0 19 | #print ("event_type", event_type, "key", key, "modifiers", modifiers) 20 | self.control[0] = self.keys.get(0x1000014, 0) - self.keys.get(0x1000012, 0) 21 | self.control[1] = self.keys.get(0x1000013, 0) - self.keys.get(0x1000015, 0) 22 | self.control[2] = self.keys.get(ord('A'), 0) - self.keys.get(ord('Z'), 0) 23 | self.control[3] = self.keys.get(ord('S'), 0) - self.keys.get(ord('X'), 0) 24 | self.control[4] = self.keys.get(ord('D'), 0) - self.keys.get(ord('C'), 0) 25 | self.control[5] = self.keys.get(ord('F'), 0) - self.keys.get(ord('V'), 0) 26 | self.control[6] = self.keys.get(ord('G'), 0) - self.keys.get(ord('B'), 0) 27 | self.control[7] = self.keys.get(ord('H'), 0) - self.keys.get(ord('N'), 0) 28 | self.control[8] = self.keys.get(ord('J'), 0) - self.keys.get(ord('M'), 0) 29 | if event_type==6 and key==32: # press Space to pause 30 | self.human_pause = 1 - self.human_pause 31 | if event_type==6 and key==0x1000004: # press Enter to restart 32 | self.human_done = True 33 | 34 | usage = """ 35 | This is manual test. Usage: 36 | %s 37 | 38 | Keyboard shortcuts: 39 | * F1 toggle slow motion 40 | * F2 toggle captions 41 | * F3 toggle HUD: observations, actions, reward 42 | * ENTER to restart episode (works only in this test) 43 | * SPACE to pause (works only in this test) 44 | * Up/down, left/right, a/z, s/x, d/c, f/v, g/b, h/n, j/m to control robot (works only in this test) 45 | """ 46 | 47 | def test(env_id): 48 | print(usage % sys.argv[0]) 49 | 50 | env = gym.make(env_id) 51 | ctrl = TestKeyboardControl() 52 | env.reset() # This creates default single player scene 53 | env.unwrapped.scene.cpp_world.set_key_callback(ctrl.key) 54 | if "camera" in env.unwrapped.__dict__: 55 | env.unwrapped.camera.set_key_callback(ctrl.key) 56 | 57 | a = np.zeros(env.action_space.shape) 58 | copy_n = min(len(a), len(ctrl.control)) 59 | ctrl.human_pause = False 60 | 61 | while 1: 62 | ctrl.human_done = False 63 | sn = env.reset() 64 | frame = 0 65 | reward = 0.0 66 | episode_over = False 67 | while 1: 68 | s = sn 69 | a[:copy_n] = ctrl.control[:copy_n] 70 | sn, rplus, done, info = env.step(a) 71 | reward += rplus 72 | #env.render("rgb_array") 73 | episode_over |= done 74 | still_visible = True 75 | while still_visible: 76 | still_visible = env.render("human") 77 | #env.unwrapped.camera.test_window() 78 | if not ctrl.human_pause: break 79 | if ctrl.human_done: break 80 | if not still_visible: break 81 | frame += 1 82 | if not still_visible: break 83 | 84 | if __name__=="__main__": 85 | env_id = "RoboschoolHumanoid-v0" if len(sys.argv) <= 1 else sys.argv[1] 86 | test(env_id) 87 | -------------------------------------------------------------------------------- /roboschool_compile_and_graft.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | function graft_libs { 5 | local libfile=$1 6 | local libdir=$(dirname $libfile) 7 | if [ $(uname) == 'Darwin' ]; then 8 | local relink="osx_relink" 9 | local origin="@loader_path" 10 | local deps=$(otool -L $libfile | awk 'FNR>2 {print $1}') 11 | fi 12 | if [ $(uname) == 'Linux' ]; then 13 | local relink="linux_relink" 14 | local library_lister="ldd" 15 | local origin="\$ORIGIN" 16 | local deps=$(ldd $libfile | awk '{print $3}') 17 | fi 18 | 19 | local patterns=${@:3} 20 | 21 | graft_dir=$2 22 | mkdir -p $graft_dir 23 | 24 | for dep in $deps; do 25 | # echo $dep 26 | for deppattern in $patterns; do 27 | if [[ "$dep" =~ $deppattern ]]; then 28 | new_depname=${dep##*/} 29 | new_deppath="$graft_dir/$new_depname" 30 | rel_path=$(realpath --relative-to="$libdir" $new_deppath) 31 | new_dep="$origin/$rel_path" 32 | echo "$libfile depends on $dep, relinking to $new_deppath ($new_dep)" 33 | $relink $dep $new_dep $libfile 34 | if [ ! -f $new_deppath ]; then 35 | echo "$new_deppath not found, copying and calling self" 36 | cp $dep $new_deppath 37 | chmod 777 $new_deppath 38 | graft_libs $new_deppath $graft_dir $patterns 39 | else 40 | echo "grafted library $new_deppath already exists" 41 | fi 42 | fi 43 | done 44 | done 45 | } 46 | 47 | function osx_relink { 48 | install_name_tool -change $1 $2 $3 49 | } 50 | 51 | function linux_relink { 52 | # local depname=${2#*/} 53 | local dep_dir=${2%/*} 54 | patchelf --set-rpath $dep_dir $3 55 | } 56 | 57 | cd $(dirname "$0") 58 | 59 | cd roboschool/cpp-household 60 | # make clean 61 | make -j4 62 | cd .. 63 | 64 | 65 | graft_libs cpp_household.so .libs \ 66 | ^/.+/libboost_python.+ \ 67 | ^/.+Qt.+ \ 68 | ^/.+/libassimp.+ \ 69 | ^/.+/libLinearMath.+ \ 70 | ^/.+/libBullet.+ \ 71 | ^/.+/libPhysicsClientC_API.+ \ 72 | ^/.+/libjpeg.+ \ 73 | ^/.+/libpng.+ \ 74 | ^/.+/libicu.+ \ 75 | ^/.+/libpcre.+ \ 76 | ^/.+/libdouble-conversion.+ \ 77 | ^/.+/libminizip.+ 78 | 79 | if [ $(uname) == 'Darwin' ]; then 80 | # HACK - this should auto-detect plugins dir 81 | cp -r /usr/local/Cellar/qt/5.10.1/plugins .qt_plugins 82 | lib_pattern="*.dylib" 83 | fi 84 | if [ $(uname) == 'Linux' ]; then 85 | cp -r /usr/lib/x86_64-linux-gnu/qt5/plugins .qt_plugins 86 | lib_pattern="*.so*" 87 | fi 88 | for lib in $(find .qt_plugins -name "$lib_pattern"); do 89 | graft_libs $lib .libs ^/.+Qt.+ \ 90 | ^/.+/libjpeg.+ \ 91 | ^/.+/libpng.+ \ 92 | ^/.+/libicu.+ \ 93 | ^/.+/libpcre.+ \ 94 | ^/.+/libdouble-conversion.+ \ 95 | ^/.+/libminizip.+ \ 96 | ^/.+/libxcb.+ \ 97 | ^/.+/libxkb.+ 98 | done 99 | 100 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | from setuptools import setup, Extension 3 | from setuptools.command.build_ext import build_ext 4 | import subprocess 5 | import sys, os 6 | import re 7 | 8 | dep = """ 9 | C++ dependencies for this project are: 10 | 11 | bullet 12 | tinyxml 13 | boost_python 14 | assimp 15 | Qt5 16 | 17 | If you see compilation error FIRST THING TO CHECK if pkg-config call was successful. 18 | Install dependencies that pkg-config cannot find. 19 | """ 20 | 21 | from setuptools.command.install import install as DistutilsInstall 22 | from setuptools.command.egg_info import egg_info as EggInfo 23 | 24 | setup_py_dir = os.path.dirname(os.path.realpath(__file__)) 25 | 26 | class CMakeExtension(Extension): 27 | def __init__(self, name, sourcedir=''): 28 | Extension.__init__(self, name, sources=[]) 29 | self.sourcedir = os.path.abspath(sourcedir) 30 | 31 | 32 | class Build(build_ext): 33 | def run(self): 34 | pass 35 | 36 | need_files = ['cpp_household.so'] 37 | hh = setup_py_dir + "/roboschool" 38 | need_files_ext = 'png jpg urdf obj mtl dae off stl STL xml glsl dylib'.split() 39 | need_files_re = [re.compile(r'.+\.'+p) for p in need_files_ext] 40 | need_files_re.append(re.compile(r'.+\.so(.\d+)*')) 41 | need_files_re.append(re.compile(r'.+/\.libs/.+')) 42 | need_files_re.append(re.compile(r'.+/\.qt_plugins/.+')) 43 | 44 | for root, dirs, files in os.walk(hh): 45 | for fn in files: 46 | fn = root + '/' + fn 47 | if any([p.match(fn) for p in need_files_re]): 48 | need_files.append(fn[1+len(hh):]) 49 | 50 | print("found resource files: %i" % len(need_files)) 51 | for n in need_files: print("-- %s" % n) 52 | 53 | setup( 54 | name = 'roboschool', 55 | version = '1.0.49', 56 | description = 'OpenAI Household Simulator: mobile manipulation using Bullet', 57 | maintainer = 'Oleg Klimov', 58 | maintainer_email = 'omgtech@gmail.com', 59 | url = 'https://github.com/openai/roboschool', 60 | packages=[x for x in find_packages()], 61 | ext_modules=[CMakeExtension('roboschool')], 62 | cmdclass={'build_ext': Build}, 63 | install_requires=['gym'], 64 | package_data = { '': need_files } 65 | ) 66 | -------------------------------------------------------------------------------- /test_wheel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | if [ $(uname) == 'Linux' ]; then 5 | docker run -v $PWD:/io python:${MB_PYTHON_VERSION} /io/docker_test_wheel.sh 6 | fi 7 | 8 | if [ $(uname) == 'Darwin' ]; then 9 | ./osx_test_wheel.sh 10 | fi 11 | --------------------------------------------------------------------------------