Custom Coordinate Actuator for Forward Dynamics

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Jeffrey Berning
Posts: 2
Joined: Wed Aug 26, 2020 6:32 am

Custom Coordinate Actuator for Forward Dynamics

Post by Jeffrey Berning » Thu Oct 07, 2021 5:47 am

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

Tags:

User avatar
Thomas Uchida
Posts: 1794
Joined: Wed May 16, 2012 11:40 am

Re: Custom Coordinate Actuator for Forward Dynamics

Post by Thomas Uchida » Thu Oct 07, 2021 8:03 am

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.

User avatar
Jeffrey Berning
Posts: 2
Joined: Wed Aug 26, 2020 6:32 am

Re: Custom Coordinate Actuator for Forward Dynamics

Post by Jeffrey Berning » Thu Oct 07, 2021 12:05 pm

Thanks for the quick reply! The ExpressionBasedCoordinateForce is exactly what I was looking for.

POST REPLY