Getting fields of proto in toolslot

23 views Asked by At

I have a Webots world and proto, where my proto (SoftGripperLars) is attached in the tool slot of the UR3e robot. The SoftGripperLars proto has translation fields for the gripper fingers, and I am trying to access these fields in the UR3e controller using functions like getfield(), getfromproto(), or getfromprotodef(). However, I'm facing difficulties retrieving the translation information.

# ... (World and other definitions)

UR3e {
    # ... (UR3e robot configuration)
    toolSlot [
        SoftGripperLars {
            translationFinger1 0.04 0.012 0
            rotationFinger1 0 0 -0.9999999999999999 1.5707953071795862
            translationFinger2 -0.04 0.012 0
            rotationFinger2 0.7071066717789584 -0.7071068905930504 -1.229829809714868e-06 3.14159
        }
    ]
}

#VRML_SIM R2023b utf8
        # TEST


        PROTO SoftGripperLars [
        field SFVec3f translationFinger1 0 0 0
        field SFRotation rotationFinger1 0 0 1 0
        field SFVec3f translationFinger2 0 0 0
        field SFRotation rotationFinger2 0 0 1 0
        field SFVec3f scale 1 1 1
        field SFString name "SoftGripperLars"
        field SFString model ""
        field SFString description ""
        field SFString contactMaterial "default"
        field MFNode immersionProperties [ ]
        field MFNode boundingObject [ ]
        field SFBool locked FALSE
        field SFFloat radarCrossSection 0
        field MFColor recognitionColors [ ]
        field SFFloat translationStep 0.01
        field SFFloat rotationStep 0.261799387
        field SFVec3f linearVelocity 0 0 0
        field SFVec3f angularVelocity 0 0 0
        ]
        {
        Solid {
        translation 0 0 0
        children [
        

        DEF Finger1 Solid {
        translation IS translationFinger1
        rotation IS rotationFinger1
        scale IS scale

        children [
        DEF Part1 CadShape {
        url [
        "../CAD/CAD softgripper_slice1.obj"
        ]
        }

            Hinge2Joint {
            jointParameters DEF Finger1_Joint1 HingeJointParameters {
            axis 0 0 1
            anchor -0.0191 -0.0085 0
            springConstant 0.9
            dampingConstant 0.1
            }
            jointParameters2 JointParameters {
            axis 0 1 0
            springConstant 1
            dampingConstant 1
            }
            device [
            RotationalMotor {
            name "finger1_rot_z_1"
            }
            ]
            endPoint DEF Finger1_Rigid1 Solid {
            translation -0.0236 -0.0073 -0.0006
            rotation 0 1 0 0
            children [
            CadShape {
            url [
            "../CAD/CAD softgripper_slice2.obj"
            ]
            }

            
    # rest of (SoftGripperLars definition)
}

I've tried using various functions like getfield() and others in the UR3e controller, but I'm unable to retrieve the translation values of any part of the finger (such as defined below DEF Finger1_Rigid1 or DEF Finger1_Joint1

How can I correctly access the translation fields of the gripper in the UR3e controller? Any insights or examples would be greatly appreciated.

0

There are 0 answers