Change location pointactuator (Matlab API)

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Maarten Afschrift
Posts: 7
Joined: Sat Oct 20, 2012 4:09 am

Change location pointactuator (Matlab API)

Post by Maarten Afschrift » Thu Jun 06, 2013 11:55 pm

Dear Opensim Users,

I’ve a question with regards to defining a pointactuator through the matlab API. After scaling of the model, I want to adjust the location of the residual actuators in the actuator file .

As you can see in the functions below, I search for the location of the COM of the pelvis in the scaled model. Then I want to adjust the location of the pointactuator in the settingsfile. But there is no function like Setpoint…

% search for the hip of the scaled model
model=Model(model_file);
pelvis=model.getBodySet().get('pelvis');

% get the center of mass of the hip
COM_pelvis=ArrayDouble.createVec3([0,0,0]);
pelvis.getMassCenter(COM_pelvis);

% read the actuator file
Acatuator_file=ForceSet(model,’Actuator_file.xml’);
actuators= Acatuator_file.updActuators();

% get the FX (FY and FZ) point actuators
FX=actuators.get('FX');

SO the general question is: How can you adjust the location of a pointactuator?
(For example by FX.setPoint(COM_pelvis) ?).

Regards,
Maarten

User avatar
Ayman Habib
Posts: 2238
Joined: Fri Apr 01, 2005 12:24 pm

Re: Change location pointactuator (Matlab API)

Post by Ayman Habib » Fri Jun 07, 2013 11:22 am

Hi Maarten,

Indeed, the method to set_point exists on the PointActuator (using version 3.1 beta), but when you get the Actuator from the list it's base class only. You need to cast to proper type using

Code: Select all

fxPointActuator = PointActuator.safeDownCast(FX)


then you can invoke PointActuator methods on fxPointActuator.

Hope this helps,
-Ayman

POST REPLY