Home › Forum › SOFA › Using SOFA › How to import sofa in SoftRobot
Tagged: SofaPython
- This topic has 1 reply, 2 voices, and was last updated 4 years, 3 months ago by Hugo.
-
AuthorPosts
-
25 August 2020 at 18:50 #17066CaiBlocked
Hi Everyone, I am new to sofa and Softrobot plugin. I have installed both successfully. @hugo
My directories are
SOFA source/home/cmx/sofa/src
SOFA build/home/cmx/sofa/build
STLIB/home/cmx/STLIB
SoftRobots/home/cmx/SoftRobots
I launch :
cmx@cmx-Lenovo-IdeaPad-Y510P:~/sofa/build/bin$ ./runSofa ../../../SoftRobots/docs/tutorials/CableGripper/details/cablegripper.pyscn
The program can run, and the main sofa window can appear.cmx@cmx-Lenovo-IdeaPad-Y510P:~/sofa/build/bin$ ./runSofa ../../../SoftRobots/docs/tutorials/CableGripper/details/cablegripper.pyscn [INFO] [runSofa] PluginRepository paths = /home/cmx/sofa/build/plugins:/home/cmx/sofa/build/lib [INFO] [runSofa] DataRepository paths = /home/cmx/sofa/src/share:/home/cmx/sofa/src/examples [INFO] [runSofa] GuiDataRepository paths = /home/cmx/sofa/src/applications/projects/runSofa/resources:/home/cmx/sofa/src/modules/SofaGuiQt/src/sofa/gui/qt/resources [INFO] [runSofa] Loading automatically plugin list in /home/cmx/sofa/build/lib/plugin_list.conf.default [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaSparseSolver.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaPreconditioner.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaHaptics.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaValidation.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaDenseSolver.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaNonUniformFem.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaOpenglVisual.so [INFO] [SofaPython] Added '/home/cmx/STLIB/python' to sys.path [INFO] [SofaPython] Added '/home/cmx/sofa/src/applications/plugins/SofaPython/python' to sys.path [INFO] [SofaPython] Added '/home/cmx/SoftRobots/python' to sys.path [INFO] [SofaPython] Added '/home/cmx/sofa/src/applications/plugins/SofaTest/python' to sys.path [WARNING] [PythonEnvironment] No python dir found in /home/cmx/sofa/build [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaPython.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaExporter.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libCImgPlugin.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaMiscCollision.so Warning: Setting a new default format with a different version or profile after the global shared context is created may cause issues with context sharing. The constructor with a QGLFormat is deprecated, use the regular contructor instead. [WARNING] [PythonEnvironment] No python dir found in /home/cmx/sofa/build [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSTLIB.so [WARNING] [PythonEnvironment] No python dir found in /home/cmx/sofa/build [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSoftRobots.so [INFO] [PythonScript] Missing RequiredPlugin SofaSparseSolver in the scene, add it from Prefab ElasticMaterialObject. [INFO] [SceneCheckerVisitor] Validating node "root" with checks: [SceneCheckDuplicatedName, SceneCheckMissingRequiredPlugin, SceneCheckUsingAlias] [WARNING] [SceneCheckMissingRequiredPlugin] This scene is using component defined in plugins but is not importing the required plugins. Your scene may not work on a sofa environment with different pre-loaded plugins. To fix your scene and remove this warning you just need to cut & paste the following lines at the begining of your scene (if it is a .scn): <RequiredPlugin pluginName='SofaOpenglVisual'/> <!-- Needed to use components [OglModel, ]--> [WARNING] [SceneCheckUsingAlias] This scene is using hard coded aliases. Aliases can be very confusing, use with caution. - LineCollisionModel: 11 created with alias "TLineModel" This alias will be REMOVED at the SOFA release v20.06, please update your scenes. - PointCollisionModel: 11 created with alias "TPointModel" This alias will be REMOVED at the SOFA release v20.06, please update your scenes. - TriangleCollisionModel: 11 created with alias "TTriangleModel" This alias will be REMOVED at the SOFA release v20.06, please update your scenes. [INFO] [SceneCheckerVisitor] Finished validating node "root". [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [28, 77] in triangle 0 [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [28, 77] in triangle 0 [WARNING] [TetrahedronSetTopologyContainer(container)] TrianglesAroundEdge buffer can't be created as EdgesInTriangle buffer creation failed. [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [140, 113, 125] in tetrahedron 0 [WARNING] [TetrahedronSetTopologyContainer(container)] In getTetrahedronArray, cannot find edge for tetrahedron 0and edge 0 [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [140, 113, 125] in tetrahedron 0 [WARNING] [TetrahedronSetTopologyContainer(container)] TetrahedraAroundTriangle buffer can't be created as trianglesInTetrahedron buffer creation failed. [WARNING] [CableConstraint(CableConstraint)] An old implementation of CableConstraint was not allowing negative force. This is now possible. However, to limit the force to be strictly positive you now have to set minForce=0. [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [28, 77] in triangle 0 [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [28, 77] in triangle 0 [WARNING] [TetrahedronSetTopologyContainer(container)] TrianglesAroundEdge buffer can't be created as EdgesInTriangle buffer creation failed. [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [140, 113, 125] in tetrahedron 0 [WARNING] [TetrahedronSetTopologyContainer(container)] In getTetrahedronArray, cannot find edge for tetrahedron 0and edge 0 [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [140, 113, 125] in tetrahedron 0 [WARNING] [TetrahedronSetTopologyContainer(container)] TetrahedraAroundTriangle buffer can't be created as trianglesInTetrahedron buffer creation failed. [WARNING] [CableConstraint(CableConstraint)] An old implementation of CableConstraint was not allowing negative force. This is now possible. However, to limit the force to be strictly positive you now have to set minForce=0. [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [28, 77] in triangle 0 [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [28, 77] in triangle 0 [WARNING] [TetrahedronSetTopologyContainer(container)] TrianglesAroundEdge buffer can't be created as EdgesInTriangle buffer creation failed. [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [140, 113, 125] in tetrahedron 0 [WARNING] [TetrahedronSetTopologyContainer(container)] In getTetrahedronArray, cannot find edge for tetrahedron 0and edge 0 [ERROR] [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [140, 113, 125] in tetrahedron 0 [WARNING] [TetrahedronSetTopologyContainer(container)] TetrahedraAroundTriangle buffer can't be created as trianglesInTetrahedron buffer creation failed. [WARNING] [CableConstraint(CableConstraint)] An old implementation of CableConstraint was not allowing negative force. This is now possible. However, to limit the force to be strictly positive you now have to set minForce=0.
Then I want to run :
cmx@cmx-Lenovo-IdeaPad-Y510P:~/SoftRobots/docs/tutorials/CableGripper/details$ python grippercontroller.py Traceback (most recent call last): File "grippercontroller.py", line 2, in <module> import Sofa ImportError: No module named Sofa
to control gripper, errors.
I have some doubts:
1. import Sofa or import sofa? the first letter is?
2. How to import the correct path of sofa in SoftRobots according to my file directory
3. How to launch the Tutorial of SoftRobots? i.e., how to launch Modeler?
I’m not an expert of python. Much appreciate if you could help me on this.9 September 2020 at 09:35 #17103HugoKeymasterHi @mingxuecai
Sorry for the delay of my reply.
Let me first ask some other questions: what version of Python do you have installed on your machine? what version of the SofaPython plugin are you using?Are the command
./runSofa cablegripper.pyscn
and the simulation running fine?1. importing SOFA into a python environment is only possible with the SofaPython3 plugin
2. In your first command, it seems to be well loaded
([PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSoftRobots.so
)
3. tutorials of the SoftRobot plugin are available in the repository docs/tutorials/
Regarding the Modeler it is deprecated since 2018.Best wishes,
Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.