Hi,
I am working with the example: 'Create an Optimization' with OpenSim 3.0 and manage to run the optimization. However, I noticed that the elbow is excessively over-extending. To prevent this from happening I though I could easily add a constraint or bounds to the optimization. But I can't figure out how to do this. Somewhere I have to introduce additional parameters(joint angles) which are not taking in as design parameters in the optimization but are used as constraints.
Does someone has an idea how to incorporate this in the example?
Kind regards,
Erik
Optimization constraints
- Ayman Habib
- Posts: 2255
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Optimization constraints
Hi Eric,
The bounds on coordinates are not part of the model as you'd have to model how the elbow is handled at/near the limit and what forces are applied to enforce it. You could do the limits during the optimization or if you want to build it into the model add a CoordinateLimitForce to stop the elbow from hyper-extending.
Hope this helps,
-Ayman
The bounds on coordinates are not part of the model as you'd have to model how the elbow is handled at/near the limit and what forces are applied to enforce it. You could do the limits during the optimization or if you want to build it into the model add a CoordinateLimitForce to stop the elbow from hyper-extending.
Hope this helps,
-Ayman
- Erik Dijkstra
- Posts: 21
- Joined: Wed Aug 18, 2010 5:24 am
Re: Optimization constraints
Hi Ayman,
Thank you for your reply. I successfully build the coordinate limits in the model. However, I can't seem to get the limits working by constraining in the optimization instead of in the model. I wrote an inequality constraint by getting the elbow coordinate value and specify that it should be greater or equal to zero.
Since it didn't work I looked at an optimization example from SimTKmath and noticed that I might have to provide the jacobian. Is there a way to I get the Jacobian with respect to opensim model coordinates?
Best regards,
Erik
Thank you for your reply. I successfully build the coordinate limits in the model. However, I can't seem to get the limits working by constraining in the optimization instead of in the model. I wrote an inequality constraint by getting the elbow coordinate value and specify that it should be greater or equal to zero.
Since it didn't work I looked at an optimization example from SimTKmath and noticed that I might have to provide the jacobian. Is there a way to I get the Jacobian with respect to opensim model coordinates?
Best regards,
Erik
- Michael Sherman
- Posts: 814
- Joined: Fri Apr 01, 2005 6:05 pm
Re: Optimization constraints
Hi, Erik. The Simbody optimizers can compute the Jacobian numerically if you don't supply one. There is a SimTKmath example called ConstrainedNumericalDiffOptimization that demonstrates.
Regards,
Sherm
Regards,
Sherm