Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amputation model #15

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open

Conversation

YusseffRuiz
Copy link

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.

<site name="vas_int_r_vas_int_r-P1" pos="0.029 -0.1924 0.031"/>
<site name="vas_int_r_vas_int_r-P2" pos="0.0335 -0.2084 0.0285"/>
<site name="med_gas_r_med_gas_r-P1" pos="-0.019 -0.3929 -0.0235"/>
<body name="tibia_r">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add default position directly in the body e.g.

</body>
</body>
<body name="rect_fem_l_rect_fem_l-P3" pos="0 0 -0.001401">
<joint name="rect_fem_l_rect_fem_l-P3_x" pos="0 0 0" axis="1 0 0" type="slide" range="0.01558 0.0733"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

movable muscle attachment sites are tricky to troubleshoot. Better to start with fixed points or to convert them to fixed points

@Vittorio-Caggiano
Copy link
Contributor

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

Initial position has been added. Translation of bones have been removed.
Still having issues with ankle prosthesis attachment.
@YusseffRuiz
Copy link
Author

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
Copy link
Contributor

@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.

<body name="Foot">
<inertial pos="0.06215 -0.35314 0.04496" quat="0.130389 0.68448 0.215635 0.684096" mass="0.76" diaginertia="0.00184373 0.001789 0.001"/> <!--pos="0.06215 -0.35314 0.04496"-->
<joint name="zR_FootToAnkleAssembly" armature="0.0060" pos="0 0 0" axis="0 0 1" range="-0.104 0.19" type="hinge"/> <!--axis="-0.105003 -0.174005 0.979131" range="-0.45 0.6"-->
<joint name="yR_FootToAnkleAssembly" armature="0.0060" pos="0 0 0" axis="1 0 0" range="-0.09 0.09" type="hinge"/> <!-- axis="0.787215 -0.174005 -0.120902" range="-0.8727 0.5236" -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pos value here is where the joint reference location is with respect to the parent body

Newely created model with fixed attachments, modified joint location of the prosthetic ankle and only 22 DoF.
Newely created model with fixed attachments, modified joint location of the prosthetic ankle and only 22 DoF.
@vikashplus
Copy link
Contributor

vikashplus commented Dec 18, 2023

I gave a quick browse to the model

  • kinematically it looks great.
  • dynamics needs a lot of iteration to get things in order. For example
    • The joints can be over-extended
    • The body falls abruptly to the ground. Joint and inertial properties need attention for passive dynamics to behave better
    • Collision geometries are missing.
      None of these are a deal breaker, it depends on what is the use case for the model. That will define to what level we want to hammer all the specifics.

@Vittorio-Caggiano -- thoughts?

Added a model with pedestal and another with no pedestal.
Added a model with pedestal and another with no pedestal.
@vikashplus
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

@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 :)

Changing the type of xml files to match actual myoleg code.
Created a new assets and chain file.
Modified stl files to meshes folder.
@vikashplus
Copy link
Contributor

@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.

Added a 1 DoF and 2 DoF prostheses.
Modified the README file.
Modified main README file to add information about the new TP human model and what is the name to use it.
updated readme with correct image name
@vikashplus
Copy link
Contributor

@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
Copy link
Author

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.

@YusseffRuiz YusseffRuiz marked this pull request as ready for review April 2, 2024 20:46
@vikashplus
Copy link
Contributor

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

Added a new position for the TP model.
Adding meshes of Pylon, knee actuator, knee assembly.
Modified Muscles to match prosthesis from OSL project.
@YusseffRuiz
Copy link
Author

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
Copy link
Contributor

vikashplus commented Apr 29, 2024

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
  1. It seems like something weird is happening to the kinematic chain for the OLS (right side of the image) as well -
image
  1. Something weird is also happening with the Inertials -
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants