SofaDefrost / SofaGym

Machine Learning framework for Sofa
72 stars 11 forks source link

env.reset() error #13

Closed ziyao-hhs closed 1 year ago

ziyao-hhs commented 1 year ago

Hi I've tried to load a sample in test_env.py, but found an error raising when executed to env.reset().

D:\SofaGym-main>python test_env.py

---------------------------------------
Checking SOFA_ROOT and SOFAPYTHON3_ROOT
Using environment variable SOFA_ROOT: D:\sofa
Using environment variable SOFAPYTHON3_ROOT: D:\sofa\plugins\SofaPython3
---------------------------------------

[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Geometry.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Detection.Algorithm.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Detection.Intersection.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Response.Mapper.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Response.Contact.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Visual.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Setting.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Iterative.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mass.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mapping.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.StateContainer.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Constant.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Grid.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Dynamic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.Spring.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Select.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.ODESolver.Forward.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.ODESolver.Backward.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.IO.Mesh.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Diffusion.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.Elastic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Projective.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.MechanicalLoad.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mapping.MappedMatrix.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Model.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Correction.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Solver.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.AnimationLoop.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.TensorMass.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Analyze.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Generate.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Transform.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Engine.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Direct.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Playback.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SceneUtility.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GUI.Component.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Mapping.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Controller.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.NonUniform.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.HyperElastic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Utility.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Haptics.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Rendering2D.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Rendering3D.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Shader.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Preconditioner.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/SofaComponentAll.dll
Start env  concentrictuberobot-v0
50851
D:\python\lib\site-packages\gym\spaces\box.py:127: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(f"Box bound precision lowered by casting to {self.dtype}")
D:\python\lib\site-packages\gym\utils\passive_env_checker.py:174: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed a `seed` instead of using `Env.seed` for resetting the environment random number generator.
  logger.warn(
D:\python\lib\site-packages\gym\utils\passive_env_checker.py:187: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed `options` to allow the environment initialisation to be passed additional information.
  logger.warn(
All clients are closed. Bye Bye.
{'scene': 'CTR', 'deterministic': True, 'source': [-150, 0, 30], 'target': [0, 0, 30], 'mesh': 'mesh/nasal_cavity.obj', 'scale': 30, 'rotation': [140.0, 0.0, 0.0], 'translation': [0.0, 0.0, 0.0], 'goalList': [[0.0, 0.0, 0.0]], 'goalPos': [0.0, 16.861897843737978, 44.72900560493795], 'scale_factor': 10, 'timer_limit': 50, 'timeout': 3, 'display_size': (1600, 800), 'render': 1, 'save_data': True, 'save_path': 'D:\\SofaGym-main\\sofagym\\envs\\CTR/Results/CTR', 'planning': True, 'discrete': True, 'seed': 0, 'start_from_history': None, 'python_version': 'python3.8', 'zFar': 5000, 'save_path_image': None, 'save_path_results': 'D:\\SofaGym-main\\sofagym\\envs\\CTR/Results/CTR/data', 'dt': 0.01, 'goal_node': 0}
---------------------------------------
Checking SOFA_ROOT and SOFAPYTHON3_ROOT
Using environment variable SOFA_ROOT: D:\sofa
Using environment variable SOFAPYTHON3_ROOT: D:\sofa\plugins\SofaPython3
---------------------------------------
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Geometry.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Detection.Algorithm.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Detection.Intersection.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Response.Mapper.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Response.Contact.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Visual.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Setting.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Iterative.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mass.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mapping.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.StateContainer.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Constant.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Grid.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Dynamic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.Spring.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Select.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.ODESolver.Forward.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.ODESolver.Backward.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.IO.Mesh.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Diffusion.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.Elastic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Projective.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.MechanicalLoad.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mapping.MappedMatrix.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Model.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Correction.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Solver.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.AnimationLoop.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.TensorMass.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Analyze.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Generate.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Transform.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Engine.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Direct.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Playback.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SceneUtility.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GUI.Component.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Mapping.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Controller.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.NonUniform.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.HyperElastic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Utility.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Haptics.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Rendering2D.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Rendering3D.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Shader.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Preconditioner.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/SofaComponentAll.dll
SCENE  {'scene': 'CTR', 'deterministic': True, 'source': [-150, 0, 30], 'target': [0, 0, 30], 'mesh': 'mesh/nasal_cavity.obj', 'scale': 30, 'rotation': [140.0, 0.0, 0.0], 'translation': [0.0, 0.0, 0.0], 'goalList': [[0.0, 0.0, 0.0]], 'goalPos': [0.0, 16.861897843737978, 44.72900560493795], 'scale_factor': 10, 'timer_limit': 50, 'timeout': 3, 'display_size': (1600, 800), 'render': 1, 'save_data': True, 'save_path': 'D:\\SofaGym-main\\sofagym\\envs\\CTR/Results/CTR', 'planning': True, 'discrete': True, 'seed': 0, 'start_from_history': None, 'python_version': 'python3.8', 'zFar': 5000, 'save_path_image': None, 'save_path_results': 'D:\\SofaGym-main\\sofagym\\envs\\CTR/Results/CTR/data', 'dt': 0.01, 'goal_node': 0}
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/BeamAdapter.dll

########## SIG 11 - SIGSEGV: segfault ##########
  sofa::helper::BackTrace::dump
  sofa::helper::BackTrace::sig
  exp2f
  exp2f
  _C_specific_handler
  _chkstk
  RtlRestoreContext
  KiUserExceptionDispatcher
  PyObject_GetAttrString
  sofapython3::PythonEnvironment::getStaticData
  initExternalModule
  sofapython3::PythonEnvironment::getPythonCallingPointAsFileInfo
  sofapython3::PythonEnvironment::getPythonCallingPointAsFileInfo
  sofapython3::PythonEnvironment::getPythonCallingPointAsFileInfo
  sofapython3::PythonEnvironment::getPythonCallingPointAsFileInfo
  PyCFunction_Call
  PyObject_MakeTpCall
  Py_FatalError
  Py_CheckFunctionResult
  PyEval_EvalFrameDefault
  Py_CheckFunctionResult
  PyEval_EvalFrameDefault
  PyEval_EvalCodeWithName
  Py_CheckFunctionResult
  PyEval_EvalFrameDefault
  PyEval_EvalCodeWithName
  Py_CheckFunctionResult
  PyEval_EvalFrameDefault
  PyEval_EvalCodeWithName
  PyEval_EvalCodeEx
  PyEval_EvalCode
  PyArena_New
  PyArena_New
  PyRun_FileExFlags
  PyRun_SimpleFileExFlags
  PyRun_AnyFileExFlags
  Py_FatalError
  Py_RunMain
  Py_RunMain
  Py_Main
  Py_Main
  BaseThreadInitThunk
  RtlUserThreadStart
Exception in thread Thread-3:
Traceback (most recent call last):
  File "D:\python\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "D:\python\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "D:\SofaGym-main\sofagym\rpc_server.py", line 529, in deferredStart
    subprocess.run([sys.executable, path+"sofagym/rpc_client.py", sdict, str(nb_actions), str(port_rpc)],
  File "D:\python\lib\subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['D:\\python\\python.exe', 'D:\\SofaGym-main/sofagym/rpc_client.py', "{'scene': 'CTR', 'deterministic': True, 'source': [-150, 0, 30], 'target': [0, 0, 30], 'mesh': 'mesh/nasal_cavity.obj', 'scale': 30, 'rotation': [140.0, 0.0, 0.0], 'translation': [0.0, 0.0, 0.0], 'goalList': [[0.0, 0.0, 0.0]], 'goalPos': [0.0, 16.861897843737978, 44.72900560493795], 'scale_factor': 10, 'timer_limit': 50, 'timeout': 3, 'display_size': (1600, 800), 'render': 1, 'save_data': True, 'save_path': 'D:\\\\SofaGym-main\\\\sofagym\\\\envs\\\\CTR/Results/CTR', 'planning': True, 'discrete': True, 'seed': 0, 'start_from_history': None, 'python_version': 'python3.8', 'zFar': 5000, 'save_path_image': None, 'save_path_results': 'D:\\\\SofaGym-main\\\\sofagym\\\\envs\\\\CTR/Results/CTR/data', 'dt': 0.01, 'goal_node': 0}", '12', '50851']' returned non-zero exit status 3.
alxbilger commented 1 year ago

@EtienneMenager @hunoutl Is anyone of you able to answer?

hunoutl commented 1 year ago

Hi First time I see this type of error. Are you on windows? Which version of python are you using? Can you try with another environment? (you need to change env number in test_env.py)

damienmarchal commented 1 year ago

It is surprising to have mutliple "sofapython3::PythonEnvironment::getPythonCallingPointAsFileInfo" in the callstack and I wonder why.

ziyao-hhs commented 1 year ago

Hi First time I see this type of error. Are you on windows? Which version of python are you using? Can you try with another environment? (you need to change env number in test_env.py)

Hi, It is Python3.8 in Windows11. I've tried different environment number which comes out of similar error report. Actually, when I simply runs:

import gym
import sofagym.envs
env = gym.make('trunk-v0')
env.reset()

it raises the same issue.

EtienneMenager commented 1 year ago

Hi,

I have never seen this mistake. Did you try to run the scene outside of SofaGym (to see if the problem was due to a missing plugin, or a problem with the structure of the scene)? For example, go to the folder containing the trunk scene and run the command "pathto/runSofa TrunkScene.py".

ziyao-hhs commented 1 year ago

Hi,

I have never seen this mistake. Did you try to run the scene outside of SofaGym (to see if the problem was due to a missing plugin, or a problem with the structure of the scene)? For example, go to the folder containing the trunk scene and run the command "pathto/runSofa TrunkScene.py".

Thank you, it did go wrong when loading the scene. Is it due to the STLIB library?

[ERROR]   [SofaPython3::SceneLoader] Unable to completely load the scene from file 'Trunk\TrunkScene.py'.
Python exception:
  AttributeError: Missing attribute: addNewData

At:
  D:/sofa/plugins/STLIB/lib/python3/site-packages\splib3\objectmodel\__init__.py(49): __call__
  TrunkScene.py(214): createScene

[INFO]    [SceneCheckerVisitor] Validating node "root" with checks: [SceneCheckDuplicatedName, SceneCheckMissingRequiredPlugin, SceneCheckUsingAlias, SceneCheckDeprecatedComponents, SceneCheckCollisionResponse]
[DEPRECATED] [BruteForceDetection(BruteForceDetection)] SceneCheckDeprecatedComponents: This component has been DEPRECATED since SOFA v21.06 and will be removed in SOFA v21.12. Please consider updating your scene as using deprecated component may result in poor performance and undefined behavior. If this component is crucial to you please report that to sofa-dev@ so we can reconsider this component for future re-integration.
[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 beginning of your scene (if it is a .scn):
  <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
  <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
  <RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TetrahedronSetGeometryAlgorithms, TetrahedronSetTopologyContainer, TetrahedronSetTopologyModifier] -->

[INFO]    [SceneCheckerVisitor] Finished validating node "root".
[WARNING] [Node(root)] Default Visual Manager Loop will be used. Add DefaultVisualManagerLoop to the root node of scene file to remove this warning
[DEPRECATED] [BruteForceDetection(BruteForceDetection)] As a replacement, use a BroadPhase component, such as [BruteForceBroadPhase, IncrSAP],
  AND a NarrowPhase component, such as [BVHNarrowPhase, DirectSAPNarrowPhase, IncrSAP, RayTraceNarrowPhase].
  BruteForceBroadPhase and BVHNarrowPhase have been automatically added to your scene for backward compatibility.
[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [0, 313] in triangle 0 [55 0 313] in the provided edge list (@/Simulation/Trunk/container.edges). It shows an inconsistency between the edge list (@/Simulation/Trunk/container.edges) and the triangle list (@/Simulation/Trunk/container.triangles). Either fix the topology (probably in a mesh file), or provide only the triangle list to '/Simulation/Trunk/container' and not the edges. In the latter case, the edge list will be computed from triangles.
[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [0, 313] in triangle 0 [55 0 313] in the provided edge list (@/Simulation/Trunk/container.edges). It shows an inconsistency between the edge list (@/Simulation/Trunk/container.edges) and the triangle list (@/Simulation/Trunk/container.triangles). Either fix the topology (probably in a mesh file), or provide only the triangle list to '/Simulation/Trunk/container' and not the edges. In the latter case, the edge list will be computed from triangles.
[WARNING] [TetrahedronSetTopologyContainer(container)] TrianglesAroundEdge buffer can't be created as EdgesInTriangle buffer creation failed.
[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [482, 491, 667] in tetrahedron 0
[WARNING] [TetrahedronSetTopologyContainer(container)]  In getTetrahedronArray, cannot find edge for tetrahedron 0and edge 0
[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [482, 491, 667] in tetrahedron 0
[WARNING] [TetrahedronSetTopologyContainer(container)] TetrahedraAroundTriangle buffer can't be created as trianglesInTetrahedron buffer creation failed.
EtienneMenager commented 1 year ago

Indeed it is a problem with STLIB, it does not find the addNewData attribute in the init. What version of STLIB and SOFA are you using?

If anyone else had this kind of problem with STLIB @alxbilger @hunoutl

hunoutl commented 1 year ago

Yes, issue #12 on last Sofa (v22.12)

What version of STLIB and SOFA are you using?

ziyao-hhs commented 1 year ago

Yes, issue #12 on last Sofa (v22.12)

What version of STLIB and SOFA are you using?

Hi, I have use the https://github.com/SofaDefrost / DefrostSofaBundle to build every dependency. It is Sofa(v22.06), python8. Do you have any ideas of how to fix this?

EtienneMenager commented 1 year ago

Hi,

It seems that @hunoutl has already had this problem. Can you try the solution #12 ?

ziyao-hhs commented 1 year ago

Thank you! Now it is able to load the scene like this,

1674031094925

but with a report:

[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [0, 313] in triangle 0 [55 0 313] in the provided edge list (@/Simulation/Trunk/container.edges). It shows an inconsistency between the edge list (@/Simulation/Trunk/container.edges) and the triangle list (@/Simulation/Trunk/container.triangles). Either fix the topology (probably in a mesh file), or provide only the triangle list to '/Simulation/Trunk/container' and not the edges. In the latter case, the edge list will be computed from triangles.
[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [0, 313] in triangle 0 [55 0 313] in the provided edge list (@/Simulation/Trunk/container.edges). It shows an inconsistency between the edge list (@/Simulation/Trunk/container.edges) and the triangle list (@/Simulation/Trunk/container.triangles). Either fix the topology (probably in a mesh file), or provide only the triangle list to '/Simulation/Trunk/container' and not the edges. In the latter case, the edge list will be computed from triangles.
[WARNING] [TetrahedronSetTopologyContainer(container)] TrianglesAroundEdge buffer can't be created as EdgesInTriangle buffer creation failed.
[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [482, 491, 667] in tetrahedron 0
[WARNING] [TetrahedronSetTopologyContainer(container)]  In getTetrahedronArray, cannot find edge for tetrahedron 0and edge 0
[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [482, 491, 667] in tetrahedron 0
[WARNING] [TetrahedronSetTopologyContainer(container)] TetrahedraAroundTriangle buffer can't be created as trianglesInTetrahedron buffer creation failed.

and when loaded with

import gym
import sofagym.envs
env = gym.make('trunk-v0')
env.reset()

shows up the same error again:

---------------------------------------
Checking SOFA_ROOT and SOFAPYTHON3_ROOT
Using environment variable SOFA_ROOT: D:\sofa
Using environment variable SOFAPYTHON3_ROOT: D:\sofa\plugins\SofaPython3
---------------------------------------
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Geometry.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Detection.Algorithm.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Detection.Intersection.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Response.Mapper.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Response.Contact.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Visual.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Setting.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Iterative.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mass.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mapping.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.StateContainer.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Constant.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Grid.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Dynamic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.Spring.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Select.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.ODESolver.Forward.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.ODESolver.Backward.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.IO.Mesh.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Diffusion.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.Elastic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Projective.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.MechanicalLoad.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mapping.MappedMatrix.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Model.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Correction.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Solver.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.AnimationLoop.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.TensorMass.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Analyze.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Generate.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Transform.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Engine.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Direct.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Playback.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SceneUtility.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GUI.Component.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Mapping.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Controller.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.NonUniform.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.HyperElastic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Utility.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Haptics.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Rendering2D.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Rendering3D.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Shader.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Preconditioner.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/SofaComponentAll.dll
51255
D:\python\lib\site-packages\gym\spaces\box.py:127: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(f"Box bound precision lowered by casting to {self.dtype}")
D:\python\lib\site-packages\gym\utils\passive_env_checker.py:174: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed a `seed` instead of using `Env.seed` for resetting the environment random number generator.
  logger.warn(
D:\python\lib\site-packages\gym\utils\passive_env_checker.py:187: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed `options` to allow the environment initialisation to be passed additional information.
  logger.warn(
All clients are closed. Bye Bye.
---------------------------------------
Checking SOFA_ROOT and SOFAPYTHON3_ROOT
Using environment variable SOFA_ROOT: D:\sofa
Using environment variable SOFAPYTHON3_ROOT: D:\sofa\plugins\SofaPython3
---------------------------------------
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Geometry.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Detection.Algorithm.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Detection.Intersection.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Response.Mapper.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Collision.Response.Contact.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Visual.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Setting.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Iterative.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mass.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mapping.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.StateContainer.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Constant.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Grid.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Container.Dynamic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.Spring.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Select.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.ODESolver.Forward.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.ODESolver.Backward.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.IO.Mesh.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Diffusion.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.Elastic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Projective.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.MechanicalLoad.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Mapping.MappedMatrix.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Model.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Correction.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Constraint.Lagrangian.Solver.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.AnimationLoop.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.TensorMass.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Analyze.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Generate.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Engine.Transform.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Engine.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Direct.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Playback.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SceneUtility.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GUI.Component.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Mapping.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Controller.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.NonUniform.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.SolidMechanics.FEM.HyperElastic.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Topology.Utility.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.Haptics.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Rendering2D.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Rendering3D.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.GL.Component.Shader.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/Sofa.Component.LinearSolver.Preconditioner.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/SofaComponentAll.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/STLIB.dll
[INFO]    [PluginManager] Loaded plugin: D:/sofa/bin/SoftRobots.dll

########## SIG 11 - SIGSEGV: segfault ##########
  sofa::helper::BackTrace::dump
  sofa::helper::BackTrace::sig
  exp2f
  exp2f
  _C_specific_handler
  _chkstk
  RtlRestoreContext
  KiUserExceptionDispatcher
  PyObject_GetAttrString
  sofapython3::PythonEnvironment::getStaticData
  initExternalModule
  sofapython3::PythonEnvironment::getPythonCallingPointAsFileInfo
  sofapython3::PythonEnvironment::getPythonCallingPointAsFileInfo
  sofapython3::PythonEnvironment::getPythonCallingPointAsFileInfo
  sofapython3::PythonEnvironment::getPythonCallingPointAsFileInfo
  PyCFunction_Call
  PyObject_MakeTpCall
  Py_FatalError
  Py_CheckFunctionResult
  PyEval_EvalFrameDefault
  PyEval_EvalCodeWithName
  Py_CheckFunctionResult
  PyEval_EvalFrameDefault
  PyEval_EvalCodeWithName
  Py_CheckFunctionResult
  PyEval_EvalFrameDefault
  PyEval_EvalCodeWithName
  PyEval_EvalCodeEx
  PyEval_EvalCode
  PyArena_New
  PyArena_New
  PyRun_FileExFlags
  PyRun_SimpleFileExFlags
  PyRun_AnyFileExFlags
  Py_FatalError
  Py_RunMain
  Py_RunMain
  Py_Main
  Py_Main
  BaseThreadInitThunk
  RtlUserThreadStart
Exception in thread Thread-3:
Traceback (most recent call last):
  File "D:\python\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "D:\python\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "D:\SofaGym-main\sofagym\rpc_server.py", line 529, in deferredStart
    subprocess.run([sys.executable, path+"sofagym/rpc_client.py", sdict, str(nb_actions), str(port_rpc)],
  File "D:\python\lib\subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['D:\\python\\python.exe', 'D:\\SofaGym-main/sofagym/rpc_client.py', "{'scene': 'Trunk', 'deterministic': True, 'source': [300, 0, 80], 'target': [0, 0, 80], 'goalList': [[40, 40, 100], [-10, 20, 80]], 'start_node': None, 'scale_factor': 5, 'timer_limit': 250, 'timeout': 50, 'display_size': (1600, 800), 'render': 1, 'save_data': False, 'save_image': False, 'save_path': 'D:\\\\SofaGym-main\\\\sofagym\\\\envs\\\\Trunk/Results/Trunk', 'planning': False, 'discrete': True, 'seed': None, 'start_from_history': None, 'python_version': 'python3', 'save_path_image': None, 'save_path_results': None, 'goal_node': 0, 'goalPos': [40, 40, 100]}", '16', '51255']' returned non-zero exit status 3.
EtienneMenager commented 1 year ago

Hi,

Nice to hear. The first errors are not a problem: the mesh cannot load all the point, but this not affect the simulation. It seems that there is an error in the subprocess call. But we don't have enough information to know where is the problem (it just says that there is a problem). Can you try to do a step in the runSofa API? (runSofa your_path/TrunkScene.py then push the step button)

ziyao-hhs commented 1 year ago

Thank you! However, the Sofa gui did not show up. The command line would stuck at the error reporting. Just to double check that how should I run the code? When I execute the code line by line in command lines like this, it works:

D:\SofaGym-main>python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gym
>>> import sofagym.envs
---------------------------------------
Checking SOFA_ROOT and SOFAPYTHON3_ROOT
Using environment variable SOFA_ROOT: D:\sofa
Using environment variable SOFAPYTHON3_ROOT: D:\sofa\plugins\SofaPython3
---------------------------------------
>>> env=gym.make('trunk-v0')
51703
D:\python\lib\site-packages\gym\spaces\box.py:127: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(f"Box bound precision lowered by casting to {self.dtype}")
>>> env.reset
<bound method OrderEnforcing.reset of <OrderEnforcing<PassiveEnvChecker<TrunkEnv<trunk-v0>>>>>
>>> exit()

However when I put them in a python file for example called test.py, then in the command line: D:\SofaGym-main>python test.py then it shows up the previous error. Is this the correct way to execute?

EtienneMenager commented 1 year ago

The Sofa GUI is not linked with SofaGym at the moment (display in SofaGym is done with pygame). This is the way to launch the environment in SofaGym, but what I would like to do is to launch the scene in Sofa and make it work in Sofa. The error you got closes the subprocess that launches the scene, so I guess it is related to the Sofa scene and not to SofaGym, and as you show, it seems to happen at runtime (not at initialization or reset).

Can you go back to this configuration:

213123200-aaed3d86-9046-4e5a-8191-98e357ddc37f

and run the simulation?

ziyao-hhs commented 1 year ago

Yes, with the report:

[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [0, 313] in triangle 0 [55 0 313] in the provided edge list (@/Simulation/Trunk/container.edges). It shows an inconsistency between the edge list (@/Simulation/Trunk/container.edges) and the triangle list (@/Simulation/Trunk/container.triangles). Either fix the topology (probably in a mesh file), or provide only the triangle list to '/Simulation/Trunk/container' and not the edges. In the latter case, the edge list will be computed from triangles.
[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find edge 0 [0, 313] in triangle 0 [55 0 313] in the provided edge list (@/Simulation/Trunk/container.edges). It shows an inconsistency between the edge list (@/Simulation/Trunk/container.edges) and the triangle list (@/Simulation/Trunk/container.triangles). Either fix the topology (probably in a mesh file), or provide only the triangle list to '/Simulation/Trunk/container' and not the edges. In the latter case, the edge list will be computed from triangles.
[WARNING] [TetrahedronSetTopologyContainer(container)] TrianglesAroundEdge buffer can't be created as EdgesInTriangle buffer creation failed.
[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [482, 491, 667] in tetrahedron 0
[WARNING] [TetrahedronSetTopologyContainer(container)]  In getTetrahedronArray, cannot find edge for tetrahedron 0and edge 0
[ERROR]   [TetrahedronSetTopologyContainer(container)] Cannot find triangle 0 [482, 491, 667] in tetrahedron 0
[WARNING] [TetrahedronSetTopologyContainer(container)] TetrahedraAroundTriangle buffer can't be created as trianglesInTetrahedron buffer creation failed.

when click Step, it works and nothing more shows up in cmd:

1674036002211 1674036021482
EtienneMenager commented 1 year ago

Hmmm, okay. You have to figure out where the error is. I don't have it in my version of Sofa and SofaGym, so I suggest that we see where the problem is together by doing this:

  1. In AbstractEnv.py: add print or debug line 297, 300, 307 to see if the problem is in "add_new_step" or in "get_results".
  2. In rpc_client.py: add print or debug line 83, 88, 92, 105 to see if the problem is in "_getState", "step_simulation", "_getReward" or "taskDone".
  3. In simulate.py: add print or debug line 40, 49, 111, 115 to see if the problem is in the "create_scene", "step_simulation", or update.

Let me know :)

ziyao-hhs commented 1 year ago

Thank you to be this supportive! I added print lines in these 3 files as you said. Problem seems to be Line49 in simulate.py, specifically create_scene(root, config, mode = mode). Lines before this works.

EtienneMenager commented 1 year ago

We're getting close, even if it's strange that it happens in this part of the code ... If it's a problem while the scene is working I don't really understand. I was told that someone had already had a problem like this with windows.

@hunoutl does anyone work with windows and sofagym ? @alxbilger Do you know if there are any specificities about sub-processes, importing components or creating the scene with windows?

hunoutl commented 1 year ago

Ok, it's a problem i had previously. I made a fix in #9. The env need to import splib and not splib3.

ziyao-hhs commented 1 year ago

Ok, it's a problem i had previously. I made a fix in #9. The env need to import splib and not splib3. Thank you! Could you please kindly inform me about how to fix this in detail? Where shall I revise splib3 specifically?

hunoutl commented 1 year ago

Can you try from #14 ?

ziyao-hhs commented 1 year ago

Can you try from #14 ?

Thank you! it did not work and cannot solve the previous problems. I was wondering if it is because of windows, thus I switch to ubuntu and make another try. I don't think the problem comes from splib. It still reports a threading problem, this time more specific as below: Maybe this time more close to the problem:

Exception in thread Thread-2 (dispatch):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/hhs/SofaGym/sofagym/rpc_server.py", line 417, in dispatch
    with SimpleThreadedXMLRPCServer(('localhost', port_rpc), requestHandler=RequestHandler) as server:
  File "/usr/lib/python3.10/xmlrpc/server.py", line 605, in __init__
    socketserver.TCPServer.__init__(self, addr, requestHandler, bind_and_activate)
  File "/usr/lib/python3.10/socketserver.py", line 452, in __init__
    self.server_bind()
  File "/usr/lib/python3.10/socketserver.py", line 466, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
---------------------------------------

########## SIG 11 - SIGSEGV: segfault ##########
Exception in thread Thread-3 (deferredStart):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/hhs/SofaGym/sofagym/rpc_server.py", line 529, in deferredStart
    subprocess.run([sys.executable, path+"sofagym/rpc_client.py", sdict, str(nb_actions), str(port_rpc)],
  File "/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/hhs/SofaGym/sofagym/rpc_client.py', "{'scene': 'Trunk', 'deterministic': True, 'source': [300, 0, 80], 'target': [0, 0, 80], 'goalList': [[40, 40, 100], [-10, 20, 80]], 'start_node': None, 'scale_factor': 5, 'timer_limit': 250, 'timeout': 50, 'display_size': (1600, 800), 'render': 1, 'save_data': False, 'save_image': False, 'save_path': '/home/hhs/SofaGym/sofagym/envs/Trunk/Results/Trunk', 'planning': False, 'discrete': True, 'seed': None, 'start_from_history': None, 'python_version': 'python3', 'save_path_image': None, 'save_path_results': None, 'goal_node': 0, 'goalPos': [40, 40, 100]}", '16', '51141']' died with <Signals.SIGSEGV: 11>.
^C
########## SIG 2 - SIGINT: interactive attention signal, probably a ctrl+c ##########

@EtienneMenager

EtienneMenager commented 1 year ago

Hi,

The thread closure can come from many different places. Did you check if the errors came from the scene creation like last time?

Question : is the python executable (/usr/bin/python3) the one used by Sofa?

ziyao-hhs commented 1 year ago

Hi,

The thread closure can come from many different places. Did you check if the errors came from the scene creation like last time?

Question : is the python executable (/usr/bin/python3) the one used by Sofa?

the scene can be successfully loaded in sofa and stepping forward. Yes, Sofa is in the base environment in ubuntu, and I suppose it is using the default python under /usr/bin/python3/python3.10 I'm really not an expert here. Is it possible to ask for your remote help be desk control or something more directly? I still consider sofagym a ideal platform but indeed spend too much time on trying to make demo running lol.

EtienneMenager commented 1 year ago

Please send me an email at etienne.menager@inria.fr, I have some time to help. I will summarise here after solving the problem.

alxbilger commented 1 year ago

I suggested a fix for the addNewData here: https://github.com/SofaDefrost/STLIB/pull/92

alxbilger commented 1 year ago

No activity after 2 months. Closing the issue, but don't hesitate to open it again if necessary.