Forum Replies Created
-
AuthorPosts
-
HugoKeymaster
Hi @vanisri
The STLIB plugin is not supported by us, and it had some compatibility issues with SofaPython3. But devs are working on it and a new minor release should soon come out with the updated STLIB dll.
Which version of SOFA are you using? v21.06.00 or v21.06.01 ?
Best
Hugo
HugoKeymasterCould you also share the value of
PATH
,SOFA_ROOT
andPYTHONPATH
environment variable please ?Hugo
HugoKeymasterDear SOFA community,
It’s now time to register!
There is still slots for presentations at the Symposium, seats at the training session, open discussion topics for the future of SOFA at the Technical Committee …It’s time to register and spread the word! We are looking forward to having you with us in November!
@anoushs @mckysd5 @psomers @twxu @tschuelia @albanodot @andrija987 @estefania @sergeinikolaev @torri @nhnhan @amackeith @jnbrunet @damien-marchaluniv-lille1-fr @olivier-goury @PierreShg @younesssss @Scheikl @Olumide @tgaugry @FelixVanneste @cereven @vanisri @jonny @davacas @abdelrahman2010 @bobiko @agustinsantana @qdyuan4619 @benjamin @daserk @lorenzo @bmanz @peter @eaparra–
The SOFA Consortium staffHugoKeymasterThanks for your question.
Is this the full error log?
Could you try running this:echo PATH = %PATH% echo SOFA_ROOT = %SOFA_ROOT% echo PYTHONPATH = %PYTHONPATH% echo python -V python -V echo python3 -V python3 -V
Note also that binaries of SOFA (for the v21.06) are compiled with python3.7. You therefore need to have python3 pointing towards python3.7 only. I know that on Windows, it can be error prone to have many python versions installed.
Best wishes,
Hugo
14 October 2021 at 09:52 in reply to: [SOLVED] Export Object velocity and position values in each time step #20607HugoKeymasterHi @qdyuan4619
You can take a look at this example I wrote. A python controller is added in the scene and it accesses data in the scene like the
totalForce
data of a ConstantForceField as shown in theonKeypressedEvent()
function of the controller.import sys import Sofa class ManageParticles(Sofa.Core.Controller): def __init__(self, *args, **kwargs): # These are needed (and the normal way to override from a python class) Sofa.Core.Controller.__init__(self, *args, **kwargs) self.CFF = kwargs.get("ForceField") self.rootNode = kwargs.get("rootNode") self.iteration = 1 def onKeypressedEvent(self, event): key = event['key'] if key=="+" : with self.CFF.totalForce.writeableArray() as wa: wa[0] += 0.01 if key=="-" : with self.CFF.totalForce.writeableArray() as wa: wa[0] -= 0.01 return 0; def createScene(node): node.addObject('RequiredPlugin', name="SIOS-load", pluginName="SofaImplicitOdeSolver") node.addObject('RequiredPlugin', name="SBC-load", pluginName="SofaBoundaryCondition") node.dt = 0.01 node.gravity = [0,0,0] Particle = node.addChild('Particle-0') Particle.addObject('EulerImplicitSolver') Particle.addObject('CGLinearSolver', threshold='1e-09', tolerance='1e-09', iterations='200') Particle.addObject('MechanicalObject', showObject='1', position='0 0 0 0 0 0 1', name='Particle-0', template='Rigid3d') Particle.addObject('UniformMass', totalMass='1') Particle.addObject('ConstantForceField', name="CFF", totalForce="0 0 0 0 0 0" ) node.addObject( ManageParticles(name="MyParticlesController", ForceField=Particle.CFF, rootNode=node) ) return 0; def main(): import SofaRuntime import Sofa.Gui # Make sure to load all SOFA libraries SofaRuntime.importPlugin("SofaBaseMechanics") SofaRuntime.importPlugin("SofaOpenglVisual") #Create the root node root = Sofa.Core.Node("root") # Call the below 'createScene' function to create the scene graph createScene(root) Sofa.Simulation.init(root) # Launch the GUI (qt or qglviewer) Sofa.Gui.GUIManager.Init("myscene", "qglviewer") Sofa.Gui.GUIManager.createGUI(root, __file__) Sofa.Gui.GUIManager.SetDimension(1080, 1080) # Initialization of the scene will be done here Sofa.Gui.GUIManager.MainLoop(root) Sofa.Gui.GUIManager.closeGUI() print("Simulation is done.") # Function used only if this script is called from a python environment if __name__ == '__main__': main()
Best wishes,
Hugo
HugoKeymasterHey @agustinsantana
Indeed, this problem with the SurfacePressureConstraint data specification was recently brought to us. It appeared after discussing with SoftRobots developers that the pressure data actually correponds to : pressure / dt where dt is the timestep.
Let me know if it corresponds to what you expect with these units.
Best wishes,Hugo
HugoKeymasterHey @jducrocq007
There is no such man as a full expert of all aspects of SOFA! So please, dare making pull-requests even if you are unsure of your contribution. The dev team always welcome it.
Otherwise, create an issue on GitHub about this problem so that other devs can solve it.
Best wishes,
Hugo
12 October 2021 at 19:28 in reply to: [SOLVED] Export Object velocity and position values in each time step #20597HugoKeymasterHi @qdyuan4619
welcome to the SOFA forum then!
You can either use one of the Exporter in SOFA like the MeshVTKExporter (see example here).Or you could use python to access data field (“positions” and “velocity”) of the MechanicalObject and write then into any format/file you’d like.
Best wishes,
Hugo
HugoKeymasterHi @vanisri
As stated in the documentation of SofaPython3, binaries were compiled with python3.7.
You should therefore run the 3.7 version and not the 3.9 version as you have.
Best wishes,
Hugo
HugoKeymasterHi @vanisri
Aa stated in my previous message: the PYTHONPATH seems to be missing (path to the sites packages of SofaPython3).
export PYTHONPATH=/path/to/SofaPython3/lib/python3/site-packages:$PYTHONPATH
Best
Hugo
8 October 2021 at 09:00 in reply to: Problems with ‘CubeTopology’ when using ‘BeamFEMForceField’ #20564HugoKeymasterHi @andrija987
It looks like the interpolation is just working fine. The third frame being aligned with the second frame, the interpolation between third and fourth seems logical.
Have you tried to change the orientation of this third frame so that its red (x) axis correspond to the derivative between frame 2 and 4 ?
Best
Hugo
HugoKeymasterHi @vanisri
You should keep only ONE path to SOFA to make it safer (actually to make sure Win finds the SOFA you intend it to find).
Moreover, SOFA_ROOT is not a path to SOFA-v21.06/bin but only to SOFA-v21.06/.
Finally, the PYTHONPATH seems to be missing. (path to the sites packages of SofaPython3).
Best
Hugo
HugoKeymasterHey @abdelrahman2010
SofaGym is not yet released, but should be very soon! The release was a bit postponed (due to review time)
Stay tuned!Best
Hugo
7 October 2021 at 20:30 in reply to: [SOLVED] Control actuators and receive sensor variables of scene .scn Legged Robot #20555HugoKeymasterDuplicated with https://www.sofa-framework.org/community/forum/topic/problem-of-the-variables-control-of-legged-robot-with-flexible-passive-trunk/
Let’ s close this topic.
BestHugo
7 October 2021 at 20:27 in reply to: Extraction of the equation , mass and stiffness matrix of liver from SOFA #20553HugoKeymasterHi @benjamin
Were the information given by Alex all what you needed?
Shall we close this topic or would you keep it rather open?Best wishes,
Hugo
7 October 2021 at 11:13 in reply to: Segmentation fault (core dumped) when opening simulation. #20551HugoKeymasterHey @daserk
Sorry SOFA-python debugging is complicated currently, we plan to work on it.
Could you first try to add in your controller:
class CableController(Sofa.Core.Controller): def __init__(self, *args, **kwargs): Sofa.Core.Controller.__init__(self, *args, *kwargs) #this line
Could you try to identify in which step of your script it is failing?
The create Scene worked well, could you add a print (anything) after the lineSofa.Simulation.init(root)
to check whether the initialization ended properly.Best
Hugo
HugoKeymasterHi @vanisri
It looks like a problem of environment to me though.
Could you please check their values in the Windows “Environment Variables” and share them with us?Best wishes,
Hugo
HugoKeymaster7 October 2021 at 10:56 in reply to: Problems with ‘CubeTopology’ when using ‘BeamFEMForceField’ #20547HugoKeymasterHi @andrija987
Sorry it seems your CollisionModel image is not well loaded/referenced.
Could you post it again?But I am not sure the mapping coming with the BeamFEMFF will allow this. We should soon release new codes for beams that could work for you.
Best wishes,
Hugo
HugoKeymasterhey @ruffy369
As I replied to you in PM, regarding the coupling SOFA-ROS, as you noted, a plugin was designed for this purpose by an independent developer but not really maintained anymore.
However, using the SofaPython3 allowing to run simulations from a python environment, you can simply make SOFA and ROS communicate through python (since ROS is also interfaced with python). This is now how the soft-robotics community is working.
Finally, we recently heard about a new C++ plugin interfacing SOFA with ROS 2. If this is of strong interest (if the python solution is not fitting the expectations), I could see how to access this new plugin.
Best wishes,
Hugo
7 October 2021 at 10:45 in reply to: How to apply an orientation-dependent pure torque to Rigid body? #20544HugoKeymasterHey @jay-h
Indeed, dx in the addDforce function corresponds to a delta of velocity (the unknown vector x of your linear system Ax=b). Rigid3d velocities are indeed a 3d vector.
How would you express your rigid body rotation against Euler angles?
Best,
Hugo
HugoKeymasterHey @beichun
The warning given by the LocalMinDistance can – in some specific cases – be ignored. When does it happen in your case?
Removing it would require to comment it in the code and recompile.Information from the PluginManager is just informing you about loaded plugins. Removing these messages is not possible for now. Would it be important to silence it?
Best wishes,
Hugo
HugoKeymasterHey @dacavas
Sorry for our delay.
Your screenshot containing the full call stack seems to have been removed.
Could you repost it?Best wishes,
Hugo
7 October 2021 at 10:28 in reply to: Control actuators and receive sensor variables of scene .scn #20541HugoKeymasterOla @eaparra
To have interactions with your simulation:
– in xml, the only solution is to use Controller (C++ class) in your scene that would do what you are looking for, but you will have to implement them for your specific purpose
– python is actually replacing these controllers with simple scripts. In python, you will have the possibility to access all data from your scene, process them and even input new data in the simulation while it’s runningI hope this answers your point.
Best wishes,Hugo
HugoKeymasterHey @jducrocq007
Thanks for the feedback.
Do you have a simple scene highlighting this issue?
Have you understood where the problem comes from in the code? A PR on this would be great!Best wishes,
Hugo
-
AuthorPosts