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
Custom Coordinate Actuator for Forward Dynamics
- Jeffrey Berning
- Posts: 2
- Joined: Wed Aug 26, 2020 6:32 am
- Thomas Uchida
- Posts: 1794
- Joined: Wed May 16, 2012 11:40 am
Re: Custom Coordinate Actuator for Forward Dynamics
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.
- Jeffrey Berning
- Posts: 2
- Joined: Wed Aug 26, 2020 6:32 am
Re: Custom Coordinate Actuator for Forward Dynamics
Thanks for the quick reply! The ExpressionBasedCoordinateForce is exactly what I was looking for.