Sohojoe / ActiveRagdollStyleTransfer

Research into locomotion style transfer with Active Ragdolls (using MarathonEnvs +ml_agents)
Apache License 2.0
143 stars 21 forks source link

Physics/gravity issues #1

Closed nxdudek closed 6 years ago

nxdudek commented 6 years ago

Hi, I've been trying to get the project setup working, but I've been having some issues. The pre-trained backflip works fine, but the walking & running animations have been giving me trouble. From a fresh copy of the repo, if I open the StyleTransfer002 scene and change the animation in the 'Record' state in AnimatorBase002's AnimationController to MarathonManRunning-v02, and change the model used by the LearnFromMocapBrain to 'StyleTransfer002.132-runningv2-64m,' I get
this behaviour.

It seems like the agent is moving way too quickly, which I think is due to the physics-only steps setting in the Academy. If I change it from 4 to 0, I instead get this. (from reading the repo notes, it looks like the physics-only steps were added for the backflip specifically, and the running was trained before adding that feature, and should maybe have a 1:1 ratio?)

In this case, it seems like the agent's movements are at the correct speed (or at least closer), but the gravity is lower than it's supposed to be. I've been trying various tweaks to get running/walking policies that work as well as your demos, but haven't had much success. It always seems like the gravity is too low for the agent to learn an effective policy because it keeps launching itself into the air, and can't push off the ground to achieve sufficient horizontal force. The closest I've been able to get was training a policy with 0 physics only steps and increasing Unity's gravity from -9.81 to -60.

One possible cause could be that I'm using Unity 2018.3.0b9 instead of 2018.3.0b7, and was thinking maybe changing the Unity project version changes/resets some physics settings? I was wondering if you had any suggestions or ideas for possible fixes, or insights into what might be going wrong.

Sohojoe commented 6 years ago

Hi @nxdudek,

Only backflip was trained with 2018.3 beta - for the others are with 2018.2 - the best way to check them would be to download the code from the release - https://github.com/Sohojoe/ActiveRagdollStyleTransfer/releases/tag/v0.002.115 - there is also some MacOS run times. If you use Unity hub you can have multiple versions of Unity installed

I've not seen much difference between the 2018.3 betas but there is a big difference between 2018.2 and 2018.3. I dont think the issue is with gravity however, I've noticed that the agents have a lot more strength.

if you are still stuck, let me know and I'll train walk / running on 2018.3 beta

nxdudek commented 6 years ago

It looks like the increased agent strength was a large part of the issue. I ended up reducing the muscle power to 30% of what it was previously, and have been getting pretty good results now. Thanks!

Sohojoe commented 6 years ago

@nxdudek - that is good to hear. Did you retrain them or where you able to get the trained models working with 2018.3 beta ?

nxdudek commented 5 years ago

I ended up retraining them. I figured it would easier than trying to find the exact same configuration for the physics to mirror the older version of the environment. One other small change I had to make though was also to adjust how the root velocity is rewarded - it was clamping the difference in velocity between the reference root and the agent root to be a maximum of 3. For running & walking it would go as high as 500 though, if the agent was at rest, so I ended up just changing the velocity reward scale to 500.

GeorgSatyros commented 5 years ago

This is pretty much what I came here for! My suggestion is, given the quality of this work, to keep the previous trained animations (walking, running etc) relevant in the master branch, perhaps by using separate/persistent scenes and prefabs for each new animation. The new features in 2018.3 for prefabs and scenes would probably work wonders in that regard. Thanks for the hard work! :)