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
Prescribed Coordinates During CMC
Re: Prescribed Coordinates During CMC
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;
Let us know how it goes,
-james
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)
-james