Applying External Forces/Torques from a device/exoskeleton

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Rachel Jackson
Posts: 5
Joined: Thu Nov 21, 2013 1:12 pm

Applying External Forces/Torques from a device/exoskeleton

Post by Rachel Jackson » Wed May 07, 2014 5:45 am

Hi! I was wondering if anyone knew how to add an additional torque applied from an external device, such as an ankle exoskeleton? In our experiments, subjects wore an ankle exoskeleton that applied plantarflexor torques about the ankle and I wanted to add this into my OpenSim model so the resulting estimated muscle activities/mechanics more accurately represented the human contribution. I found ways of applying forces to a point or body by defining these forces in the actuators.xml file, but this requires that I know the magnitude of the forces and the points of application. Is there a similar way of applying a defined torque about a certain joint (e.g. the ankle)? Another option I found was adding an additional actuator to the model itself and having the external device behave like something internal to the model, because these actuators have the capability of applying torques about certain coordinates. Any ideas about the best way to proceed would be greatly appreciated.

Thanks,
Rachel

User avatar
Dominic Farris
Posts: 2
Joined: Tue Mar 13, 2012 11:33 am

Re: Applying External Forces/Torques from a device/exoskelet

Post by Dominic Farris » Wed May 14, 2014 9:46 pm

Hi Rachel,

In a very similar situation I needed to apply an experimentally measured ankle exoskeleton torque to a lower limb model in opensim. Our approach was to to apply the measured torque as equal and opposite torques acting on the shank (tibia) and foot (talus) segments (bodies) in the model. We did this by writing these torques to Simm Splines and then adding them to the model's force set as Prescribed Forces. This was all done with the Matlab scripting that I have posted below.This was done over a year ago so I can't vouch for the code still working with new releases of OpenSim but you can probably get the idea of what's happening. We also gave an opensim webinar presenting this work a little while ago that should be available on the OpenSim website somewhere.

Hope this is some help,

Dominic

import org.opensim.modeling.* % import classes from jar file
ModelFile = [data.Name,'_SCALED_IK.osim'];% Specify a model file
OsimModel = Model(ModelFile); % Construct a model object from the existing model

TibSpline = SimmSpline(); % construct spline objects to hold the torque data
TalSpline = SimmSpline();
for i = 1:length(ExoTorque);
TibSpline.addPoint(AnalogTime(i),ExoTorque(i)*-1); % add the torque data to spline functions
TalSpline.addPoint(AnalogTime(i),ExoTorque(i)); % to be applied to the tibia and talus
end
% The torque is only applied about the z-axis so create zero constants for
% the x and y components
Xconst = Constant();
Xconst.setValue(0.0);
Yconst = Constant();
Yconst.setValue(0.0);

ExoForce1 = PrescribedForce(); % Construct a prescribed force object for the torque applied
ExoForce1.setName('exo_tibia_torque'); % to the tibia
ExoForce1.setBodyName('tibia_r');
ExoForce1.setTorqueFunctions(Xconst,Yconst,TibSpline);

ExoForce2 = PrescribedForce();% Construct a prescribed force object for the torque applied
ExoForce2.setName('exo_talus_torque'); % to the talus
ExoForce2.setBodyName('talus_r');
ExoForce2.setTorqueFunctions(Xconst,Yconst,TalSpline);

% Get the model's force set and give it the prescribed forces
ModelForces = OsimModel.getForceSet();
ModelForces.adoptAndAppend(ExoForce1);
ModelForces.adoptAndAppend(ExoForce2);

OsimModel.print([data.Name '_Scaled_IK_EXO.osim']);

User avatar
Rachel Jackson
Posts: 5
Joined: Thu Nov 21, 2013 1:12 pm

Re: Applying External Forces/Torques from a device/exoskelet

Post by Rachel Jackson » Mon May 19, 2014 8:29 am

Thank you, Dominic!

I actually implemented something very similar to what you suggested. I just added equal and opposite torques applied to the tibia and calcaneus to the external loads file.

Best,
Rachel

User avatar
ashely yu
Posts: 4
Joined: Sun Dec 02, 2018 8:10 pm

Re: Applying External Forces/Torques from a device/exoskeleton

Post by ashely yu » Thu Apr 11, 2019 4:51 am

Hi there,
I was wondering why the codes above can't run in the Matlab and want some help if anyone knows.
I am trying to add a varing torque to my model, and just copy the codes only change some load file, but it seems that the problem is not about the version and the load files.
The error said: it is in the line2 and told me that the variable "data" or the function "data.Name" is undefined.

thanks a lot.

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Applying External Forces/Torques from a device/exoskeleton

Post by jimmy d » Thu Apr 11, 2019 6:51 am

Because 'data' is a local variable that was used by the poster to store different types of data.

User avatar
ashely yu
Posts: 4
Joined: Sun Dec 02, 2018 8:10 pm

Re: Applying External Forces/Torques from a device/exoskeleton

Post by ashely yu » Tue Sep 03, 2019 7:06 am

jimmy wrote:
Thu Apr 11, 2019 6:51 am
Because 'data' is a local variable that was used by the poster to store different types of data.
thank you, James. Did you know the definition of data?

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Applying External Forces/Torques from a device/exoskeleton

Post by jimmy d » Tue Sep 03, 2019 7:08 am

No.

POST REPLY