Page 1 of 1

Change location pointactuator (Matlab API)

Posted: Thu Jun 06, 2013 11:55 pm
by maaafsch
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

Re: Change location pointactuator (Matlab API)

Posted: Fri Jun 07, 2013 11:22 am
by aymanh
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