Pin Joint "Motor" Actuation in SCONE

SCONE is a software tool for predictive simulations of biomechanical movement. It uses OpenSim for modeling and simulation, and performs optimization using various control strategies, including feed-forward control, proprioceptic feedback control, and bal
POST REPLY
User avatar
D T
Posts: 24
Joined: Thu Nov 21, 2019 3:40 pm

Pin Joint "Motor" Actuation in SCONE

Post by D T » Wed Jun 03, 2020 8:02 am

Hi Thomas,

I am trying to create a optimization problem that uses the Human0914 model with disabled tibia_ant_r, gastroc_r, and soleus_r muscles. Instead, I would like to model the right ankle pin joint as a direct torque controlled "motor" example. Working from the balance controller example, I attempted to first just have the simulation apply an equal and opposing moment to the talus_r body much like the already present balancing mechanic. This gave mixed results.

Is there a way in SCONE to instead apply moments to the ankle joint rather than a specified body? For example,
target_joint:add_external_moment( 0, 0, sample_moment ). I was unable to find Lua documentation on a similar call to model:find_body that would apply to joints.

Additionally, are there ways to allow this joint moment application to attempt to mimic the gait patterns of the other leg (in it's own respective offset gait cycle)? I assume I would need to create a custom gait controller that has its own respective swing, stance, etc phases much like the Geyer&Herr sample, but instead for a direct torque.

User avatar
Thomas Geijtenbeek
Posts: 432
Joined: Wed Mar 12, 2014 8:08 am

Re: Pin Joint "Motor" Actuation in SCONE

Post by Thomas Geijtenbeek » Fri Jun 05, 2020 5:42 am

The way to go is to add a CoordinateActuator to the OpenSim model, which acts as a motor for a specific coordinate (or degree-of-freedom / DOF, as they're called in SCONE). You can then control this actuator in SCONE with a ScriptController via a lua_dof. Inside init() you get the lua_dof:

Code: Select all

ankle_motor = model:find_dof('ankle_r')
Then, you can set the actuator control value (usually between -1 and 1) in the update function:

Code: Select all

ankle_motor:add_input( control_value )
If you wish for your controller to be active only during specific states, you can modify the GeyerHerrControll2010.scone example and add your custom ScriptController as a ConditionalController, similar to how the ReflexControllers are specified.

User avatar
D T
Posts: 24
Joined: Thu Nov 21, 2019 3:40 pm

Re: Pin Joint "Motor" Actuation in SCONE

Post by D T » Fri Jun 05, 2020 8:57 pm

tgeijten wrote:
Fri Jun 05, 2020 5:42 am
The way to go is to add a CoordinateActuator to the OpenSim model, which acts as a motor for a specific coordinate (or degree-of-freedom / DOF, as they're called in SCONE). You can then control this actuator in SCONE with a ScriptController via a lua_dof. Inside init() you get the lua_dof:

Code: Select all

ankle_motor = model:find_dof('ankle_r')
Then, you can set the actuator control value (usually between -1 and 1) in the update function:

Code: Select all

ankle_motor:add_input( control_value )
If you wish for your controller to be active only during specific states, you can modify the GeyerHerrControll2010.scone example and add your custom ScriptController as a ConditionalController, similar to how the ReflexControllers are specified.
Thank you for the reply. The current GaitController seems to control both left and right sides in the same manner (meaning as each independent leg reaches its current state, it calls the appropriate reflex, muscle, or custom script controller). However, I don't see a way to have the controller only track a single leg's gait. For example, since one leg functions off of the default muscular controllers in its phases, but the other GaitController has a custom script controller prescribing torques, I am unsure of how to specify the GaitController should only be tracking/prescribing one side. Otherwise, the controller will call the one leg's custom gait stance function when either leg is in that gait stance.

User avatar
Thomas Geijtenbeek
Posts: 432
Joined: Wed Mar 12, 2014 8:08 am

Re: Pin Joint "Motor" Actuation in SCONE

Post by Thomas Geijtenbeek » Mon Jun 08, 2020 4:08 am

I see your point -- the GaitStateController indeed automatically creates Controllers for both legs. Even though the control parameters can be different for left and right, the structure currently cannot. You can still detect the side inside a ScriptController (it's a parameter during initialization), but that doesn't help you with the ReflexControllers.

This does seem like an important use-case, so I'll try and squeeze in support this for the next release (which is due soon).

My initial idea is to have a "legs" parameter similar to "states", so you could do something like:

Code: Select all

ConditionalController {
	states = "EarlyStance LateStance Liftoff"
	legs = left
	...
}
"legs" would then default to "both", so existing controllers wouldn't be affected.

Would this helpful?

User avatar
D T
Posts: 24
Joined: Thu Nov 21, 2019 3:40 pm

Re: Pin Joint "Motor" Actuation in SCONE

Post by D T » Sat Jun 13, 2020 7:54 pm

tgeijten wrote:
Mon Jun 08, 2020 4:08 am
I see your point -- the GaitStateController indeed automatically creates Controllers for both legs. Even though the control parameters can be different for left and right, the structure currently cannot. You can still detect the side inside a ScriptController (it's a parameter during initialization), but that doesn't help you with the ReflexControllers.

This does seem like an important use-case, so I'll try and squeeze in support this for the next release (which is due soon).

My initial idea is to have a "legs" parameter similar to "states", so you could do something like:

Code: Select all

ConditionalController {
	states = "EarlyStance LateStance Liftoff"
	legs = left
	...
}
"legs" would then default to "both", so existing controllers wouldn't be affected.

Would this helpful?
First of all, I do appreciate your work in this field because there are not many other fully working projects like SCONE. Yes, the individual controllers would be exactly what I am attempting to do. I feel like this would be very useful for others who are trying to model gait prosthetics, since most often a person only uses one able bodied leg and one prosthetic aided leg (i.e., one perfect controller like SCONE has and one custom controller the researcher would develop). Take your time with what you decide for releases, there are certainly ways to work around this.

User avatar
Thomas Geijtenbeek
Posts: 432
Joined: Wed Mar 12, 2014 8:08 am

Re: Pin Joint "Motor" Actuation in SCONE

Post by Thomas Geijtenbeek » Tue Jun 16, 2020 6:45 am

Thanks -- this feature has been added to the upcoming 1.5.0 release.

User avatar
Thomas Geijtenbeek
Posts: 432
Joined: Wed Mar 12, 2014 8:08 am

Re: Pin Joint "Motor" Actuation in SCONE

Post by Thomas Geijtenbeek » Sun Jun 21, 2020 6:20 am

A new release that includes this feature is available for download.

POST REPLY