openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.86k stars 816 forks source link

What does attribute 'xvelp' stand for? #255

Closed liuyuezhang closed 4 years ago

liuyuezhang commented 6 years ago
def get_grip_vel(sim):
    dt = sim.nsubsteps * sim.model.opt.timestep
    grip_velp = sim.data.get_site_xvelp('right_gripper') * dt
    return grip_velp

So what does the 'xvelp' stand for? Why you have to times it with 'dt'? Does it stand for acceleration?

I'm new to mujoco_py and OpenAI Gym. Thanks for your answers.

ghost commented 6 years ago

@liuyuezhangadam Did you decode it?

ghost commented 6 years ago

https://github.com/openai/mujoco-py/blob/cd247d5fae39f21e913104350e26ac7254fa4b93/mujoco_py/tests/test_cymj.py#L442

According to comment on this line it means positional(cartesian) velocity in world frame whereas xvelr is rotational velocity

Don't know why multiplication by dt is needed

liuyuezhang commented 6 years ago

Sorry for a late reply.

No, I didn't decode it and I move to work on Atari game this summer. Thank you for providing me a great clue!

I shall continue to work on the project in this autumn. I'll keep in track.

valeriechen commented 6 years ago

Hi,

Where did the get_grip_vel function come from? Also do you mind sharing what versions you have for mujoco_py and gym? I am trying to get Baxter set up as well.

chongyi-zheng commented 4 years ago

Just a guess (may not be correct):

nsubsteps > 1 means mujoco takes more than one step when you call the step function in the env. Therefore, we need to scale the positional velocity in the world frame returned by mujoco to get corresponding velocity in the env.

By the way, the test_xvelp function test exactly the velocity in mujoco.

wangjunyi9999 commented 1 year ago

Well..., so the issue answer is what @YeeCY said before?