pybullet: improvements in Gym Ant environment (work-in-progress)

This commit is contained in:
Erwin Coumans
2017-09-07 11:06:42 -07:00
parent 7a2de3ea08
commit 3d702879c5
5 changed files with 7 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ class WalkerBaseBulletEnv(MJCFBaseBulletEnv):
self.walk_target_y = 0
def create_single_player_scene(self):
self.stadium_scene = SinglePlayerStadiumScene(gravity=9.8, timestep=0.0165/4, frame_skip=4)
self.stadium_scene = SinglePlayerStadiumScene(gravity=9.8, timestep=0.0165, frame_skip=4)
return self.stadium_scene
def _reset(self):

View File

@@ -13,7 +13,7 @@ class MJCFBasedRobot:
Base class for mujoco .xml based agents.
"""
self_collision = False
self_collision = True
def __init__(self, model_xml, robot_name, action_dim, obs_dim):
self.parts = None
@@ -87,7 +87,7 @@ class MJCFBasedRobot:
if self.self_collision:
self.parts, self.jdict, self.ordered_joints, self.robot_body = self.addToScene(
p.loadMJCF(os.path.join(pybullet_data.getDataPath(),"mjcf", self.model_xml), flags=p.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS))
p.loadMJCF(os.path.join(pybullet_data.getDataPath(),"mjcf", self.model_xml), flags=p.URDF_USE_SELF_COLLISION+p.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS))
else:
self.parts, self.jdict, self.ordered_joints, self.robot_body = self.addToScene(
p.loadMJCF(os.path.join(pybullet_data.getDataPath(),"mjcf", self.model_xml)))

View File

@@ -114,7 +114,7 @@ class Ant(WalkerBase):
foot_list = ['front_left_foot', 'front_right_foot', 'left_back_foot', 'right_back_foot']
def __init__(self):
WalkerBase.__init__(self, "ant.xml", "torso", action_dim=8, obs_dim=28, power=10.5)
WalkerBase.__init__(self, "ant.xml", "torso", action_dim=8, obs_dim=28, power=2.5)
def alive_bonus(self, z, pitch):
return +1 if z > 0.26 else -1 # 0.25 is central sphere rad, die if it scrapes the ground

View File

@@ -68,7 +68,8 @@ class World:
def clean_everything(self):
p.resetSimulation()
p.setGravity(0, 0, -self.gravity)
p.setPhysicsEngineParameter(fixedTimeStep=self.timestep, numSolverIterations=5, numSubSteps=2)
p.setDefaultContactERP(0.9)
p.setPhysicsEngineParameter(fixedTimeStep=self.timestep, numSolverIterations=5, numSubSteps=4)
def step(self, frame_skip):
p.stepSimulation()

View File

@@ -19,8 +19,7 @@ class StadiumScene(Scene):
# stadium_pose = cpp_household.Pose()
# if self.zero_at_running_strip_start_line:
# stadium_pose.set_xyz(27, 21, 0) # see RUN_STARTLINE, RUN_RAD constants
filename = os.path.join(pybullet_data.getDataPath(),"stadium.sdf")
print(filename)
filename = os.path.join(pybullet_data.getDataPath(),"stadium_no_collision.sdf")
self.stadium = p.loadSDF(filename)
planeName = os.path.join(pybullet_data.getDataPath(),"mjcf/ground_plane.xml")