Deprecated PropertyHelper function API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Bryce Killen
Posts: 104
Joined: Mon Nov 24, 2014 7:12 pm

Deprecated PropertyHelper function API

Post by Bryce Killen » Fri May 08, 2020 2:18 am

Hi all,

I am looking for a replacement or new implementation of the PropertyHelper class which was available in the Python API in OpenSim 3.3, in 4.0 it seems the only related class I can use is PropertyString. While this function is useful for pulling information from my model, I cannot write information to the model which is not a string type, for example if I am defining a length.

I see on the Doxygen page, PropertyDbl was intended to partially replace this function, but I am unable to access it. Some specific information regarding my problem is below:

I have a model which is using the OpenSim JAM class of Ligaments, this class is not recognised by the API, I can import the plugin and downcast to the ligament as the "Force" object to access the information. I am wanting to design a calibration for some of the properties, slack_length and stiffness, but as mentioned above I cannot re-write these properties using the PropertyString class. I am on a windows machine using OpenSim 4.0 and Python 2.7.

Thank you in advance for any advice or tips

Bryce Killen

Tags:

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

Re: Deprecated PropertyHelper function API

Post by Carmichael Ong » Wed May 13, 2020 11:22 am

I'm haven't worked much with the PropertyHelper classes unfortunately, so I'm trying to think of a way to actually modify the properties directly. Do you know if the OpenSim JAM ligaments inherit from the base Ligament class? If so perhaps you could downcast to the Ligament object and use the corresponding methods (https://simtk.org/api_docs/opensim/api_ ... ament.html)? Otherwise, I'd have to take a look at the code for the OpenSim JAM project and see from there.

User avatar
Bryce Killen
Posts: 104
Joined: Mon Nov 24, 2014 7:12 pm

Re: Deprecated PropertyHelper function API

Post by Bryce Killen » Wed May 13, 2020 11:43 pm

Hi Carmichael,

Thanks for the your reply.

I just tried to safeDownCast to the specific ligaments using the LIgament class

Code: Select all

ligament = osim.Ligament.safeDownCast(model.getForceSet().get('lPFL8'))
But this returns a none type so I am guessing this is no.
I can get it as a Force as you see above and I can then get the properties using some quiet ugly code

Code: Select all

sl = lig.getPropertyByName('slack_length')
slv = float(sl.toString())
I have then by trying to set it as a PropertyString after converting the float to a string

Code: Select all

osim.PropertyString_getAs(lig.getPropertyByName('slack_length')).setValue('1.8')
But when I return the value it is no longer the value I set -- perhaps due to the type conversion.

Any ideas no matter how radical or ugly are always welcome

Bryce

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

Re: Deprecated PropertyHelper function API

Post by Carmichael Ong » Mon May 18, 2020 11:49 am

This is definitely an issue that might be hard to find a workaround. FYI, it's on the radar of the development team (https://github.com/opensim-org/opensim- ... -628223936), but can't promise any exact timing by when this will be addressed.

User avatar
Bryce Killen
Posts: 104
Joined: Mon Nov 24, 2014 7:12 pm

Re: Deprecated PropertyHelper function API

Post by Bryce Killen » Tue May 19, 2020 12:12 am

Hi Carmichael,

Ah okay, good to know its on the radar.. hopefully not too long but I understand.

I have been trying alternative ways to set the property of when converting the a string but its not so succesful.

Using the abstract property I can (according to the Documentation) set it as a Object using setValueAsObject -- but I am not sure how to actually create the Object class from the ArrayDouble type

Any ideas on this ?

Cheers
Bryce

POST REPLY