google / brax

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

What `geoms` attribute does the html visualizer access? #546

Closed trevormcinroe closed 2 weeks ago

trevormcinroe commented 1 month ago

The javascript used to render trajectories in the html viewer accesses the geoms attribute of a given system object: https://github.com/google/brax/blob/main/brax/visualizer/js/system.js#L160C17-L160C35

This rendering process appears to be triggered when loading a file saved via the brax.io.html.save() function: https://github.com/google/brax/blob/main/brax/io/html.py#L29, which takes a brax.base.System object.

However, since the geoms attribute was removed from brax.base.System, what geoms attribute is the javascript rendering process accessing? The rendering appears to work, but it is not clear how.

btaba commented 2 weeks ago

Hi @trevormcinroe, geoms is created here https://github.com/google/brax/blob/f43727eeebf21c031faf861ee00e98919c892140/brax/io/json.py#L152

Hope that helps