xbpeng / DeepMimic

Motion imitation with deep reinforcement learning.
https://xbpeng.github.io/projects/DeepMimic/index.html
MIT License
2.31k stars 488 forks source link

On orientation/rotation state in DeepMimic. #175

Open joonkyu4220 opened 2 years ago

joonkyu4220 commented 2 years ago

Hello sir, thank you for sharing your marvelous work.

I am very much inspired by your DeepMimic paper, so I looked into your code. While going through your code, I noticed some of the differences between what is written in the paper and what is implemented in the code.

In your paper it says

The state s describes the configuration of the character's body, with features consisting of the relative positions of each link with respect to the root (designated to be the pelvis), their rotations expressed in quaternions, and their linear and angular velocities.

However, in the code, if my understanding is correct, only position and (linear) velocity are being treated as 'state'. I checked get_state_size in deepmimic_env.py leading to GetStateSize in DeepMimicCharController.cpp, followed by GetStatePoseSize and GetStateVelSize, where mPosDim is fixed to 3, by GetPoseDim in the same file. I also checked _record_state() in rl_agent.py, leading to RecordState in DeepMimicCharController.cpp, again referring to GetStatePoseSize and GetStateVelSize, to segment the pose vector.

The closest issue I found was issue 91, which didn't quite answer my question. I apologize in advance, in case it's an issue already raised, or in case it's my misunderstanding of the codes.

Thank you also in advance, for your response.

xbpeng commented 2 years ago

that's the base controller, the controller we actually use overrides the recordstate methods: https://github.com/xbpeng/DeepMimic/blob/ea26c3f2c35fb271d8bfefd53fd49397547c514d/DeepMimicCore/sim/CtController.cpp#L370 https://github.com/xbpeng/DeepMimic/blob/ea26c3f2c35fb271d8bfefd53fd49397547c514d/DeepMimicCore/sim/CtController.cpp#L459

joonkyu4220 commented 2 years ago

Sorry I missed that, thank you for your response. I'll close this issue right away.

joonkyu4220 commented 2 years ago

Sorry I missed that. Thank you for your response.

Just one more thing before I close this issue, if I may.

In DeepMimic, you used quaternion to represent joint orientations in the state vector, and angle-axis to represent the target orientations(or, action). But in the code, and in AMP, you seem to have switched to using normal-tangent representation and rotational vector(angle and axis multiplied), respectively. Is the choice of your state and action representations based on some experiments that you have done? Or is there any insight or postulation behind your decision?

Thank you again in advance.