Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
-
Adam Yoder
- Posts: 16
- Joined: Thu Jul 19, 2012 4:24 pm
Post
by Adam Yoder » Tue Jan 28, 2020 9:49 pm
I need to change the value of an object's property programmatically using MATLAB API
The object is a custom controller defined in a plugin dll, so I can't use safeDownCast to use concrete methods, as explained here:
viewtopicPhpbb.php?f=91&t=7281&p=19121&start=0&view=
I can load a model containing the custom controller just fine and access the gain I want to adjust as an AbstractProperty
Code: Select all
controller=model.getControllerSet.get('CustomReflexController');
gain=controller.updPropertyByName('gain');
The only two relevant AbstractProperty methods i see in methodsview() are updValueAsObject(index) and setValueAsObject(index) neither of which seem to work:
Code: Select all
gain.updValueAsObject(0)=5
Unrecognized property 'updValueAsObject' for class 'org.opensim.modeling.AbstractProperty'.
Doesnt look like correct MATLAB syntax, but was suggested in another post
viewtopicPhpbb.php?f=91&t=10913&p=30255&start=0&view=
Code: Select all
gain.updValueAsObject(0)
Java exception occurred:
java.lang.RuntimeException: SimpleProperty<T>::updValueAsObject(): property gain is not an Object property.
at org.opensim.modeling.opensimModelJNI.AbstractProperty_updValueAsObject__SWIG_0(Native Method)
at org.opensim.modeling.AbstractProperty.updValueAsObject(AbstractProperty.java:96)
The "Container Interface" section here
https://simtk.org/api_docs/opensim/api_ ... perty.html
Thanks in advance!
Tags:
-
Bryce Killen
- Posts: 104
- Joined: Mon Nov 24, 2014 7:12 pm
Post
by Bryce Killen » Mon May 04, 2020 5:12 am
HI Tom,
I followed the link you have provided and as posted above this work for 3.3 implementation, but in 4.0 PropertyHelper seems to be Depricated. Is there a OpenSim4.0 equivalent ?
The only property class I have been able to access is PropertyString - which helps when I am trying to access information - but writing, for example, a double does not work using this class. There is apparently PropertyDbl - but I cannot seem to access it, and it is not even listed in the OpenSim API class list.
Thank you in advance for any information you can provide
Bryce