Page 1 of 1

Torque Actuator axis of action

Posted: Fri Oct 09, 2020 5:56 am
by wiredchop
Hello all,

I'm just getting started with OpenSim and I'm building a very simple model to try to simulate the effects of different inertial properties on simple motion. I have created a single, free body and I'd like to apply a torque about a single axis -- observing the angular velocity after a certain period of time.
One of the things I'm interested in is the effect offset mass on rotation. To do this, I'm specifying the centre of mass location of the body, setting up a free joint with ground and then creating a torque actuator.
However, it seems that the angular velocity of the body is independent of mass offset. I would expect angular velocity to decrease as the centre of mass moves away from the torque axis.
My suspicion is that I'm setting things up incorrectly and the torque is acting around the bodies centre of mass. However, it's not clear to me how to change this!?
Any help greatly appreciated. I've included some code below.

Code: Select all

%Body
r1  = Body('rod1', M, Vec3(COM(1),COM(2),COM(3)), Inertia(I(1),I(2),I(3),I(4),I(5),I(6)));
model.addBody(r1);

% Joint
% Situating the free joint in the centre off the segment
p1 = FreeJoint('pin1', model.getGround(), Vec3(0,2,0), Vec3(0), r1, Vec3(0,L/2,0), Vec3(0));
model.addJoint(p1);

% Attach geometry to the bodies
g = Cylinder(0.1,L); g.setColor(Vec3(1));
r1b = PhysicalOffsetFrame(); r1b.setName('r1b');
r1b.setParentFrame(r1); r1b.setOffsetTransform(Transform(Vec3(0, 0.0, 0)));
r1.addComponent(r1b); r1b.attachGeometry(g.clone());

%% Add a Torque Actuator
torqueActuator = TorqueActuator(model.getGround(),r1,Vec3(0,1,0),1);% Create a TorqueActuator Object
torqueActuator.setOptimalForce(10);
torqueActuator.setName('Torque');
model.addForce(torqueActuator);

I have omitted the code regarding the controller and reporting etc.

Thanks for your time,

Wiredchop

Re: Torque Actuator axis of action

Posted: Fri Oct 09, 2020 6:56 am
by bogert
Simon,

I think there is a simple explanation. You are using a free joint, so your cylinder is just floating in space.

If you apply a 3D torque, it will always rotate about the center of mass. Moving the center of mass relative to the body's coordinate system does not make a difference. Basically you are just moving the coordinate system away from the center of mass, and the coordinate system has no physical meaning.

To do the experiment correctly, you could split the body mass in two, and move the two masses away from each other. Theoretically, you can predict the effect from the parallel axis theorem: the moment of inertia is increased.

In opensim, you could do it by attaching a second body to the first body, with a weld joint, so it is effectively just one body but you can manipulate the separation of the two masses.

Another way to simulate the effect of center of mass is to attach the body to ground with a spherical joint (instead of a free joint). Now the axis of rotation is fixed, and you can move the center of mass away from it, and observe a reduction in the angular acceleration. Again you should get results that are consistent with the parallel axis theorem.

Ton van den Bogert

Re: Torque Actuator axis of action

Posted: Fri Oct 09, 2020 7:43 am
by wiredchop
Fantastic, that makes sense and thanks a lot for your suggestions.