erincatto / box2d

Box2D is a 2D physics engine for games
https://box2d.org
MIT License
8.36k stars 1.54k forks source link

AttributeError: 'BipedalWalker' object has no attribute 'joints' #699

Closed VineetTambe closed 2 years ago

VineetTambe commented 3 years ago

I am trying to run the BipedalWalker environment but am facing this error:

Traceback (most recent call last):
  File "Bipedal_MMPI.py", line 118, in <module>
    bipedal_mppi_gym.control()
  File "Bipedal_MMPI.py", line 59, in control
    self.simulate_rollouts(k, temp)
  File "Bipedal_MMPI.py", line 40, in simulate_rollouts
    _, reward, _, _ = copy_env.step(rollout_action_t)
  File "/home/vineet/rlenv/lib/python3.8/site-packages/gym/wrappers/time_limit.py", line 18, in step
    observation, reward, done, info = self.env.step(action)
  File "/home/vineet/rlenv/lib/python3.8/site-packages/gym/envs/box2d/bipedal_walker.py", line 412, in step
    self.joints[0].motorSpeed = float(SPEED_HIP * np.sign(action[0]))
AttributeError: 'BipedalWalker' object has no attribute 'joints'

Interestingly if I run python in cli and manually type in commands line by line to setup environment and then do 'env.step([1,1,1,1])' it executes without any error

I am using: Ubuntu 20.04 Python 3.8.10 box2d-py 2.3.5

Any help would be appreciated. Thanks in advance.

metalgearsloth commented 3 years ago

Isn't this a question for box2d-py?

erincatto commented 2 years ago

Yes, wrong project. This is a C++ project.