Simbody is useful for internal coordinate and coarse grained molecule modeling, large scale mechanical models like skeletons, and anything else that can be modeled as bodies interconnected by joints, acted upon by forces, and restricted by constraints.
-
Musa Audu
- Posts: 52
- Joined: Mon Nov 24, 2008 11:30 am
Post
by Musa Audu » Tue Jan 14, 2025 2:35 pm
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?
-
Michael Sherman
- Posts: 814
- Joined: Fri Apr 01, 2005 6:05 pm
Post
by Michael Sherman » Tue Jan 14, 2025 3:20 pm
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.
-
Musa Audu
- Posts: 52
- Joined: Mon Nov 24, 2008 11:30 am
Post
by Musa Audu » Tue Jan 14, 2025 7:25 pm
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.
-
Michael Sherman
- Posts: 814
- Joined: Fri Apr 01, 2005 6:05 pm
Post
by Michael Sherman » Wed Jan 15, 2025 9:11 am
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
-
Musa Audu
- Posts: 52
- Joined: Mon Nov 24, 2008 11:30 am
Post
by Musa Audu » Wed Jan 15, 2025 1:47 pm
Great! Thank you very much for that insight. It works very well.