ARISE-Initiative / robomimic

robomimic: A Modular Framework for Robot Learning from Demonstration
MIT License
655 stars 201 forks source link

Extracting low dimensional observations #139

Closed Dhanushvarma closed 8 months ago

Dhanushvarma commented 8 months ago

In robosuite, for the environment, I had given some initialization noise (dictionary of type and magnitude) which was default set to zero. I believe this applies noise onto the starting joint angles of the robot. With this configuration, I have collected data in Robosuite. When I try to extract low dimensional observations, I get the following error

Error :

raceback (most recent call last):
  File "dataset_states_to_obs.py", line 426, in <module>
    dataset_states_to_obs(args)
  File "dataset_states_to_obs.py", line 261, in dataset_states_to_obs
    traj, camera_info = extract_trajectory(
  File "dataset_states_to_obs.py", line 93, in extract_trajectory
    obs = env.reset_to(initial_state)
  File "/home/dpenmets/LIRA_work/robomimic_vd/robomimic/envs/env_robosuite.py", line 158, in reset_to
    self.env.reset_from_xml_string(xml)
  File "/home/dpenmets/LIRA_work/robosuite_vd/robosuite/environments/base.py", line 570, in reset_from_xml_string
    self._initialize_sim(xml_string=xml_string)
  File "/home/dpenmets/LIRA_work/robosuite_vd/robosuite/environments/base.py", line 230, in _initialize_sim
    self.sim = MjSim.from_xml_string(xml)
  File "/home/dpenmets/LIRA_work/robosuite_vd/robosuite/utils/binding_utils.py", line 1073, in from_xml_string
    model = mujoco.MjModel.from_xml_string(xml)
ValueError: Error: joint has `range` but not `limited`. set the autolimits="true" compiler option, specify `limited` explicitly ("true" or "false"), or remove the `range` attribute.
Object name = robot0_joint1, id = 0, line = 182, column = -1

It would be appreciated if you help with this.

amandlek commented 8 months ago

Which version of robosuite are you using? And which version of mujoco are you on?

Dhanushvarma commented 8 months ago

robomimic : 0.3.0 robosuite : 1.4.1 MuJoCo : 2.3.2

Also, is there any way of introducing randomization into the gripper position at the start of the episode (for each episode the robot EEF start Position is varied by some noise term)

amandlek commented 8 months ago

I think you should try upgrading robosuite to latest master - I had pushed a fix to use autolimits (see here). That should hopefully fix the issue.

As for randomizing gripper position, I don't think that is currently supported, but you should try raising an issue in the robosuite repo to double check.

Dhanushvarma commented 8 months ago

It is already the latest version of the Robosuite, and I have verified that I have the fix that you are referring to in the version of Robosuite I am using.

amandlek commented 8 months ago

The version string was bumped before the commit I linked - so you may not necessarily be on a commit after that one.

Dhanushvarma commented 8 months ago

So, I did check, that I am on the latest version and the fix you mentioned is indeed implemented in the version I am using, still the issue is there

amandlek commented 8 months ago

I believe you need to either (1) re-collect the demos with the new settings or (2) postprocess the model xml contained in the demonstrations to add the xml change from the commit I linked you before