MyoHub / myo_sim

Musculoskeletal Models in MuJoCo
https://sites.google.com/view/myosuite
Apache License 2.0
76 stars 23 forks source link

Amputation model #15

Open YusseffRuiz opened 10 months ago

YusseffRuiz commented 10 months ago

Crearing a DPR for the amputation model designed for myosuite testing. Transtibial amputation with the OpenSource Leg project prosthesis. We are having issues described in the Readme file.

Problems with ankle movement de-attaching from the body. Problems with initial position in walking environment.

Will upload the Walk environment.

Vittorio-Caggiano commented 10 months ago

Thanks @YusseffRuiz. It would be great to integrate this model in myo_sim to be used with the MyoSuite ecosystem.

A few suggestions to better prepare the model:

  1. try first the model without the movable muscle attachment sites. I suggest introducing those only if they are explicitly needed because in my experience they are difficult to tune and control.
  2. insert the default position on joints in the body position rather than in the joint (added a comment here).
  3. have only one converted file (Intermediate converted files are not needed) that we can iterate on. This will be the only one included in the repository.
  4. use example structure from other files e.g. to reuse mesh library or environment
  5. it would be nice to have the model without the amputation to compare policies with and without amputation
YusseffRuiz commented 10 months ago

Hello Vittorio. I already modified the initial position and we can see the model standing properly. I added a motor actuator on the prosthesis ankle movement for adduction/abduction and flexion.

I removed unused files from the conversion and also removed the duplicated Geometry, reusing the mesh files already on the git repository. I only left the prosthesis mesh files. For the prosthesis geometry, i will create a new mesh file already mixing bones and prosthesis. I removed the knee translation to avoid this issue, that was causing the whole problem.

I still don't get what are the muscle attachment sites, aren't those the ones involved to move the body? And the pivot point for the yR and zR_footToAnkle movement seems to be in a different place than where is expected. Attaching the image as example. screenshot

Do you have any input on that last matter?

Vittorio-Caggiano commented 10 months ago

@YusseffRuiz thanks for making those changes. I just checked the new file and I think the issue with the ankle prosthesis is that the rotation axis of the device is centered with an offset (blue joint .. you can enable this view by pressing j on simulate) wrt the motor reference frame

image

Regarding the muscle attachment sites. If you look at the body rect_fem_l_rect_fem_l-P3 it has 3 degrees of freedom i.e. it moves during the optimization (constrained to knee_angle_l). My suggestion is to transform those into fixed attachment (there is an option in the myoconverter to do so by setting kwargs['treat_as_normal_path_point'] = True https://github.com/MyoHub/myoconverter/blob/cadf38059367a51239e6dc28c9fbe8b8fbd5149f/examples/leg6dof9musc.py#L23 ). It would be easier to test the model and troubleshoot without those.

vikashplus commented 9 months ago

I gave a quick browse to the model

@Vittorio-Caggiano -- thoughts?

vikashplus commented 9 months ago

Hi @YusseffRuiz thanks for attending to the joint limits. It looks great.

I also took a look at the collision geometries -

Screenshot 2023-12-19 at 11 46 28 PM

It seems like the collisions are with the skeletal mesh. This might not be ideal. Depending on the use case, this might be the next area of attention. Please let us know what use case you are going after.

YusseffRuiz commented 9 months ago

Thanks Vikash, In this case, the use is to be used in the study of biomechanics with RL. My work is to create a DRL approach to design a new push-recovery controller for a transtibial prosthesis working with the whole body. Similar to the work created in the walk environment with myosuite locomotion challenge 2023.

vikashplus commented 9 months ago

@YusseffRuiz -- we are in the process of releasing the models that were used in the locomotion challenge. These models and environments have most of what you are looking for. I would recommend using the MyoLeg model as a base for your model, and the corresponding envs too.

We are still finalizing the release. You can follow along the progress here - https://github.com/MyoHub/myosuite/pull/128/files to get a headstart :)

Once the staged release goes through, I'll hop on here to help you get this model ready and kicking :)

vikashplus commented 8 months ago

@YusseffRuiz --- I gave the recent edits a quick browse. It's generally heading in the right direction. Great progress. Let us know if we can help in anyway.

vikashplus commented 6 months ago

@YusseffRuiz -- do you have the model with the knee as well? I was looking at the full model and I'm very excited about the prospect it presents. Let me know what you have (even just all the meshes will be very helpful) and I can try to help speed things up as much as I can. image

YusseffRuiz commented 6 months ago

I'm sorry about the delay in my response, last week I was out and unable to provide, I have the meshes for the whole prosthesis with the knee, I will share it over here and I can create a new model with it as well. It has one DoF in Knee and 1 DoF in Ankle.

vikashplus commented 6 months ago

Amazing. Share it here I want to get a sense of what it looks like

YusseffRuiz commented 5 months ago

Hello @vikashplus, i'm sorry for taking this long, I'm have added in the repository the Model with the Knee Prosthetic Device. In the meshes folder there are the STL files as well, I had to modify the pylon, since the position was not the ideal one, and also to correct the height as it came from the OSL project website.

Please let me know if you have the chance to take a look. The only problem is that when enabling geometry, it doesn't seems right.

Screenshot from 2024-04-11 16-33-30

Screenshot from 2024-04-11 16-34-23

vikashplus commented 5 months ago

I took a pass at the model

  1. It seems like the collision geoms need revision. At the moment, here is what collisions look like and everything here collides as meshes which is slow and not as stable as analytics collisions

    image
  2. It seems like something weird is happening to the kinematic chain for the OLS (right side of the image) as well -

    image
  3. Something weird is also happening with the Inertials -

    image