google / brax

Massively parallel rigidbody physics simulation on accelerator hardware.
Apache License 2.0
2.22k stars 244 forks source link

humanoid_run doesn't work in composer Colab #178

Open KarolisRam opened 2 years ago

KarolisRam commented 2 years ago

If you go to: https://colab.research.google.com/github/google/brax/blob/main/notebooks/composer/composer.ipynb and choose humanoid_run as the environment, the next cell throws the following error:

[/usr/local/lib/python3.7/dist-packages/brax/physics/system.py](https://localhost:8080/#) in default_angle(self, default_index)
     68       defaults = self.config.defaults[default_index]
     69       for ja in defaults.angles:
---> 70         arr = vec_to_arr(ja.angle)[:dofs[ja.name]] * jp.pi / 180
     71         angles[ja.name] = arr
     72 

KeyError: 'left_knee'
cdfreeman-google commented 2 years ago

We have a fix for this internally, will ship out externally shortly. In short, NAME_FIELDS in component_editory.py should be this:

NAME_FIELDS = {
    'bodies': ('name',),
    'joints': (
        'name',
        'parent',
        'child',
    ),
    'actuators': (
        'name',
        'joint',
    ),
    'collide_include': (
        'first',
        'second',
    ),
    'qps': ('name',),
    'angles': ('name',),
}

i.e., it's missing the qps and angles keys. h/t @frt03 for the fix