Page 1 of 1

Custom Coordinate Actuator for Forward Dynamics

Posted: Thu Oct 07, 2021 5:47 am
by jb139
I've created a model of an exoskeleton in OpenSim and am attempting to run Forward Dyanmics using the Matlab API. I would like to include friction as a function of the coordinate speeds, but I cannot find a simple way to achieve this. I started with the following two methods, but I am hoping there is a cleaner way to implement a custom friction actuator.

First, I used the manager tool in Matlab to simulate through time. At each time step, I updated the optimalForce value of coordinate actuators that corresponded to each of my robot joints. I calculated these new optimalForce values using the coordinate speeds and my desired friction function. This worked because I set the prescribed control function for each actuator to be a constant value of 1.

Second, I created a FrictionTorque class in Cpp and used that as a plugin to the Matlab API.

Is there a simpler or cleaner way to achieve this? My end goal is to be able to assign a friction torque to each coordinate that is an arbitrary function, maybe tanh, of my coordinates/speeds and run Forward Dynamics using the Matlab API.

Thanks,
Jeff

Re: Custom Coordinate Actuator for Forward Dynamics

Posted: Thu Oct 07, 2021 8:03 am
by tkuchida
If the force for a coordinate depends only on its value and derivative, you could use an ExpressionBasedCoordinateForce (see https://simtk.org/api_docs/opensim/api_ ... Force.html). The ExpressionBasedBushingForce (https://simtk.org/api_docs/opensim/api_ ... ml#details) may also work, depending the details.

Re: Custom Coordinate Actuator for Forward Dynamics

Posted: Thu Oct 07, 2021 12:05 pm
by jb139
Thanks for the quick reply! The ExpressionBasedCoordinateForce is exactly what I was looking for.