Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing qpos order in the xml of the basketball task. #476

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

devinluo27
Copy link
Contributor

I found that the order to initialize mujoco bodies in the xml of the basketball v2 task is slightly different with others. This results in unexpected initial robot poses. An example is shown below:

before

In this function, the object is assumed to follow the robot qpos, however, in the xml for the basketball file, the order is inconsistent, which leads to unexpected initial pose of the robot.

def _set_obj_xyz(self, pos):
qpos = self.data.qpos.flat.copy()
qvel = self.data.qvel.flat.copy()
qpos[9:12] = pos.copy()
qvel[9:15] = 0
self.set_state(qpos, qvel)

In this pull request, I put the basketball behind the robot in the xml, and this issue seems to be resolved.

after

@reginald-mclean
Copy link
Collaborator

@devinluo27 what version of mujoco are you using?

@devinluo27
Copy link
Contributor Author

@devinluo27 what version of mujoco are you using?

I installed mujoco via pip, and pip list returns mujoco 2.3.5

@reginald-mclean
Copy link
Collaborator

@devinluo27 can you try 2.3.7?

@devinluo27
Copy link
Contributor Author

@devinluo27 can you try 2.3.7?

I upgraded to 2.3.7 just now, and the results turned out to be identical to mujoco 2.3.5.

@reginald-mclean
Copy link
Collaborator

Interesting. I'll look into it tomorrow, thanks!

@reginald-mclean reginald-mclean merged commit 6846120 into Farama-Foundation:master Apr 30, 2024
5 checks passed
@pseudo-rnd-thoughts
Copy link
Member

Does this problem affect any more environments?

@devinluo27
Copy link
Contributor Author

Does this problem affect any more environments?

I haven't looked into every task closely, but so far I only encountered this problem in this basketball environment.

@reginald-mclean
Copy link
Collaborator

I manually checked the XMLs of each task, the only task where the xyz_base.xml file is also loaded in a different order is for the coffee environments. Changing the order screws up the environment completely. As far as I can tell, basketball is the only affected environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants