- This topic has 3 replies, 3 voices, and was last updated 3 years, 11 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Using SOFA › [SOLVED] Multithreading plugin in .pyscn
Tagged: 64_bits, Multithreading, Plugin_Multithreading, python, SOFA_2006, Windows_10
Hi,
I recently added the Multithreading plugin to try and speed up my simulation. Is it possible to use this plugin in python scenes (.pyscn)?
My understanding is that the plugin requires adding 2 components to the scene file: AnimationLoopParallelScheduler and DataExchange. But, adding DataExchange causes python syntax errors, which I believe are because of the “from” keyword:
rootNode.createObject('DataExchange', name='exchangeData1', template='vector<float>', from='@finger/tetras.position', to='@OBJECT/DOFS.position')
(I would translate my scene to XML, but I think I need python for control (adding pressure at regular time increments during the simulation))
I am also referencing this similar post, which seemed to have the same problem but it looks like they simply used an XML scene instead.
Any guidance would be greatly appreciated!
Hi @twxu
Using python scripts is not really suited for high speed simulation (especially if you have interaction from the script while simulation is running).
I am not familiar with Multithreading in python, but the walemark’s post gives a good hint.
@jnbrunet have investigated such aspects since then?
Best
Hugo
Hi @twxu
Sorry for the delay.
If the “from” keyword is causing you an issue in your python script, you could try the following:
kwargs = {'name':'exchangeData1', 'template':'vector<float>', 'from': '@finger/tetras.position', 'to': '@OBJECT/DOFS.position'}
rootNode.createObject('DataExchange', **kwargs)
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.