google / brax

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

Dump to json fails if mj model contains no meshes #461

Closed Nate711 closed 4 months ago

Nate711 commented 4 months ago

I had a case where my mujoco model had only geometry (boxes, spheres, etc) and no meshes. When I tried to use the HTML visualizer with this model (HTML(html.render(brax_sys, rollout))), I got an error in the json dumper because mj_mode.nmeshes returned 0 and this value was not correctly handled. https://github.com/google/brax/blob/3c109cfd131e01691a53891e8f2ec9b32cf97670/brax/io/json.py#L174

btaba commented 4 months ago

Thanks for the bug report! We'll send out a fix shortly

btaba commented 4 months ago

This should be fixed in 0825bcb74b53e36a62d50405a85e540fe2c25a95 , please let us know if that doesn't work! Closing for now