cheind / pytorch-blender

:sweat_drops: Seamless, distributed, real-time integration of Blender into PyTorch data pipelines
MIT License
568 stars 44 forks source link

Error in example/controls/cartpole.py #18

Closed gauenk closed 3 years ago

gauenk commented 3 years ago

The following error occurs when running the example/controls/cartpole.py:

Read blend: /home/gauenk/Documents/packages/pytorch-blender/examples/control/cartpole_gym/envs/cartpole.blend
Traceback (most recent call last):
  File "./cartpole.py", line 39, in <module>
    main()
  File "./cartpole.py", line 30, in main
    obs = env.reset()        
  File "/home/gauenk/.local/lib/python3.8/site-packages/gym/wrappers/order_enforcing.py", line 16, in reset
    return self.env.reset(**kwargs)
  File "/home/gauenk/Documents/packages/pytorch-blender/pkg_pytorch/blendtorch/btt/env.py", line 292, in reset
    obs, info = self._env.reset()
  File "/home/gauenk/Documents/packages/pytorch-blender/pkg_pytorch/blendtorch/btt/env.py", line 64, in reset
    obs = ddict.pop('obs')
KeyError: 'obs'

This happens because in btt/env.py (pytorch's env.py) the reset function pops off a key "obs" for the observation. However, an observation is not sent from the blender side, btb/env.py in the _pre_animation function. The dict sent from the blender side is defined as follows,

self.ctx = {'prev_action': None, 'done': False}
cheind commented 3 years ago

good catch

cheind commented 3 years ago

fixed via PR #19