def _step(self, a):
    posbefore = self.sim.data.qpos[0]
    self.do_simulation(a, self.frame_skip)
    (posafter, height, ang) = self.sim.data.qpos[0:3]
    alive_bonus = 1.0
    reward = ((posafter - posbefore) / self.dt)
    reward += alive_bonus
    reward -= (0.001 * np.square(a).sum())
    done = (not ((height > 0.8) and (height < 2.0) and (ang > (- 1.0)) and (ang < 1.0)))
    ob = self._get_obs()
    return (ob, reward, done, {})
def _step(self, a):
    posbefore = self.sim.data.qpos[0]
    self.do_simulation(a, self.frame_skip)
    (posafter, height, ang) = self.sim.data.qpos[0:3]
    alive_bonus = 1.0
    reward = ((posafter - posbefore) / self.dt)
    reward += alive_bonus
    reward -= (0.001 * np.square(a).sum())
    done = (not ((height > 0.8) and (height < 2.0) and (ang > (- 1.0)) and (ang < 1.0)))
    ob = self._get_obs()
    return (ob, reward, done, {})