Driving CoordinateActuator/motor using a set torque profile from the API in MATLAB

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
AUDE LEFRANC
Posts: 16
Joined: Wed Sep 18, 2019 12:47 pm

Driving CoordinateActuator/motor using a set torque profile from the API in MATLAB

Post by AUDE LEFRANC » Mon Nov 16, 2020 1:09 pm

So these might be some very basic questions because I'm still getting familiar with the MATLAB-OpenSim API (and OpenSim as a whole), but I can't seem to find anything online so here goes:

I am trying to optimize the torque profile generated by a motor that I added to a model. I have added a motor to my model (added to my OSIM file as shown below). I also wrote code that generates a torque profile based on a set of parameters. My end goal is to optimize that torque profile to minimize an output from a specific tool (joint loading, metabolic cost, whatever I'm interested in). I'll probably end up using FMINCON or something similar to minimize the output of the tools I'm looking at.

How do I access the controller for a specific motor from the API (ie. what methods can I use)?
I saw that you can easily adjust the optimal force of a coordinate actuator and the force over time is then calculated by CMC, but how do I set the force produced over time myself? Is there a way that I can provide a set torque profile that is the same length as one of my simulations and use that to drive the motor?

Any suggestions or resources that you might have are much appreciated! Thank you!!
Attachments
model.JPG
model.JPG (53.28 KiB) Viewed 417 times

Tags:

User avatar
Carmichael Ong
Posts: 375
Joined: Fri Feb 24, 2012 11:50 am

Re: Driving CoordinateActuator/motor using a set torque profile from the API in MATLAB

Post by Carmichael Ong » Wed Nov 18, 2020 11:02 am

In OpenSim, there's a clear distinction between an Actuator and a Controller, but this can be confusing because of the "optimal_force" property for actuators. The final generalized force value produced by an actuator is (control signal)*(optimal force). One way to get a certain control signal over time would be through using a PrescribedController.

https://simtk.org/api_docs/opensim/api_ ... oller.html

POST REPLY