downloading opensim for linux and using python

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Michel Audette
Posts: 21
Joined: Tue May 27, 2014 7:04 am

Re: downloading opensim for linux and using python

Post by Michel Audette » Thu Jun 05, 2014 7:42 am

Hi James,

the reason that I decided to opt for Linux was that when I tried to load the binary, it was complaining about

Please resolve the following:
A newer version of Microsoft Visual C++ 2010 Redistributable has been detected on the machine.


As well as a java-related error message.

which suggested to me that I had to compile from source code. If so, I felt more comfortable doing it from Linux, but it's clear now that the two platforms are not supported equally.

I don't understand why a binary does not just load what is needed to execute. I'll go back to the Windows instructions and see what else I need, and in a pinch build from source code.

User avatar
Free Free
Posts: 3
Joined: Fri Aug 15, 2014 7:42 pm

Re: downloading opensim for linux and using python

Post by Free Free » Sun Aug 17, 2014 2:02 pm

Hello,

I downloaded and successfully installed SimBody and OpenSim on Linux Ubuntu 12.04 to use it with Python.

Since I never used OpenSim before, and since there is no tutorial for Python so far, I followed the C++ tutorials and adapted them to Python:
http://simtk-confluence.stanford.edu:80 ... n+Part+One
http://simtk-confluence.stanford.edu:80 ... n+Part+Two

The first tutorial was ok without any specific issue.
For the second one I couldn't create the integrator so I created a manager without specifying the integrator (and I don't know what integrator is then used by default).
Nevertheless, the simulation worked fine and was well saved.

Then I also made some test using existing Analysis and they worked well as long as I don't try to modify them.
But when I create my own Analysis like this for example:

Code: Select all

class MyForceReporter(ForceReporter):
    def step(self, *args):
        print "test message"
        return _opensim.ForceReporter_step(self, *args)
reporter = MyForceReporter(osimModel)
osimModel.addAnalysis(reporter)
No any "test message" appears when I run the program.
The modifications are not taken into account during the integration (and there is no any error message either).
It just work as it it was a usual ForceReporter and would do that for any of the Analysis classes.

Does any one can confirm that and is there a solution to this issue to create our own Analysis in OpenSim-Python?

Thank you.

User avatar
Ayman Habib
Posts: 2242
Joined: Fri Apr 01, 2005 12:24 pm

Re: downloading opensim for linux and using python

Post by Ayman Habib » Wed Aug 20, 2014 9:57 am

Hi,

Thanks for the update, it would be great if you can post the converted 2 python tutorials for the community to share (either here or on confluence).

For extending classes purely in python, this's a route that we're definitely interested in, but haven't explored yet. Please post or send your full converted code and we'll suggest a solution or make fixes so that it's easy to do in future versions.

Best regards,
-Ayman

User avatar
Free Free
Posts: 3
Joined: Fri Aug 15, 2014 7:42 pm

Re: downloading opensim for linux and using python

Post by Free Free » Wed Aug 20, 2014 11:14 am

Hi,

Thank you for your answer.
Attached is the code with the previous test.
Just change the extension: ".py"
(I couldn't upload with this extension since it is not allowed).

Regards.
Attachments
tugOfWar.txt
(5.28 KiB) Downloaded 82 times

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: downloading opensim for linux and using python

Post by Christopher Dembia » Wed Aug 20, 2014 1:00 pm

Here is a workaround to do a custom analysis, but not through OpenSim's AnalyzeTool. https://github.com/chrisdembia/perimysi ... ng.py#L665

You should only need the `analyze` and `set_model_state_from_storage` functions. I do not advise you to install that perimysium package; just copy the code you need.

User avatar
Free Free
Posts: 3
Joined: Fri Aug 15, 2014 7:42 pm

Re: downloading opensim for linux and using python

Post by Free Free » Wed Aug 20, 2014 2:57 pm

Thank you. I didn't know perimysium.

Your function "analysis" seems very interesting but it is a sort of postprocessing while I would prefer to be able to make analysis (and even interact with the model) during the integration itself.

I don't know if there is a simple way to do that in python.

Maybe the best way it to make a python loop and integrate only step by step in that loop...

POST REPLY