How to use PrescribedForce just in the opensim GUI?
Posted: Sun Apr 07, 2019 8:05 pm
hello everyone, I want to add an ankle spring on the foot like the Tutorials 'Simulation-Based Design to Reduce Metabolic Cost', the code is:
# Get a handle to the current model and create a new copy
baseModel = getCurrentModel()
ankleSpringModel = baseModel.clone()
ankleSpringModel.setName(baseModel.getName() + '_ankle_spring')
# Create the spring we'll add to the model (a CoordinateLimitForce in OpenSim)
ankleSpring = modeling.CoordinateLimitForce()
ankleSpring.setName('AnkleLimitSpringDamper')
# Set the coordinate for the spring
ankleSpring.set_coordinate('ankle_angle_r')
# Add the spring to the model
ankleSpringModel.addForce(ankleSpring)
# Load the model in the GUI
loadModel(ankleSpringModel)
I need to apply a linear force changing with time , PrescribedForce may work. I have read the Doxygen of the PrescribedForce, But I know little about programming languages, so could someone good enough to give me some examples of PrescribedForce code in the opensim GUI.
# Get a handle to the current model and create a new copy
baseModel = getCurrentModel()
ankleSpringModel = baseModel.clone()
ankleSpringModel.setName(baseModel.getName() + '_ankle_spring')
# Create the spring we'll add to the model (a CoordinateLimitForce in OpenSim)
ankleSpring = modeling.CoordinateLimitForce()
ankleSpring.setName('AnkleLimitSpringDamper')
# Set the coordinate for the spring
ankleSpring.set_coordinate('ankle_angle_r')
# Add the spring to the model
ankleSpringModel.addForce(ankleSpring)
# Load the model in the GUI
loadModel(ankleSpringModel)
I need to apply a linear force changing with time , PrescribedForce may work. I have read the Doxygen of the PrescribedForce, But I know little about programming languages, so could someone good enough to give me some examples of PrescribedForce code in the opensim GUI.