-
Hello, I'm facing a weird issue with "HalfCheetahBulletEnv-v0", it throws a zero division error on reset (see traceback below). I've tried different version of pybullet (I'm using the latest one) but I could not reproduce the error in a docker image :/ System: Ubuntu 20.04 Even weirder, the error does not occur when using "Ant" or when running the code in an interactive python shell... I traced down the issue to
where ../../../../miniconda3/lib/python3.7/site-packages/gym/core.py:237: in reset
return self.env.reset(**kwargs)
utils/wrappers.py:169: in reset
return self.env.reset()
../../../../miniconda3/lib/python3.7/site-packages/gym/wrappers/time_limit.py:25: in reset
return self.env.reset(**kwargs)
../../../../miniconda3/lib/python3.7/site-packages/pybullet_envs/gym_locomotion_envs.py:32: in reset
r = MJCFBaseBulletEnv.reset(self)
../../../../miniconda3/lib/python3.7/site-packages/pybullet_envs/env_bases.py:87: in reset
s = self.robot.reset(self._p)
../../../../miniconda3/lib/python3.7/site-packages/pybullet_envs/robot_bases.py:144: in reset
s = self.calc_state(
../../../../miniconda3/lib/python3.7/site-packages/pybullet_envs/robot_locomotors.py:36: in calc_state
j = np.array([j.current_relative_position() for j in self.ordered_joints],
../../../../miniconda3/lib/python3.7/site-packages/pybullet_envs/robot_locomotors.py:36: in <listcomp>
j = np.array([j.current_relative_position() for j in self.ordered_joints],
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <robot_bases.Joint object at 0x7f80289b61d0>
def current_relative_position(self):
pos, vel = self.get_state()
pos_mid = 0.5 * (self.lowerLimit + self.upperLimit)
> return (2 * (pos - pos_mid) / (self.upperLimit - self.lowerLimit), 0.1 * vel)
E ZeroDivisionError: float division by zero
../../../../miniconda3/lib/python3.7/site-packages/pybullet_envs/robot_bases.py:351: ZeroDivisionError Do you have any idea of what may cause this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
After further investigation, it seems to comes from matplotlib this code work: import gym
import pybullet_envs
env = gym.make("HalfCheetahBulletEnv-v0")
print(env.reset()) but this one does not: import gym
import pybullet_envs
env = gym.make("HalfCheetahBulletEnv-v0")
from matplotlib import pyplot as plt
print(env.reset()) |
Beta Was this translation helpful? Give feedback.
After further investigation, it seems to comes from matplotlib
this code work:
but this one does not: