AddStateVariable() method Python API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
louis labadie
Posts: 5
Joined: Wed Feb 03, 2021 5:21 am

AddStateVariable() method Python API

Post by louis labadie » Fri May 28, 2021 1:25 am

Hello,

I'm working on a project where I try to customize a Component in order to add state variables to compute a spindle behaviour.
I'm working with Opensim 4.2 in a Python 3.7 environment.
My issue is that I can't find the corresponding python method to AddStateVariable found in the C++ Opensim API here :
https://simtk.org/api_docs/opensim/api_ ... 35d22014da
I checked the .py files in the sdk and printed the content of the Opensim modules thanks to the help("nameofthemodule") method but I still can't find the existence of the addStateVariable() method.
Does anyone know how to use this method in a Python environment ?

Thanks for your help,

Louis

Tags:

User avatar
louis labadie
Posts: 5
Joined: Wed Feb 03, 2021 5:21 am

Re: AddStateVariable() method Python API

Post by louis labadie » Wed Jun 09, 2021 6:19 am

Hi again,

Sorry to bother people on the forum with that but I could really need some help on this point.
I tried calling the addStateVariable method through opensim.common.Component.Add... path but I get the following error message " type object 'Component' has no attribute 'addStateVariable'".

Thanks by advance,

Louis

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

Re: AddStateVariable() method Python API

Post by Thomas Uchida » Thu Jun 10, 2021 5:57 am

As far as I know, the API does not support adding state variables from Python. Customizing a Component is typically done by building a plugin. Resources for building/using plugins can be found in the documentation:
- "Creating Plugins", https://simtk-confluence.stanford.edu/d ... ng+Plugins
- "Using Plugins", https://simtk-confluence.stanford.edu/d ... ng+Plugins
There are also a few examples in the "Resources" directory (e.g., C:\OpenSim4.0\Resources\Code\CPP\Plugins).

User avatar
louis labadie
Posts: 5
Joined: Wed Feb 03, 2021 5:21 am

Re: AddStateVariable() method Python API

Post by louis labadie » Thu Jun 10, 2021 6:14 am

Thank you for the clarification !

POST REPLY