Easy way to create Task.xml and Actuators.xml for a model

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Neethan Ratnakumar
Posts: 8
Joined: Wed Aug 14, 2019 1:35 pm

Easy way to create Task.xml and Actuators.xml for a model

Post by Neethan Ratnakumar » Thu Sep 05, 2019 6:12 am

Hi,

I am new to openSim and want to try out CMC with new models.

Is there any easy way to create the Task.xml and Actuators.xml files for a model, which can be then used for a CMC or RRA? Or do they have to be created manually each time?

Maybe, is there a script available?

Thank you.

Tags:

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Easy way to create Task.xml and Actuators.xml for a model

Post by Dimitar Stanev » Fri Sep 06, 2019 2:36 am

Typically, you can borrow and adapt the already existing files (e.g., from gait2392) for your model. Alternatively, you can write a script to automate this process. There are not any publicly available.

User avatar
Neethan Ratnakumar
Posts: 8
Joined: Wed Aug 14, 2019 1:35 pm

Re: Easy way to create Task.xml and Actuators.xml for a model

Post by Neethan Ratnakumar » Fri Sep 06, 2019 5:06 am

Thank you so much for your kind reply.

Can you please suggest me a document or any web link which talks about the xml files in detail? I have few doubts about what the weights and tracking coordinates physically mean in the Task.xml files. Also, I am not much clear about the requirement of additional actuators.

Also how do I ensure that my xml files have no errors?

Thank you again for your answer.

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

Re: Easy way to create Task.xml and Actuators.xml for a model

Post by jimmy d » Fri Sep 06, 2019 8:42 am

Future releases will include a matlab script for creating an actuators file. For now, you can find it here

User avatar
Neethan Ratnakumar
Posts: 8
Joined: Wed Aug 14, 2019 1:35 pm

Re: Easy way to create Task.xml and Actuators.xml for a model

Post by Neethan Ratnakumar » Sat Sep 07, 2019 1:57 pm

Thank you so much.

regards
Neethan

User avatar
RAHUL GHARATE
Posts: 84
Joined: Thu Jun 13, 2019 11:43 pm

Re: Easy way to create Task.xml and Actuators.xml for a model

Post by RAHUL GHARATE » Mon Sep 16, 2019 4:19 am

Respected Sir,
I have a tried a lot but don't get it how to provide actuator to the gait2354 model. So please tell me briefly.
Please help me.

User avatar
Evaa Martin
Posts: 1
Joined: Tue Sep 24, 2019 2:26 am

Re: Easy way to create Task.xml and Actuators.xml for a model

Post by Evaa Martin » Tue Sep 24, 2019 2:30 am

Thank you. It is helpful. I'd like to try it

User avatar
Ke Song
Posts: 5
Joined: Wed Apr 13, 2016 2:11 pm

Re: Easy way to create Task.xml and Actuators.xml for a model

Post by Ke Song » Tue Sep 24, 2019 7:45 am

jimmy wrote:
Fri Sep 06, 2019 8:42 am
Future releases will include a matlab script for creating an actuators file. For now, you can find it here
This is helpful for me too and thanks for sharing this code. I have a simple question: after creating this actuator ForceSet and saving it to an XML file '..._actuator.xml', how do I load it back into Matlab workspace later (in v4.0 API) ? Previously in v3.3, I used the syntax 'ForceSet(model,full_file_name)' to import a ForceSet from XML, but it seems such syntax has gone away in v4.0. What is the new way to load a previously saved actuator set from XML? Thanks.

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

Re: Easy way to create Task.xml and Actuators.xml for a model

Post by jimmy d » Tue Sep 24, 2019 9:37 am

Perhaps the constructor changed and takes different augments. It looks like you are trying to pass a Model object and a file path, in 4.0 the ForceSet takes just a file path to a ForceSet file and it seems to work fine.

Code: Select all

import org.opensim.modeling.*

% Generaate ForceSet file (.xml)
createActuatorsFile('gait2392_simbody.osim');

% Define the name of the ForceSet file (.xml)
filename = 'gait2392_simbody_actuators.xml';

% Construct a ForceSet from the the ForceSet file. 
fn = ForceSet(filename);

interfaces to classes often change between versions so it is handy to be able to figure out what the interface is. There is API documentation for each of the classes and you can use the methodsview() function in Matlab.

User avatar
Ke Song
Posts: 5
Joined: Wed Apr 13, 2016 2:11 pm

Re: Easy way to create Task.xml and Actuators.xml for a model

Post by Ke Song » Tue Sep 24, 2019 3:14 pm

jimmy wrote:
Tue Sep 24, 2019 9:37 am
Perhaps the constructor changed and takes different augments. It looks like you are trying to pass a Model object and a file path, in 4.0 the ForceSet takes just a file path to a ForceSet file and it seems to work fine.

Code: Select all

import org.opensim.modeling.*

% Generaate ForceSet file (.xml)
createActuatorsFile('gait2392_simbody.osim');

% Define the name of the ForceSet file (.xml)
filename = 'gait2392_simbody_actuators.xml';

% Construct a ForceSet from the the ForceSet file. 
fn = ForceSet(filename);

interfaces to classes often change between versions so it is handy to be able to figure out what the interface is. There is API documentation for each of the classes and you can use the methodsview() function in Matlab.
Hi James,

Thanks for the response. I tried only passing the actuator file path (a character string) in ForceSet but it did not work for me, instead an error was thrown: "No constructor 'org.opensim.modeling.ForceSet' with matching signature found." I checked methodsview of ForceSet and this was what I saw:
methodsview_ForceSet_API40.PNG
methodsview_ForceSet_API40.PNG (41.14 KiB) Viewed 1935 times
Apparently solely passing a file path String was not an option; the only available ForceSet constructor other than the default () was to pass in a long and a boolean parameter, which I am not sure how to use. Any idea why this happens? I am using the Matlab API with OpenSim version 4.0. Thanks again for the help!

POST REPLY