SoftRobots icon indicating copy to clipboard operation
SoftRobots copied to clipboard

Some issues reported in the tutorial of sofapython3

Open ozilxu opened this issue 3 years ago • 5 comments

@guparan @ErwanDouaille @alxbilger @hugtalbot @damienmarchal

I have encountered several problems in the tutorial of sofapython3 (using the Linux + Python3.8 version of the robosoft2022 conference). Thank you very much for reviewing these issues.

1. When I try to change the color with the code in the FirstStep tutorial

Cube(rootNode,
      translation=[0.0,0.0,0.0],
      uniformScale=20.0,
      color=[0.0,0.0,1.0]) 

After reload, the color of the cube has not been changed and in the terminal shows

Finished validating node "root". [WARNING] [CGLinearSolver(CGLinearSolver)] Required data "iterations" has not been set. Falling back to default value: 25 [WARNING] [CGLinearSolver(CGLinearSolver)] Required data "tolerance" has not been set. Falling back to default value: 1e-05 [WARNING] [CGLinearSolver(CGLinearSolver)] Required data "threshold" has not been set. Falling back to default value: 1e-05

I am not sure if it is the problem of the code itself.

2. When I try to use the keyboard to control the cable in the tutorial of CableGripper

The terminal shows Finished validating node "root". [WARNING] [Node(root)] Default Animation Manager Loop will be used. Add DefaultAnimationLoop to the root node of scene file to remove this warning [INFO] [SofaViewer] QtViewer::keyPressEvent, CONTROL pressed [INFO] [SofaViewer] QtViewer::keyPressEvent, CONTROL pressed

But the cable is not moving, and I don't know the reason.

3. In the Pneunet Gripper tutorial

When I press ctrl++ or ctrl -, the gripper is not inflated or deflated, the terminal just shows WARNING] [LocalMinDistance(Proximity)] Determinant is null

4. The detailed tutorials of CircularRobot, DiamondRobot, Trunk and SoftArmGripper are lost. May I ask where I can learn those API and Python Classes?

5. When I open the scene of duplicating the finger in the CableGripper tutorial, the scene is so weird to have two fingers unregularly crosses.

image

ozilxu avatar Jun 09 '22 07:06 ozilxu

  1. Cube is expecting a list of four elements [R,G,B,A] for the color. I think if you give only [R,G,B], a 0 will be added at the end which will give you a transparent object (see this issue). Could that be your problem?
  2. If the problem occurs in the step3 of the tutorial, it has been fixed on the master branch of SoftRobots. You can see this discussion.
  3. Sorry I can't reproduce the problem. In PneunetGripper/details/fingerController.py you can try to display the key and check for + and -:
 def onKeypressedEvent(self, e):
        print(e['key'])
  1. There are no detailed steps for these tutorials yet. We'll work on that :)
  2. Which step is that?

EulalieCoevoet avatar Jun 09 '22 08:06 EulalieCoevoet

New problem when opening the tripod tutorial, the terminal shows @guparan @ErwanDouaille @alxbilger @EulalieCoevoet :




########## SIG 11 - SIGSEGV: segfault ##########
  sofa::helper::BackTrace::sig(int)
  sofa::gui::qt::viewer::GLBackend::drawBackgroundImage(int, int)
  sofa::gui::qt::viewer::qgl::QtGLViewer::DisplayOBJs()
  sofa::gui::qt::viewer::qgl::QtGLViewer::drawScene()
  sofa::gui::qt::viewer::qgl::QtGLViewer::draw()
  QGLViewer::paintGL()
  QWidget::event(QEvent*)
  QApplicationPrivate::notify_helper(QObject*, QEvent*)
  QApplication::notify(QObject*, QEvent*)
  QCoreApplication::notifyInternal2(QObject*, QEvent*)
  QWidgetPrivate::sendPaintEvent(QRegion const&)
  QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
  QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
  QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
  QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
  QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
  QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
  QWidgetPrivate::syncBackingStore()
  QWidget::event(QEvent*)
  QMainWindow::event(QEvent*)
  QApplicationPrivate::notify_helper(QObject*, QEvent*)
  QApplication::notify(QObject*, QEvent*)
  QCoreApplication::notifyInternal2(QObject*, QEvent*)
  QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)
  g_main_context_dispatch
  g_main_context_iteration
  QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
  QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
  QCoreApplication::exec()
  sofa::gui::qt::RealGUI::mainLoop()
  sofa::gui::GUIManager::MainLoop(boost::intrusive_ptr<sofa::simulation::Node>, char const*)
  __libc_start_main
Segmentation fault (core dumped)

ozilxu avatar Jun 13 '22 02:06 ozilxu

Hi @ozilxu,

Could you give feedback on your first issues ? As for the new issue, which scene gives you that ?

EulalieCoevoet avatar Jun 16 '22 08:06 EulalieCoevoet

@EulalieCoevoet @damienmarchal @hugtalbot @guparan @alxbilger @ErwanDouaille Thanks a lot for your help and sorry for my late reply! Now I am using the new version of 22.06 in my Windows OS embedded with Python3.8 for testing.

  1. My first issue of the color, when I try to use the format of the color [R,G,B,A]

cube = Cube(rootNode, translation=[0.0,0.0,0.0], uniformScale=20.0,color=[1.1,0.7,0.6,0.1])

The color cannot be changed as well and I got the below information.

[INFO]    [SceneCheckerVisitor] Finished validating node "root".
[WARNING] [CGLinearSolver(CGLinearSolver)] Required data "iterations" has not been set. Falling back to default value: 25
[WARNING] [CGLinearSolver(CGLinearSolver)] Required data "tolerance" has not been set. Falling back to default value: 1e-05
[WARNING] [CGLinearSolver(CGLinearSolver)] Required data "threshold" has not been set. Falling back to default value: 1e-05
  1. When I try to add the below code in the DefrostSofaBundle_win64_python3.8_v22.06.00-beta4\plugins\SoftRobots\docs\sofapython3\tutorials\CableGripper\details\step3.py

rootnode.createObject('FreeMotionAnimationLoop') rootnode.createObject('GenericConstraintSolver', tolerance=-1e-5, maxIterations=100)

I cannot control the cable as well and the terminal shows the below information:

  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.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
  <RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Correction"/> <!-- Needed to use components [LinearSolverConstraintCorrection] -->
  <RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Solver"/> <!-- Needed to use components [GenericConstraintSolver] -->
  <RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
  <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshVTKLoader] -->
  <RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [SparseLDLSolver] -->
  <RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [BarycentricMapping] -->
  <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
  <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
  <RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TetrahedronFEMForceField] -->
  <RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [RestShapeSpringsForceField] -->
  <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
  <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
  <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglSceneFrame] -->

image

  1. When I try with DefrostSofaBundle_win64_python3.8_v22.06.00-beta4\plugins\SoftRobots\docs\sofapython3\tutorials\PneunetGripper\details\step7-withSTLIB.py and try to control the arm with keyboard. I cannot see the deformation of the arm the terminal shows:
[INFO]    [SceneCheckerVisitor] Validating node "root" with checks: [SceneCheckDuplicatedName, SceneCheckMissingRequiredPlugin, SceneCheckUsingAlias, SceneCheckDeprecatedComponents, SceneCheckCollisionResponse]
[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.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase, BruteForceBroadPhase, DefaultPipeline] -->
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [LocalMinDistance] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [LineCollisionModel, PointCollisionModel, TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [DefaultContactManager] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Correction"/> <!-- Needed to use components [LinearSolverConstraintCorrection, UncoupledConstraintCorrection] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Solver"/> <!-- Needed to use components [GenericConstraintSolver] -->
<RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader, MeshSTLLoader, MeshVTKLoader] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [SparseLDLSolver] -->
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [BarycentricMapping] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.Setting"/> <!-- Needed to use components [BackgroundSetting] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TetrahedronFEMForceField] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [RestShapeSpringsForceField] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel, OglSceneFrame] -->

[WARNING] [SceneCheckUsingAlias] This scene is using hard coded aliases. Aliases can be very confusing, use with caution.
- MeshOBJLoader: 3 created with alias "MeshObjLoader"
[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
[INFO]    [SofaViewer] QtViewer::keyPressEvent, CONTROL pressed
[INFO]    [SofaViewer] QtViewer::keyPressEvent, CONTROL pressed
[INFO]    [SofaViewer] QtViewer::keyPressEvent, CONTROL pressed

image

  1. For the other part of the tutorial, like CircularRobot, DiamondRobot,Trunk and SoftArmGripper,are there website or tutorial for explaining the corresponding Python APIs?

  2. When I open the scene of duplicating the finger in the CableGripper tutorial, the scene is so weird to have two fingers unregularly crosses. -> This issue is fixed with the new version and the duplication is worked! Thanks again!

  3. I still have this issue with the 22.06 linux version with Python3.8 when trying to opening any .py file with Sofa

########## SIG 11 - SIGSEGV: segfault ##########
sofa::helper::BackTrace::sig(int)
sofa::gui::qt::viewer::GLBackend::drawBackgroundImage(int, int)
sofa::gui::qt::viewer::qgl::QtGLViewer::DisplayOBJs()
sofa::gui::qt::viewer::qgl::QtGLViewer::drawScene()
sofa::gui::qt::viewer::qgl::QtGLViewer::draw()
QGLViewer::paintGL()
QWidget::event(QEvent*)
QApplicationPrivate::notify_helper(QObject*, QEvent*)
QApplication::notify(QObject*, QEvent*)
QCoreApplication::notifyInternal2(QObject*, QEvent*)
QWidgetPrivate::sendPaintEvent(QRegion const&)
QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)
QWidgetPrivate::syncBackingStore()
QWidget::event(QEvent*)
QMainWindow::event(QEvent*)
QApplicationPrivate::notify_helper(QObject*, QEvent*)
QApplication::notify(QObject*, QEvent*)
QCoreApplication::notifyInternal2(QObject*, QEvent*)
QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)
g_main_context_dispatch
g_main_context_iteration
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
QCoreApplication::exec()
sofa::gui::qt::RealGUI::mainLoop()
sofa::gui::GUIManager::MainLoop(boost::intrusive_ptr<sofa::simulation::Node>, char const*)
__libc_start_main
Segmentation fault (core dumped)

ozilxu avatar Jul 11 '22 05:07 ozilxu

Hello @ozilxu,

I'm really sorry we didn't follow up on these issues. I hope you managed to find solutions, hopefully the latest binaries worked for you ?

EulalieCoevoet avatar Oct 20 '23 09:10 EulalieCoevoet