Editing a model and adding bodies through Matlab (specifically to attach and detach bodies during a trial)
- Sanchana Krishnakumar
- Posts: 11
- Joined: Thu Feb 06, 2020 7:38 am
Editing a model and adding bodies through Matlab (specifically to attach and detach bodies during a trial)
Hi! I am posting again because I did not get a reply last time. Please do help.
I am working on the Lifting full-body (LFB) model. My objective is to add an external box to the model and model a dynamic squat lifting trial. The box should be an external object and attach to the body only during lifting. The aim is to study the effect of interaction forces and the weight of the box during lifting. Is there a way to do this?
Right now, I am trying to add the box as a body in the model by creating a weld joint to the hand. But I would like to attach and detach the box during the trial. Therefore I want to model the box as an external object. The version of the OSIM document of the model is 4000. Are there example scripts that I could use as a reference to define the contact geometries and HuntCrossley forces?. I am open to both editing the model through Matlab or through an XML editor. I am quite new to editing models for the OpenSim therefore,any leads would be much appreciated. Thanks in advance.
Regards,
Sanchana
I am working on the Lifting full-body (LFB) model. My objective is to add an external box to the model and model a dynamic squat lifting trial. The box should be an external object and attach to the body only during lifting. The aim is to study the effect of interaction forces and the weight of the box during lifting. Is there a way to do this?
Right now, I am trying to add the box as a body in the model by creating a weld joint to the hand. But I would like to attach and detach the box during the trial. Therefore I want to model the box as an external object. The version of the OSIM document of the model is 4000. Are there example scripts that I could use as a reference to define the contact geometries and HuntCrossley forces?. I am open to both editing the model through Matlab or through an XML editor. I am quite new to editing models for the OpenSim therefore,any leads would be much appreciated. Thanks in advance.
Regards,
Sanchana
Tags:
Re: Editing a model and adding bodies through Matlab (specifically to attach and detach bodies during a trial)
Hi Sanchana,
What you're describing to do sounds like a pretty difficult problem. I'm not sure whether OpenSim has the capacity to enable/disable bodies midway through a simulation - but maybe one of the OpenSim team can come in to confirm this. I would think you'd have to break our motion down into two steps with two models (one with and without the box body) as an easier solution.
The notion of using a Weld joint to connect a box to the hands during a lifting task also isn't as simple as it seems, as I don't think the models like the fact that there is this 'closed-loop' style structure with both hands on the box (and you also can't have both hands as the parent body on the box). This paper (https://www.ncbi.nlm.nih.gov/pubmed/30714401) and it's associated SimTK project (https://simtk.org/projects/lfbmodel/) might be useful to look into. I remember speaking with the lead author (Erica) at an OpenSim workshop about the troubles of connecting a box to the hands during lifting tasks, and by the looks of their paper they went with the option of adding the mass of the box to the hands in the model.
Aaron
What you're describing to do sounds like a pretty difficult problem. I'm not sure whether OpenSim has the capacity to enable/disable bodies midway through a simulation - but maybe one of the OpenSim team can come in to confirm this. I would think you'd have to break our motion down into two steps with two models (one with and without the box body) as an easier solution.
The notion of using a Weld joint to connect a box to the hands during a lifting task also isn't as simple as it seems, as I don't think the models like the fact that there is this 'closed-loop' style structure with both hands on the box (and you also can't have both hands as the parent body on the box). This paper (https://www.ncbi.nlm.nih.gov/pubmed/30714401) and it's associated SimTK project (https://simtk.org/projects/lfbmodel/) might be useful to look into. I remember speaking with the lead author (Erica) at an OpenSim workshop about the troubles of connecting a box to the hands during lifting tasks, and by the looks of their paper they went with the option of adding the mass of the box to the hands in the model.
Aaron
- Sanchana Krishnakumar
- Posts: 11
- Joined: Thu Feb 06, 2020 7:38 am
Re: Editing a model and adding bodies through Matlab (specifically to attach and detach bodies during a trial)
Hi Aaron,
Thank you for your reply. I have also been thinking of splitting the trail into two parts of with and without box. However, I was curious to know if that is possible. I will probably wait to see if I get more responses on that.
About the weld joint, I was thinking to model the left hand as a parent and the box as the child. And then later using the child as a parent to define the right hand as a child. But now I realize that this might be complicated. If I do this, does this mean that the entire load would be exerted on the left hand?. Thank you very much for bringing up this closed-loop topic. I will investigate more on this.
About the alternative that you suggested, I am currently working on the model used in the paper that you have attached. Our basic idea was to compare the effect of adding the box to the model and then compare it with the torques generated by applying external loads on each of the hands.
Thank you again for your response.
Regards,
Sanchana Krishnakumar
Thank you for your reply. I have also been thinking of splitting the trail into two parts of with and without box. However, I was curious to know if that is possible. I will probably wait to see if I get more responses on that.
About the weld joint, I was thinking to model the left hand as a parent and the box as the child. And then later using the child as a parent to define the right hand as a child. But now I realize that this might be complicated. If I do this, does this mean that the entire load would be exerted on the left hand?. Thank you very much for bringing up this closed-loop topic. I will investigate more on this.
About the alternative that you suggested, I am currently working on the model used in the paper that you have attached. Our basic idea was to compare the effect of adding the box to the model and then compare it with the torques generated by applying external loads on each of the hands.
Thank you again for your response.
Regards,
Sanchana Krishnakumar
Re: Editing a model and adding bodies through Matlab (specifically to attach and detach bodies during a trial)
Hi Sanchana,
Splitting the trial would be no problems at all, you would just need to set the initial and final times appropriately in your analysis pipeline to start and stop at the right time - and repeat again for the second half.
It might be worthwhile contacting the team who set-up the model you are using to discuss the implementation of adding the box to the model (it looks like Erica is the corresponding author on the paper). I say this as I definitely think that they will have come across this problem and will likely have some good answers for you (and they might not monitor this forum). It will probably save you a lot of time to learn from what they tried/failed implementing with the model.
Aaron
Splitting the trial would be no problems at all, you would just need to set the initial and final times appropriately in your analysis pipeline to start and stop at the right time - and repeat again for the second half.
It might be worthwhile contacting the team who set-up the model you are using to discuss the implementation of adding the box to the model (it looks like Erica is the corresponding author on the paper). I say this as I definitely think that they will have come across this problem and will likely have some good answers for you (and they might not monitor this forum). It will probably save you a lot of time to learn from what they tried/failed implementing with the model.
Aaron
- Sanchana Krishnakumar
- Posts: 11
- Joined: Thu Feb 06, 2020 7:38 am
Re: Editing a model and adding bodies through Matlab (specifically to attach and detach bodies during a trial)
Hi,
Thank you very much for your reply. I will definitely do that.
Thank you very much for your reply. I will definitely do that.
- Carmichael Ong
- Posts: 401
- Joined: Fri Feb 24, 2012 11:50 am
Re: Editing a model and adding bodies through Matlab (specifically to attach and detach bodies during a trial)
Aaron's comments that this is a hard problem is correct. We usually strongly suggest splitting the simulation into parts, as Aaron suggested, if this still allows you to answer your research question.
While using HuntCrossleyForces would allow for the box to come in and out of contact, there is a lot of work to get the parameters of these tuned correctly, and lots of validation must be done. It also will likely cause the simulations to take much longer than with weld joints/constraints.
Constraints and joints in a model cannot be changed within a single simulation using Matlab. It would require expertise with C++, and working with event detection methods. For these reasons, it's much easier to simulate in parts, and change the model between these simulations.
While using HuntCrossleyForces would allow for the box to come in and out of contact, there is a lot of work to get the parameters of these tuned correctly, and lots of validation must be done. It also will likely cause the simulations to take much longer than with weld joints/constraints.
Constraints and joints in a model cannot be changed within a single simulation using Matlab. It would require expertise with C++, and working with event detection methods. For these reasons, it's much easier to simulate in parts, and change the model between these simulations.
- Sanchana Krishnakumar
- Posts: 11
- Joined: Thu Feb 06, 2020 7:38 am
Re: Editing a model and adding bodies through Matlab (specifically to attach and detach bodies during a trial)
Hi Carmichael,
Thank you very much for your reply. I sincerely apologise for the late reply. I had recently come across the soccer kicking model. In this model a foot ball was created as a external object and a free joint was created between the ball and the ground as a parent body. The contact forces between the ball and the leg was then defined. Is adopting a similar approach feasible to model the box?.
I also don't really understand about the part of iterating HuntCrossley forces.Could you please elaborate on this?
''While using HuntCrossleyForces would allow for the box to come in and out of contact, there is a lot of work to get the parameters of these tuned correctly, and lots of validation must be done. It also will likely cause the simulations to take much longer than with weld joints/constraints.''
Thank you for your time.
Regards,
Sanchana
Thank you very much for your reply. I sincerely apologise for the late reply. I had recently come across the soccer kicking model. In this model a foot ball was created as a external object and a free joint was created between the ball and the ground as a parent body. The contact forces between the ball and the leg was then defined. Is adopting a similar approach feasible to model the box?.
I also don't really understand about the part of iterating HuntCrossley forces.Could you please elaborate on this?
''While using HuntCrossleyForces would allow for the box to come in and out of contact, there is a lot of work to get the parameters of these tuned correctly, and lots of validation must be done. It also will likely cause the simulations to take much longer than with weld joints/constraints.''
Thank you for your time.
Regards,
Sanchana
- Carmichael Ong
- Posts: 401
- Joined: Fri Feb 24, 2012 11:50 am
Re: Editing a model and adding bodies through Matlab (specifically to attach and detach bodies during a trial)
On the first point: Yes, it's feasible to do something similar to the kicking example, but a box is much harder. With the kicking example, the ball only ever really contacts the foot once to apply forces. Holding an object is a much, much harder task in simulation than kicking a ball.
Part of this is to the last point: the problem will likely be much more sensitive to the parameters of the HuntCrossleyForce objects. You will have to iterate over these in order to make a simulation even work, and then do some validation to know that the forces were reasonable. Avoiding this all together would be the first step that I would take, especially if it's not needed for your research question.
Part of this is to the last point: the problem will likely be much more sensitive to the parameters of the HuntCrossleyForce objects. You will have to iterate over these in order to make a simulation even work, and then do some validation to know that the forces were reasonable. Avoiding this all together would be the first step that I would take, especially if it's not needed for your research question.
- Sanchana Krishnakumar
- Posts: 11
- Joined: Thu Feb 06, 2020 7:38 am
Re: Editing a model and adding bodies through Matlab (specifically to attach and detach bodies during a trial)
Yes, I get it now. Thank you.
Regards,
Sanchana Krishnakumar
Regards,
Sanchana Krishnakumar