From 88668407126119a9d53a4da8670f8cd9ef2b685f Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Wed, 23 Aug 2017 15:03:57 -0700 Subject: [PATCH] Clarify in naming that the environment uses MJCF xml files with Bullet, it doesn't use MuJoCo. --- examples/pybullet/gym/pybullet_envs/env_bases.py | 2 +- .../gym/pybullet_envs/gym_locomotion_envs.py | 8 ++++---- .../pybullet/gym/pybullet_envs/gym_pendulum_envs.py | 12 ++++++------ examples/pybullet/gym/pybullet_envs/robot_bases.py | 2 +- .../pybullet/gym/pybullet_envs/robot_locomotors.py | 6 +++--- examples/pybullet/gym/pybullet_envs/robot_pendula.py | 10 +++++----- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/pybullet/gym/pybullet_envs/env_bases.py b/examples/pybullet/gym/pybullet_envs/env_bases.py index 573f7b284..e034c7252 100644 --- a/examples/pybullet/gym/pybullet_envs/env_bases.py +++ b/examples/pybullet/gym/pybullet_envs/env_bases.py @@ -3,7 +3,7 @@ import numpy as np import pybullet as p -class MujocoXmlBaseBulletEnv(gym.Env): +class MJCFBaseBulletEnv(gym.Env): """ Base class for MuJoCo .xml environments in a Scene. These environments create single-player scenes and behave like normal Gym environments, if diff --git a/examples/pybullet/gym/pybullet_envs/gym_locomotion_envs.py b/examples/pybullet/gym/pybullet_envs/gym_locomotion_envs.py index 32d040e02..662564a06 100644 --- a/examples/pybullet/gym/pybullet_envs/gym_locomotion_envs.py +++ b/examples/pybullet/gym/pybullet_envs/gym_locomotion_envs.py @@ -1,12 +1,12 @@ from .scene_stadium import SinglePlayerStadiumScene -from .env_bases import MujocoXmlBaseBulletEnv +from .env_bases import MJCFBaseBulletEnv import numpy as np from robot_locomotors import Hopper, Walker2D, HalfCheetah, Ant, Humanoid -class WalkerBaseBulletEnv(MujocoXmlBaseBulletEnv): +class WalkerBaseBulletEnv(MJCFBaseBulletEnv): def __init__(self, robot): - MujocoXmlBaseBulletEnv.__init__(self, robot) + MJCFBaseBulletEnv.__init__(self, robot) self.camera_x = 0 self.walk_target_x = 1e3 # kilometer away self.walk_target_y = 0 @@ -16,7 +16,7 @@ class WalkerBaseBulletEnv(MujocoXmlBaseBulletEnv): return self.stadium_scene def _reset(self): - r = MujocoXmlBaseBulletEnv._reset(self) + r = MJCFBaseBulletEnv._reset(self) self.parts, self.jdict, self.ordered_joints, self.robot_body = self.robot.addToScene( self.stadium_scene.ground_plane_mjcf) self.ground_ids = set([(self.parts[f].bodies[self.parts[f].bodyIndex], self.parts[f].bodyPartIndex) for f in diff --git a/examples/pybullet/gym/pybullet_envs/gym_pendulum_envs.py b/examples/pybullet/gym/pybullet_envs/gym_pendulum_envs.py index ce83f3e74..a0a78d20e 100644 --- a/examples/pybullet/gym/pybullet_envs/gym_pendulum_envs.py +++ b/examples/pybullet/gym/pybullet_envs/gym_pendulum_envs.py @@ -1,14 +1,14 @@ from .scene_abstract import SingleRobotEmptyScene -from .env_bases import MujocoXmlBaseBulletEnv +from .env_bases import MJCFBaseBulletEnv from robot_pendula import InvertedPendulum, InvertedPendulumSwingup, InvertedDoublePendulum import gym, gym.spaces, gym.utils, gym.utils.seeding import numpy as np import os, sys -class InvertedPendulumBulletEnv(MujocoXmlBaseBulletEnv): +class InvertedPendulumBulletEnv(MJCFBaseBulletEnv): def __init__(self): self.robot = InvertedPendulum() - MujocoXmlBaseBulletEnv.__init__(self, self.robot) + MJCFBaseBulletEnv.__init__(self, self.robot) def create_single_player_scene(self): return SingleRobotEmptyScene(gravity=9.8, timestep=0.0165, frame_skip=1) @@ -34,12 +34,12 @@ class InvertedPendulumBulletEnv(MujocoXmlBaseBulletEnv): class InvertedPendulumSwingupBulletEnv(InvertedPendulumBulletEnv): def __init__(self): self.robot = InvertedPendulumSwingup() - MujocoXmlBaseBulletEnv.__init__(self, self.robot) + MJCFBaseBulletEnv.__init__(self, self.robot) -class InvertedDoublePendulumBulletEnv(MujocoXmlBaseBulletEnv): +class InvertedDoublePendulumBulletEnv(MJCFBaseBulletEnv): def __init__(self): self.robot = InvertedDoublePendulum() - MujocoXmlBaseBulletEnv.__init__(self, self.robot) + MJCFBaseBulletEnv.__init__(self, self.robot) def create_single_player_scene(self): return SingleRobotEmptyScene(gravity=9.8, timestep=0.0165, frame_skip=1) diff --git a/examples/pybullet/gym/pybullet_envs/robot_bases.py b/examples/pybullet/gym/pybullet_envs/robot_bases.py index dd9dfbf3c..4ff262723 100644 --- a/examples/pybullet/gym/pybullet_envs/robot_bases.py +++ b/examples/pybullet/gym/pybullet_envs/robot_bases.py @@ -4,7 +4,7 @@ import numpy as np import os -class MujocoXmlBasedRobot: +class MJCFBasedRobot: """ Base class for mujoco .xml based agents. """ diff --git a/examples/pybullet/gym/pybullet_envs/robot_locomotors.py b/examples/pybullet/gym/pybullet_envs/robot_locomotors.py index 92cda05ac..51149080b 100644 --- a/examples/pybullet/gym/pybullet_envs/robot_locomotors.py +++ b/examples/pybullet/gym/pybullet_envs/robot_locomotors.py @@ -1,10 +1,10 @@ -from robot_bases import MujocoXmlBasedRobot +from robot_bases import MJCFBasedRobot import numpy as np -class WalkerBase(MujocoXmlBasedRobot): +class WalkerBase(MJCFBasedRobot): def __init__(self, fn, robot_name, action_dim, obs_dim, power): - MujocoXmlBasedRobot.__init__(self, fn, robot_name, action_dim, obs_dim) + MJCFBasedRobot.__init__(self, fn, robot_name, action_dim, obs_dim) self.power = power self.camera_x = 0 self.walk_target_x = 1e3 # kilometer away diff --git a/examples/pybullet/gym/pybullet_envs/robot_pendula.py b/examples/pybullet/gym/pybullet_envs/robot_pendula.py index 21d10f52d..1c6b14b05 100644 --- a/examples/pybullet/gym/pybullet_envs/robot_pendula.py +++ b/examples/pybullet/gym/pybullet_envs/robot_pendula.py @@ -1,11 +1,11 @@ -from robot_bases import MujocoXmlBasedRobot +from robot_bases import MJCFBasedRobot import numpy as np -class InvertedPendulum(MujocoXmlBasedRobot): +class InvertedPendulum(MJCFBasedRobot): swingup = False force_gain = 12 # TODO: Try to find out why we need to scale the force def __init__(self): - MujocoXmlBasedRobot.__init__(self, 'inverted_pendulum.xml', 'cart', action_dim=1, obs_dim=5) + MJCFBasedRobot.__init__(self, 'inverted_pendulum.xml', 'cart', action_dim=1, obs_dim=5) def robot_specific_reset(self): self.pole = self.parts["pole"] @@ -53,9 +53,9 @@ class InvertedPendulumSwingup(InvertedPendulum): force_gain = 2.2 # TODO: Try to find out why we need to scale the force -class InvertedDoublePendulum(MujocoXmlBasedRobot): +class InvertedDoublePendulum(MJCFBasedRobot): def __init__(self): - MujocoXmlBasedRobot.__init__(self, 'inverted_double_pendulum.xml', 'cart', action_dim=1, obs_dim=9) + MJCFBasedRobot.__init__(self, 'inverted_double_pendulum.xml', 'cart', action_dim=1, obs_dim=9) def robot_specific_reset(self): self.pole2 = self.parts["pole2"]