google / brax

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

Documentation bug: wrong observation and action spaces ordering #483

Open Velythyl opened 2 months ago

Velythyl commented 2 months ago

I'm currently doing a project related to transferring control policies from simulator to simulator. This lead me to try to standardize action and observation spaces between brax and mujoco.

I implemented wrappers that map the obs and action spaces from mujoco to brax, according to each's table description

I found out that gymnasium's mujoco and gym's mujoco report different index orders for the action and observation spaces. https://github.com/Farama-Foundation/Gymnasium/issues/1035

I then tried completely removing my mapping wrapper (maps mujoco's obs and action orders to brax's), only to find that my agent transfers a LOT better to mujoco from brax.

All this to say, I'm fairly sure that brax's doc reports the wrong ordering for the action and observation spaces (at least for Ant) and that gymnasium's doc should by copy-pasted into brax

btaba commented 2 months ago

Thanks for the bug report! Please feel free to open up a PR!

Velythyl commented 1 month ago

Hey! I'll get on that a bit later, been very busy with my own stuff lately

Another report: Humanoid reports a 376-space obs in both gymnasium and brax. For gymnasium it is true, for brax it is actually 244-spaced. This feels like a more difficult discrepancy to fix, probably due to Brax packing joints together during the mujoco compilation?

image

image

Velythyl commented 1 month ago

Same thing for HumanoidStandup