Gym: Cannot change many parameters of MuJoCo model

Created on 22 Dec 2018  路  6Comments  路  Source: openai/gym

This is a follow-up to #234
I tried changing model parameters like size, pos, and mass in a swimmer environment. But it didn't change the swimmer model on the fly. Changing values in the model xml and loading it did change the swimmer, as expected.

The model.opt parameters are the only ones that seems to be the only ones which is read-write. Is there a way to make the model parameters (such as body_mass and so on) read-write with the latest version of mujoco-py?

_Originally observed by @vigneshramk in https://github.com/openai/gym/issues/234#issuecomment-378847012_

Most helpful comment

Any updates on this? Do we need to change the xml and reload every time?

Following this mujoco forum answer, it seems that the issue comes from the communication between mujoco-py and mujoco, but does anyone know why exactly?

All 6 comments

@gautams3 Also, when you changed the model XML, how did you make it work for the viewer?

if you set self.sim = in the def reset(), it freezes the viewer

I changed the model xml and created a new mujoco model

new_model = load_model_from_xml(xml_buffer)

Yes, it freezes the viewer. So if I create n different models and visualize them, it gives me n viewers

if you set self.sim = in the def reset(), it freezes the viewer

Set self.sim = what?

"Yes, it freezes the viewer. So if I create n different models and visualize them, it gives me n viewers"

I need arbitrary number of models though so this doesn't work for me...

However, if the gym monitor still outputs the right videos, then I dont really care about the viewer. Did you test if the gym monitor works continuing to output videos despite frozen viewer?

I didn't test that.

Any updates on this? Do we need to change the xml and reload every time?

Following this mujoco forum answer, it seems that the issue comes from the communication between mujoco-py and mujoco, but does anyone know why exactly?

This is sounding like an issue on mujoco-py, could you refile the issue there? https://github.com/openai/mujoco-py

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Baichenjia picture Baichenjia  路  3Comments

zhan0903 picture zhan0903  路  4Comments

RuofanKong picture RuofanKong  路  3Comments

Kallin picture Kallin  路  4Comments

pdoongarwal picture pdoongarwal  路  4Comments