From 50b5edd7b5e2fad40e3752188ff0efb413b6f804 Mon Sep 17 00:00:00 2001 From: Alexis David Jacq Date: Sat, 16 Jun 2018 13:53:05 +0200 Subject: [PATCH] isDone instead of isAlive --- .../gym/pybullet_envs/gym_locomotion_envs.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/pybullet/gym/pybullet_envs/gym_locomotion_envs.py b/examples/pybullet/gym/pybullet_envs/gym_locomotion_envs.py index 453b0e781..68b355a13 100644 --- a/examples/pybullet/gym/pybullet_envs/gym_locomotion_envs.py +++ b/examples/pybullet/gym/pybullet_envs/gym_locomotion_envs.py @@ -40,8 +40,8 @@ class WalkerBaseBulletEnv(MJCFBaseBulletEnv): return r - def _isAlive(self): - return self._alive > 0 + def _isDone(self): + return self._alive < 0 def move_robot(self, init_x, init_y, init_z): "Used by multiplayer stadium to move sideways, to another running lane." @@ -64,7 +64,7 @@ class WalkerBaseBulletEnv(MJCFBaseBulletEnv): state = self.robot.calc_state() # also calculates self.joints_at_limit self._alive = float(self.robot.alive_bonus(state[0]+self.robot.initial_z, self.robot.body_rpy[1])) # state[0] is body height above ground, body_rpy[1] is pitch - done = not self._isAlive() + done = self._isAlive() if not np.isfinite(state).all(): print("~INF~", state) done = True @@ -103,7 +103,7 @@ class WalkerBaseBulletEnv(MJCFBaseBulletEnv): print(feet_collision_cost) self.rewards = [ - alive, + self._alive, progress, electricity_cost, joints_at_limit_cost, @@ -139,8 +139,8 @@ class HalfCheetahBulletEnv(WalkerBaseBulletEnv): self.robot = HalfCheetah() WalkerBaseBulletEnv.__init__(self, self.robot) - def _isAlive(self): - return True + def _isDone(self): + return False class AntBulletEnv(WalkerBaseBulletEnv): def __init__(self):