google / brax

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

Humanoid Hand #334

Closed SumeetBatra closed 1 year ago

SumeetBatra commented 1 year ago

Hi folks,

I noticed that the hand is present as a sphere in the humanoid xml, but not part of the config string inside humanoid.py. I'm currently working on a project where it would be useful to also have the hand position returned on every timestep without changing anything else i.e. same obs_dim, action_dim etc. I'm not sure how to add it to the cfg string given the xml b/c I don't understand how the initial positions and orientations of the colliders are inferred, and was hoping to get some help with this?

Thanks!

SumeetBatra commented 1 year ago

Following up, it looks like the config string inside humanoid.py was being used instead of the xml. I'm operating on Brax v0.1.0, so I guess only these config strings and not XMLs were supported at that time?

btaba commented 1 year ago

Hi @SumeetBatra , I'm guessing the config string you're describing is as seen in brax/v1 (https://github.com/google/brax/blob/main/brax/v1/envs/humanoid.py). As of 0.9.0, brax v2 was moved to the mainline, so we use XML now (the hand geom is present in the XML as you've described)

SumeetBatra commented 1 year ago

Got it, thanks. I also wanted to ask how to add colliders between the floor and other links in the robot. Currently (in v1) only colliders between the floor and the left/right shins are included like so

  collide_include {
    first: "floor"
    second: "left_shin"
  }

I tried adding this for other links like

  collide_include {
    first: "floor"
    second: "left_lower_arm"
  }

But it didn't work i.e. the humanoid still clips through the floor except the feet when terminate_when_unhealthy=False

btaba commented 1 year ago

Hi @SumeetBatra , adding collide_include in v1 should work. Keep in mind there are two configs in that file https://github.com/google/brax/blob/b373f5a45e62189a4a260131c17b10181ccda96a/brax/v1/envs/humanoid.py#L210