Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pneunet gripper not gripping the cube #5060

Open
mirzazz10 opened this issue Oct 13, 2024 · 1 comment
Open

Pneunet gripper not gripping the cube #5060

mirzazz10 opened this issue Oct 13, 2024 · 1 comment
Labels
issue: bug (minor) Bug affecting only some users or with no major impact on the framework

Comments

@mirzazz10
Copy link

Problem

Description
I am trying to run the examples from the pneunet gripper to grab the cude from the scripts
"step7-withSTLIB.py" file and "step7-grabTheCube.py".

The gripper is not able to grip the cube. If I apply more pressure the gripper is entering into the cube which should not be the case.
Please find the screenshot attached.

Steps to reproduce
running the script step7-grabTheCube.py and using control "+" to grip the cube.

Expected behavior
The cube should be gripped and so that it can be picked up.

The code for "step7-withSTLIB.py" and "param.py" file as below.

Screenshot from 2024-10-12 18-06-10

"step7-withSTLIB.py"

`# STLIB IMPORT
from stlib3.scene import MainHeader
from stlib3.scene import ContactHeader
from stlib3.physics.rigid import Floor, Cube
from stlib3.physics.deformable import ElasticMaterialObject

SOFTROBOTS IMPORT

from softrobots.actuators import PullingCable, PneumaticCavity

CONTROLLER IMPORT

from wholeGripperController import WholeGripperController

ARGUMENTS IMPORT

from param import *

def createScene(rootNode):
rootNode.addObject('RequiredPlugin', name='Sofa.Component.AnimationLoop') # Needed to use components [FreeMotionAnimationLoop]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Collision.Detection.Algorithm') # Needed to use components [BVHNarrowPhase,BruteForceBroadPhase,CollisionPipeline]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Collision.Detection.Intersection') # Needed to use components [LocalMinDistance]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Collision.Geometry') # Needed to use components [LineCollisionModel,PointCollisionModel,TriangleCollisionModel]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Collision.Response.Contact') # Needed to use components [RuleBasedContactManager]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Constraint.Lagrangian.Correction') # Needed to use components [LinearSolverConstraintCorrection,UncoupledConstraintCorrection]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Constraint.Lagrangian.Solver') # Needed to use components [GenericConstraintSolver]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Engine.Select') # Needed to use components [BoxROI]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.LinearSolver.Direct') # Needed to use components [SparseLDLSolver]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.LinearSolver.Iterative') # Needed to use components [CGLinearSolver]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Mapping.Linear') # Needed to use components [BarycentricMapping]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Mapping.NonLinear') # Needed to use components [RigidMapping]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Mass') # Needed to use components [UniformMass]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.ODESolver.Backward') # Needed to use components [EulerImplicitSolver]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.SolidMechanics.FEM.Elastic') # Needed to use components [TetrahedronFEMForceField]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.SolidMechanics.Spring') # Needed to use components [RestShapeSpringsForceField]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.StateContainer') # Needed to use components [MechanicalObject]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Topology.Container.Constant') # Needed to use components [MeshTopology]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Topology.Container.Dynamic') # Needed to use components [TetrahedronSetTopologyContainer,TriangleSetTopologyContainer]
rootNode.addObject('RequiredPlugin', name='Sofa.Component.Visual') # Needed to use components [VisualStyle]

MainHeader(rootNode,
           plugins=['SofaPython3', 'SoftRobots'],
           gravity=[0.0, -9810, 0.0])

ContactHeader(rootNode,
              alarmDistance=5,
              contactDistance=1,
              frictionCoef=0.6)

rootNode.VisualStyle.displayFlags = "showBehaviors showCollisionModels"

Floor(rootNode, **floorParam)

cube = Cube(rootNode, **cubeParam)
cube.addObject('UncoupledConstraintCorrection')

for i in range(len(fingersParameters)):
    finger = ElasticMaterialObject(attachedTo=rootNode,
                                   volumeMeshFileName=fingersVolumeMesh,
                                   name=fingersParameters[i]['name'],
                                   rotation=fingersParameters[i]['rotation'],
                                   translation=fingersParameters[i]['translation'],
                                   surfaceMeshFileName=fingersSurfaceAndCollisionMesh,
                                   collisionMesh=fingersSurfaceAndCollisionMesh,
                                   withConstrain=True,
                                   surfaceColor=fingersColor,
                                   poissonRatio=poissonRatioFingers,
                                   youngModulus=youngModulusFingers,
                                   totalMass=fingersMass)

    finger.dofs.name = 'tetras'
    rootNode.addChild(finger)

    finger.integration.rayleighStiffness = 0.1
    finger.integration.rayleighMass = 0.1

    finger.addObject('BoxROI', name='boxROI', box=fingersParameters[i]['ROIBox'], drawBoxes=True, doUpdate=False)
    finger.addObject('RestShapeSpringsForceField', points='@../Finger1/boxROI.indices', stiffness=1e12,
                     angularStiffness=1e12)

    PneumaticCavity(surfaceMeshFileName=fingersCavitySurfaceMesh,
                    attachedAsAChildOf=finger,
                    name='Cavity',
                    rotation=fingersParameters[i]['rotation'],
                    translation=fingersParameters[i]['translation'],
                    initialValue=cavitiesInitialValue,
                    valueType='pressure')

rootNode.addObject(WholeGripperController(node=rootNode))

# -- coding: utf-8 --
import math

User parameters

cubeParam = {'name': "Cube",
'totalMass': 0.002,
'translation': [15.0, 20.0, 0.0],
'uniformScale': 21}

floorParam = {'name': "Plane",
'color': [1.0, 0.0, 1.0],
'isAStaticObject': True,
'uniformScale': 3}

Fingers Mesh & Shared Parameters

fingersVolumeMesh = 'data/mesh/pneunetCutCoarse.vtk'
fingersSurfaceAndCollisionMesh = 'data/mesh/pneunetCut.stl'
fingersCavitySurfaceMesh = 'data/mesh/pneunetCavityCut.stl'

Fingers Visu

fingersColor = [0.7, 0.7, 0.7, 0.6]

Fingers Position

heightInitial = 150
radius = 70
angle1 = 90 * math.pi / 180 # Angle between 1st and 2nd finger in radian
angle2 = 270 * math.pi / 180 # Angle between 1st and 3rd finger in radian

angle3 = 360 * math.pi / 180 # Angle between 1st and 4rth finger in radian

youngModulusFingers = 500
youngModulusStiffLayerFingers = 1500
poissonRatioFingers = 0.3
fingersMass = 0.04
cavitiesInitialValue = 0.0001

Parameters for each Fingers

fingersParameters = [
{
'name': 'Finger1',
'rotation': [0.0, 0.0, -270.0],
'translation': [100.0, heightInitial, 0.0],
'ROIBox': [100, heightInitial - 10, -20, 70, heightInitial, 20],
},
{
'name': 'Finger2',
'rotation': [360 - angle1 * 180 / math.pi, 0.0, 90.0],
'translation': [0, heightInitial, radius * math.cos(angle1 - math.pi / 2)],
'ROIBox': [100, heightInitial - 10, -20, 70, heightInitial, 20],
},
{
'name': 'Finger3',
'rotation': [360 - angle2 * 180 / math.pi, 0.0, 90.0],
'translation': [0.0, heightInitial, radius * math.cos(angle2 - math.pi / 2)],
'ROIBox': [100, heightInitial - 10, -20, 70, heightInitial, 20],
}
]
`


Environment

Context

  • System: < NAME AND VERSION - e.g: "Windows 10", "Ubuntu 20.04", ... >
    Command: lsb_release -a
    Distributor ID: Ubuntu
    Description: Ubuntu 22.04.4 LTS
    Release: 22.04
    Codename: jammy

  • Version of SOFA: v24.06.00 built with binaries

  • State: Build Directory

Command called

< COPY-PASTE YOUR COMMAND HERE >
![Screenshot from 2024-10-12 18-06-10](https://github.com/user-attachments/assets/47a941af-2286-435e-a832-94ccab211570)

Env vars

python -c "exec( \"import os, sys\nprint('#################')\nprint('--- sys.version ---')\nprint(sys.version)\nprint('--- PATH ---')\ntry:\n  print(os.environ['PATH'])\nexcept Exception:\n  pass\nprint('--- SOFA_ROOT ---')\ntry:\n  print(os.environ['SOFA_ROOT'])\nexcept Exception:\n  pass\nprint('--- PYTHONPATH ---')\ntry:\n  print(os.environ['PYTHONPATH'])\nexcept Exception:\n  pass\nprint('--- sys.path ---')\ntry:\n   print(str(sys.path))\nexcept Exception:\n   pass\nprint('#################')\" )"
< COPY-PASTE HERE THE RESULT OF THE COMMAND ABOVE >

Logs

Full output

< COPY-PASTE YOUR OUTPUT HERE >

Content of build_dir/CMakeCache.txt

< DRAG AND DROP YOUR CMAKECACHE.TXT HERE >


Thank you for your report.

@mirzazz10 mirzazz10 added the issue: bug (minor) Bug affecting only some users or with no major impact on the framework label Oct 13, 2024
@mirzazz10
Copy link
Author

Please let me know if I need any more information?
Any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug (minor) Bug affecting only some users or with no major impact on the framework
Projects
None yet
Development

No branches or pull requests

1 participant