isDone instead of isAlive
This commit is contained in:
committed by
GitHub
parent
292a3f1cf6
commit
50b5edd7b5
@@ -40,8 +40,8 @@ class WalkerBaseBulletEnv(MJCFBaseBulletEnv):
|
|||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def _isAlive(self):
|
def _isDone(self):
|
||||||
return self._alive > 0
|
return self._alive < 0
|
||||||
|
|
||||||
def move_robot(self, init_x, init_y, init_z):
|
def move_robot(self, init_x, init_y, init_z):
|
||||||
"Used by multiplayer stadium to move sideways, to another running lane."
|
"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
|
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
|
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():
|
if not np.isfinite(state).all():
|
||||||
print("~INF~", state)
|
print("~INF~", state)
|
||||||
done = True
|
done = True
|
||||||
@@ -103,7 +103,7 @@ class WalkerBaseBulletEnv(MJCFBaseBulletEnv):
|
|||||||
print(feet_collision_cost)
|
print(feet_collision_cost)
|
||||||
|
|
||||||
self.rewards = [
|
self.rewards = [
|
||||||
alive,
|
self._alive,
|
||||||
progress,
|
progress,
|
||||||
electricity_cost,
|
electricity_cost,
|
||||||
joints_at_limit_cost,
|
joints_at_limit_cost,
|
||||||
@@ -139,8 +139,8 @@ class HalfCheetahBulletEnv(WalkerBaseBulletEnv):
|
|||||||
self.robot = HalfCheetah()
|
self.robot = HalfCheetah()
|
||||||
WalkerBaseBulletEnv.__init__(self, self.robot)
|
WalkerBaseBulletEnv.__init__(self, self.robot)
|
||||||
|
|
||||||
def _isAlive(self):
|
def _isDone(self):
|
||||||
return True
|
return False
|
||||||
|
|
||||||
class AntBulletEnv(WalkerBaseBulletEnv):
|
class AntBulletEnv(WalkerBaseBulletEnv):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user