Custom Coordinate Actuator for Forward Dynamics
Posted: 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
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