-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
[Bug Report] Quaternion order incorrect in Ant environment observation #971
Comments
Hello, I have tested it, and it appears to be correct in the documentation. qpos[0] Is the x coordinate import gymnasium
import numpy as np
import time
RENDER_MODE = "human"
env = gymnasium.make('Ant-v5', render_mode=RENDER_MODE)
action = env.action_space.sample()
for ep in range(100):
env.reset()
for step in range(10000):
#env.unwrapped.data.qpos[0] = (step % 2) # x cord
env.unwrapped.data.qpos[1] = (step % 2) # y cord
obs, rew, terminal, truncated, info = env.step(action)
time.sleep(0.200) |
Thanks for the reply. |
Commenting because I switched account (I opened this issue). |
Hey, @onnoeberhard sorry for taking a while to respond, I had to study how Quaternions work :-) all material on quaternions I could find denote them as |
This is just a different convention, the real part is |
Here is the relevant documentation page in the latest version of MuJoCo Library (3.1.3) https://mujoco.readthedocs.io/en/3.1.3/programming/simulation.html#data-layout-and-buffer-allocation The affected environment's documentation is @onnoeberhard do you want to make a PR to fix this issue? Thanks! |
Describe the bug
In the documentation for the Ant environment, it is claimed that the quaternion representation of the torso orientation is returned in the (x, y, z, w) order. Upon inspection of a trajectory of the ant and comparing these values with the true behavior visually, it seems to me that the actual order is (w, x, y, z). These values seem to come directly from the
qpos
variable in Mujoco. I couldn't find any proper documentation of this variable, but the site https://mujoco.readthedocs.io/en/stable/overview.html states "For ball joints, the quaternion saved in mjModel.qpos0 is always (1,0,0,0) which corresponds to the null rotation", which corresponds to the (w, x, y, z) order.This error might also persist in the documentations of other environments.
Code example
No response
System info
No response
Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: