unable to run static optimization with clutchedpathspring
- Chetan Thakur
- Posts: 17
- Joined: Mon Oct 12, 2015 1:35 am
unable to run static optimization with clutchedpathspring
Hi
I am using model and data provided in working with static optimization tutorial. I am trying to mimic actuator behavior by allowing it to actuate only during heels down and deactivate on heels up.
To do this I am using clutchedpathspring and controller to provide time and switch on flags. My .osim file is created properly but when I run static optimization I see no change in results of with and without clutchedpathspring. How do I figure out where is the problem ?
I am using model and data provided in working with static optimization tutorial. I am trying to mimic actuator behavior by allowing it to actuate only during heels down and deactivate on heels up.
To do this I am using clutchedpathspring and controller to provide time and switch on flags. My .osim file is created properly but when I run static optimization I see no change in results of with and without clutchedpathspring. How do I figure out where is the problem ?
- Attachments
-
- subject01_RRA_Adjusted_clutchedpathspring.osim
- model file(.osim) created using the attached code.
- (194.46 KiB) Downloaded 113 times
-
- addmuscle.txt
- method with code I am using.
- (2.33 KiB) Downloaded 94 times
- Chetan Thakur
- Posts: 17
- Joined: Mon Oct 12, 2015 1:35 am
Re: unable to run static optimization with clutchedpathspring
In the controllerset I added actuator list and piecewiseconstant function properties. I did not add control file.
Could this be reason for no change in results of static optimization with and without actuator. If yes how to create control file.
Thanks
-Chetan
Could this be reason for no change in results of static optimization with and without actuator. If yes how to create control file.
Thanks
-Chetan
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: unable to run static optimization with clutchedpathspring
Hi,
I think that during SO, all the controller are disabled.
https://github.com/opensim-org/opensim- ... n.cpp#L334
I am not sure what you want to do, but if you provide more details, maybe we can suggest you a workaround.
Regards
I think that during SO, all the controller are disabled.
https://github.com/opensim-org/opensim- ... n.cpp#L334
I am not sure what you want to do, but if you provide more details, maybe we can suggest you a workaround.
Regards
- Chetan Thakur
- Posts: 17
- Joined: Mon Oct 12, 2015 1:35 am
Re: unable to run static optimization with clutchedpathspring
In my experiment I use assistive along thigh muscle and measure the changes in gait. This assistive is actuates during initial swing between heels down and heels up period.
In opensim I am using model n data provided in working with static optimization tutorial.
When I run static optimization with pathspring as assistive force I could observe changes in the muscle activation and muscle force.
But when I try to mimic experiment behavior (assistive is actuates during initial swing between heels down and heels up period), using clutched pathspring by using time of heels down to provide control signal to clutchedpathspring. But as you said controllers are disabled during static optimization.
What would be alternative solution for this ?
In opensim I am using model n data provided in working with static optimization tutorial.
When I run static optimization with pathspring as assistive force I could observe changes in the muscle activation and muscle force.
But when I try to mimic experiment behavior (assistive is actuates during initial swing between heels down and heels up period), using clutched pathspring by using time of heels down to provide control signal to clutchedpathspring. But as you said controllers are disabled during static optimization.
What would be alternative solution for this ?
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: unable to run static optimization with clutchedpathspring
Hi,
It seems that the ClutchedPathSpring, is an Actuators, so probably SO is aware and produces control signals (can you check the control signals from SO to verify?). What you need to do is to increase the optimal force of the ClutchedPathSpring (by default is probably 1) so it will be preferred to muscles during optimization. Unfortunately, StaticOptimizationTarget is designed to work with optimal force, but in your case ClutchedPathSpring does not use the optimal forces to produce tension but has a more complex expression, thus if you set a value for the optimal force it will not correspond to the tension that will be developed by ClutchedPathSpring for a given control signal. I think you have two options as far as I can tell 1) to use different assistance device, 2) implement your own StaticOptimizationTarget and to account correctly for ClutchedPathSpring. Maybe someone else can suggest something better.
https://github.com/opensim-org/opensim- ... t.cpp#L110
Regards
It seems that the ClutchedPathSpring, is an Actuators, so probably SO is aware and produces control signals (can you check the control signals from SO to verify?). What you need to do is to increase the optimal force of the ClutchedPathSpring (by default is probably 1) so it will be preferred to muscles during optimization. Unfortunately, StaticOptimizationTarget is designed to work with optimal force, but in your case ClutchedPathSpring does not use the optimal forces to produce tension but has a more complex expression, thus if you set a value for the optimal force it will not correspond to the tension that will be developed by ClutchedPathSpring for a given control signal. I think you have two options as far as I can tell 1) to use different assistance device, 2) implement your own StaticOptimizationTarget and to account correctly for ClutchedPathSpring. Maybe someone else can suggest something better.
https://github.com/opensim-org/opensim- ... t.cpp#L110
Regards
- Chetan Thakur
- Posts: 17
- Joined: Mon Oct 12, 2015 1:35 am
Re: unable to run static optimization with clutchedpathspring
Hi
I checked controls file generated from SO and it does not creates control signal for clutched path spring (I have attached the controls file actuator name = "leftleg").
I cannot change the assistive device so the only option is to have our own staticOptimizationTarget. I think it will take a while for me because I am not fully familiar with opensim philosophy.
Is there anyone who faces similar issue and has found the workaround without really having to write his/her own staticOptimizationTarget ?
Thanks
Chetan
I checked controls file generated from SO and it does not creates control signal for clutched path spring (I have attached the controls file actuator name = "leftleg").
I cannot change the assistive device so the only option is to have our own staticOptimizationTarget. I think it will take a while for me because I am not fully familiar with opensim philosophy.
Is there anyone who faces similar issue and has found the workaround without really having to write his/her own staticOptimizationTarget ?
Thanks
Chetan
- Attachments
-
- 20160908_2_StaticOptimization_controls.xml
- controls generated from SO
- (417.85 KiB) Downloaded 84 times
- Chetan Thakur
- Posts: 17
- Joined: Mon Oct 12, 2015 1:35 am
Re: unable to run static optimization with clutchedpathspring
@Dimitar
Can you tell me if possible why static optimization disables all the controllers ? What are the implications of these ?
I could not understand this or get clue.
Thanks
Chetan
Can you tell me if possible why static optimization disables all the controllers ? What are the implications of these ?
I could not understand this or get clue.
Thanks
Chetan
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: unable to run static optimization with clutchedpathspring
Hi,
There are two ways to solve the static optimization problem. Remember that the optimization tries to find a minimal set of activations a subject to the equality constraints tau = R * f(a) (1), where R is the moment arm matrix nxm and f is a vector of muscle forces for a given set of activation level.
The straight way would be to 1) realize the model to position level, 2) to compute the matrix R, 3) then to estimate the muscle forces f that will be produced for an activation level a and 4) to check whether the equality hold, and if not to find another set of activations, to recompute the muscle forces and to evaluate (1) again.
The estimation of the muscle forces is difficult because the force of the muscle is a dynamic state, there is an alternative approach, the one that is implemented. Compute a set of activation levels a and apply them to the muscles, then integrate forward in time and compute the acceleration produced by the muscle forces (needs to realize the model through acceleration level). Then compare the acceleration produced by the muscles to the one produced if tau is applied and use this comparison as an evaluation of how close you achieve equality (1).
Because the system is evaluated to acceleration level if you had any controllers added to your model sometimes you may introduce an infinite loop, and more importantly you don't want any controller to alter the activation levels that you provided.
Best
There are two ways to solve the static optimization problem. Remember that the optimization tries to find a minimal set of activations a subject to the equality constraints tau = R * f(a) (1), where R is the moment arm matrix nxm and f is a vector of muscle forces for a given set of activation level.
The straight way would be to 1) realize the model to position level, 2) to compute the matrix R, 3) then to estimate the muscle forces f that will be produced for an activation level a and 4) to check whether the equality hold, and if not to find another set of activations, to recompute the muscle forces and to evaluate (1) again.
The estimation of the muscle forces is difficult because the force of the muscle is a dynamic state, there is an alternative approach, the one that is implemented. Compute a set of activation levels a and apply them to the muscles, then integrate forward in time and compute the acceleration produced by the muscle forces (needs to realize the model through acceleration level). Then compare the acceleration produced by the muscles to the one produced if tau is applied and use this comparison as an evaluation of how close you achieve equality (1).
Because the system is evaluated to acceleration level if you had any controllers added to your model sometimes you may introduce an infinite loop, and more importantly you don't want any controller to alter the activation levels that you provided.
Best
- Karthick Ganesan
- Posts: 119
- Joined: Thu Oct 10, 2013 12:11 am
Re: unable to run static optimization with clutchedpathspring
Hi,
I am also facing similar problem. I am using clutchedPathSpring and performing static optimization. Clutch is activated for a portion of time. But no force is produced. Stretch (z) is zero throughout. What may be the problem? Please suggest.
@Chetan, Hi. Did you find a solution to your problem?
Thanks & Regards,
Karthick.
I am also facing similar problem. I am using clutchedPathSpring and performing static optimization. Clutch is activated for a portion of time. But no force is produced. Stretch (z) is zero throughout. What may be the problem? Please suggest.
@Chetan, Hi. Did you find a solution to your problem?
Thanks & Regards,
Karthick.