Page 1 of 1

system accelerations vector:

Posted: Tue Jan 14, 2025 2:35 pm
by mlaudu
We have a system with three degrees-of-freedom and we set out to solve for the accelerations
given the position, velocity and torque values. Our code looks like the following:

Code: Select all

	const ForceSet& fSet = model.getForceSet();
	for (i = 0; i < numActuators; i++)
	{
		ScalarActuator* act = dynamic_cast<ScalarActuator*>(&fSet.get(i));
		if (act) 
			act->setOverrideActuation(state, -jTorques[i]);
	}

	model.getMultibodySystem().realize(state, SimTK::Stage::Acceleration);
	SimTK::Vector udot = model.getMatterSubsystem().getUDot(state);

	for (i = 0; i < numActuators; i++)
		xDot[i] = udot[i];
With this code, however, we realize that the accelerations returned remain
insensitive to the applied joint torques. Can someone let us know what is
wrong with the code?

Re: system accelerations vector:

Posted: Tue Jan 14, 2025 3:20 pm
by sherm
This looks like OpenSim code? If so you'll need to post it on OpenSim's forum to get the question to someone that speaks OpenSim.

Re: system accelerations vector:

Posted: Tue Jan 14, 2025 7:25 pm
by mlaudu
I apologize Sherm. However, I want to cast my question to target the SimTK Community. If one has the position, velocity and hinge torque values for a system such as a double pendulum, it should be possible to use these to compute the resulting acceleration. If so, what is the Simbody function to use to apply the hinge torques prior to calling getUdot() or other function to get the resulting accelerations?
Thanks for any insight.

Re: system accelerations vector:

Posted: Wed Jan 15, 2025 9:11 am
by sherm
Hi, Musa.

You might find this SimbodyMatterSubsystem method useful if you're going to work directly with Simbody: calcAcceleration().

There are various functions (joint type dependent) for helping to fill in the force vectors. There is a user guide that explains the basic Simbody abstractions.

Regards,
Sherm

Re: system accelerations vector:

Posted: Wed Jan 15, 2025 1:47 pm
by mlaudu
Great! Thank you very much for that insight. It works very well.