Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more

crowdAI is shutting down - please read our blog post for more information

Learning How to Walk

Reinforcement learning environments with musculoskeletal models


C++ simulation

Posted by joonho over 3 years ago

I’m trying to make the same simulation environment with Opensim 4.0 library (https://github.com/opensim-org/opensim-core) because I want to test my rl code which is written with c++.

I’m not sure but looking at the human.py code, seems like you use 4 body components self.osim_model.bodies.append(self.osim_model.bodySet.get(5))  »Rfoot self.osim_model.bodies.append(self.osim_model.bodySet.get(10)) »Lfoot self.osim_model.bodies.append(self.osim_model.bodySet.get(12)) »head self.osim_model.bodies.append(self.osim_model.bodySet.get(0))  »pelvis then the inertia of the head is taken account in the environment?? it is confusing because the upper body is not visualized

and secondly, seems like there are 18 muscles. then the action is 18 dimension? not 16?

This question can be ridiculous because It’s my first time using opensim but I want to know more about the environment It would be so grateful if you give me some comments about building the simulation with the opensim c++ library.


Posted by Lukasz_  over 3 years ago |  Quote

You are absolutely right - we have 18 muscles. The observation is built here: https://github.com/stanfordnmbl/osim-rl/blob/master/osim/env/human.py#L71-L121 Indeed we are taking the head into account, we don’t have right geometry for visualization of the the upper body, but this should be fixed soon.

Your contribution is great! If you can share your C++ environment on github we can help building it directly.

Posted by Ish_  over 3 years ago |  Quote

Hi, Where, in the code, are the 18 muscles defined?


Posted by Lukasz_  over 3 years ago |  Quote

The observation vector is 18-dimensional. In the task we control muscles and each covariate corresponds to one muscle.


Posted by joonho  over 3 years ago |  Quote

If you read the model file, you can figure out how many muscles are there. or you can just count it in the visualizer :)



Posted by joonho  over 3 years ago |  Quote

I’m testing Opensim 4.0 library and making c++ environment step by step now. I’m trying to get the observation now.

In the human.py (https://github.com/stanfordnmbl/osim-rl/blob/master/osim/env/human.py ), Seems like the function “getFootL” actually gets the right foot and “getFootR” gets the left foot. is it right?

This thing will not affect the task anyway because we are encouraged to do some kind of model-free learning. But I’d like to make it clear because I want to get the same observation as in python env.

If I succeed in making c++ environment, I will share it :). For now, I’m just figuring out how the Opensim works and there’s no big progress in making c++ env.