Prescribed Coordinates During CMC

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Colin Smith
Posts: 53
Joined: Fri Feb 24, 2012 11:50 am

Prescribed Coordinates During CMC

Post by Colin Smith » Sat May 10, 2014 12:04 am

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

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Prescribed Coordinates During CMC

Post by jimmy d » Tue May 27, 2014 3:18 pm

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

POST REPLY