Mount and Dismount Different Robot Tools - Problem with signal connection

Hello! I am currently working in Robot Programming and my goal is mounting and dismounting different tools on robot. When I mount a ‘Generic 3-Jaw Gripper’ it connects signals to the robot automatically, and on dismounting it disconnects signals. After that tool, I tried to mount ‘Parametric Box Gripper’ but that tool doesn’t connect automatically signals to the robot as ‘Generic 3-Jaw Gripper’. In component properties ‘AutoConnectIOs’ is turned on but it doesn’t seem that helps much.

I’ve atttached photos and .vcmx file. Please help :slight_smile:

Mount_Tools.vcmx (461.1 KB)

If you wanna control gripper, it works when you change grippers control type to ‘External Axis’. By that you can control it from ss below in ’ Robot Jog’ window
Ekran Alıntısı
But ‘IO’ control doesnt seem to work in my case also. It doesnt work in PNP mode too so i dont think you did something wrong.

Hi antonija26,

I compared the python scripts for the 3-Jaw Gripper and the Box Gripper and there is a small difference in the Auto I/O Functions section of the code. Commenting out or deleting the 6 lines shown in the screenshot down below makes it work!

First, select the box gripper in the 3D world, then go to the modeling tab. In the Component Graph, double click “Gripper Logic”:

In the editor, scroll down to lines 253-259 and either comment them out as show in the screenshot (with a # at the start of each line) or delete them:
After you’ve done that, click the Compile button highlighted in the screenshot:
You can then close the editor and run your simulation again, the signals should connect and the box gripper will close when picking the part.

Not exactly sure WHY it works, but it does :stuck_out_tongue:

1 Like

In this case, the tools are being mounted and dismounted while simulation is running using Set Output statements in the robot program. What @xILukasIx wrote should fix the issue for you as along as the state of everything is good when you reset simulation. For example, if you mount gripper to robot during simulation then the gripper should automatically dismount when you reset simulation.

I will explain more if it helps, for example if you plan on modeling your own gripper.

Attach tool to robot
Generally, interfaces are used to connect a tool to a robot. The connected interfaces attach the tool to the robot, so the tool moves with the robot. This is done using Hierarchy field.

Import/export joints
The interfaces can also export joints/axes of tool to robot, so the robot controller can drive those axes, e.g. opening and closing gripper. This is done using Export Joint field.

Connect signals
The interfaces can also automatically connect signals of tool to robot. Connecting two signal behaviors is straightforward with Signal field. However, connecting signals of tool to IO of robot requires a custom behavior, thereby a Python Script. This is what the Box Gripper’s GripperLogic is doing. It is listening for events when interface of tool is connected or disconnected, and then executing a function (event handler) to connect the signals to IO of the robot, i.e ports in Boolean Signal Map behaviors. For some reason, the event handlers are removed at start of simulation, but then added again when simulation is reset. So if you try to mount the tool to robot while simulation is running, the script for connecting the signals will not work.

IO wizard
I have not checked, but I believe the IO wizard in the Modeling tab is generating the GripperLogic script behavior.
@jouha Any idea, and is this intentional?

1 Like

Thank you @xILukasIx , I have also compared the scripts and noticed that they differ in that part but haven’t tried changing it :sweat_smile:
I also tried that on my own gripper and the solution works.

@zesty I also thank you too for the detailed answer and description, it helped. :slight_smile:
Yes, IO wizard in the Modeling tab is generating the GripperLogic script behavior which on default has this part:

def OnStart():
iface.OnConnect = None
iface.OnDisconnect = None

def OnReset():
iface.OnConnect = onConnectEvent
iface.OnDisconnect = onDisConnectEvent

that needs to be removed/commented if you want to mount gripper to robot during simulation.


@zesty IO Wizard does create a script that handles control signals for the servo controller. It’s similar to the GripperLogic script but not exactly the same.