Page 1 of 1

Prescribed Coordinates During CMC

Posted: Sat May 10, 2014 12:04 am
by clnsmith
Is there a way to prescribe a coordinate as function of time in the CMC tool? I am currently prescribing it in the .osim file, however the results show that the model is not following the prescribed function. I am using a SimmSpline with data from Inverse Kinematics.

Thanks,
Colin

Re: Prescribed Coordinates During CMC

Posted: Tue May 27, 2014 3:18 pm
by jimmy
Hi Colin,

Prescribed motion is treated as a constraint in the system and should be respected during simulation.

Here is some code that we use in GUI scripting to add a prescribed motion to a coordinate;

Code: Select all

oldName = oldModel.getName()
newModel.setName(oldName + "_prescribedMotion")
# Create PrescribedFunction.
slope = -0.1
yintercept = 0.05
myFunction = modeling.LinearFunction(slope, yintercept)
# Assign PrescribedFunction to specify the motion of the block.
prismaticJoint = newModel.getJointSet().get('ground_block').getCoordinateSet().get(0)
prismaticJoint.set_prescribed_function(myFunction)
prismaticJoint.set_prescribed(True)
# Save new model.
oldPathName = oldModel.getInputFileName()
newPathName = oldPathName.replace('.osim', '_prescribedMotion.osim')
newModel.print(newPathName)
Let us know how it goes,
-james