This page provides a detailed overview of how to create a task in which two devices communicate via TCP/IP.


Contents


Overview


This tutorial demonstrates how to create a task in which two devices communicate via Transmission Control Protocol/Internet Protocol (TCP/IP). The devices being used are Sawyer robots. One robot will scan an area continuously to detect if a part is present. If so, a pass signal will be sent to the other robot via TCP/IP. Once this signal is received the second robot will perform a pick and place.


Definitions


  • Transmission Control Protocol/Internet Protocol (TCP/IP) - Two layer communication protocol commonly used in industrial automation for device communication.
  • Packet - Data which have been specifically defined to allow for communication between two TCP/IP devices.

Prerequisites



Configuring Devices


The TCP/IP devices used in this task are two Sawyer robots on the same network.


1. Begin by connecting to both robots through the Intera Studio and opening a new task on each.

2. On Sawyer 1 open the Device Editor and create a new device. Sawyer 1 will be detecting the part. Configure this device to connect to a device and enter the IP address for Sawyer 2. These devices must be located on the same network in order to communicate. Set the port to 4001.


DeviceEditor1.png


3. Select Unpack Data – In. Change the Start Delimiter dropdown to comma and the End Delimiter dropdown to semicolon. These dropdown fields define the format of each data packet. This tutorial specifically uses comma and semicolon to define the data but these can be changed as long as the data packet being received is formatted identically as the data packet which was sent. The start and end delimiter fields are necessary to define the data packet, but the internal delimiter can be left undefined.


DeviceEditor2.png


4. Select Define Data – In. This is where the content of the data packet being received must be defined. The part detection task will wait for a ready signal from Sawyer 2 before starting. This signal is defined here by changing the name to Ready_in. The type is Boolean and the default value is false.


DeviceEditorDetect2.png


5. Select Pack Data – Out. Similar to Unpack Data – In, the configuration of the packet which is received must match that of the packet which is sent. The format of packet that is sent from Sawyer 1 to Sawyer 2 is defined here. Set Start Delimiter to comma and End Delimiter to semicolon.


DeviceEditorDetect3.png


6. Select Define Data – Out. This is where the content of the data packet being sent must be defined. Sawyer 1 will be detecting if a part is present and sending a pass signal to Sawyer 2 if it detects a part. Once this pass signal is received by Sawyer 2, this robot will perform a pick and place. Set the name of the signal to Pass/Fail_out of type Boolean with a default value of false.


DeviceEditorDetect4.png


7. Next, open the Intera Studio session for Sawyer 2 which will be reacting to Sawyer 1. Open the Device Editor and create a new device. Configure this device to receive connections and set the port to 4001. This must be the same port as the device on Sawyer 1.


DeviceEditorReact1.png


8. Select Unpack Data – In. The incoming data packet for Sawyer 2 must be defined identically as the sending data packet for Sawyer 1. In this case, set Start Delimiter to comma, End Delimiter to semicolon, and leave the other fields as default.


DeviceEditorReact2.png


9. Continue to Define Data – In. Sawyer 2 will be reacting to the pass/fail signal configured on Sawyer 1 in step 6. The incoming data packet must match this signal. Set the name to Pass/Fail, the data type to Boolean, and the default value to false so these two data packets match.


DeviceEditorReact3.png


10. Next select Pack Data – Out. This will be the ready signal sent back to Sawyer 1 when the behavior on Sawyer 2 is complete. This will command Sawyer 1 to begin detecting the again. Set Start Delimiter to comma, End Delimiter to semicolon, and leave the other fields as default.


DeviceEditorReact4.png


11. Select Define Data – Out. This is the final area which must be configured to properly send the ready signal packet from Sawyer 2 to Sawyer 1 in order for the detection task to start again. Set name to Ready_out, type to Boolean, and default value to false. This completes the device configuration for this task. The process is the same for any TCP/IP device to communicate with the robot.


DeviceEditorReact5.png


Building the Task


1. Begin by building the object detection task on Sawyer 1. The first step is to train the object in the Vision Panel. Please reference the Creating a Vision Action tutorial for instructions on how to train a vision task.

2. Add a Move To node and set the part detection pose.

3. Add a Do If node directly following this move to. This node will handle the logic decision to begin the detection sequence. Set the variable to Ready_in (in/Detect) is == true. Because of the continuous loop at the beginning of the behavior tree, the robot will stay at the part detection pose until the ready signal becomes true.


Sawyer1TaskImage1.png


4. Add a Vision Locate node. Select the object which was trained in step 1 and set the timeout to Infinity. The vision node will continue to execute until a part is detected. Modify the settings in the vision node as needed.

5. As a child to the vision node, add a Set To node which will send the pass/fail signal from Sawyer 1 to Sawyer 2. Set the variable to Pass/Fail (out/Detect) to true.


Sawyer1TaskImage2.png


6. Add a Wait Until node following this Set To. The Wait Until will wait for a ready signal from Sawyer 2 to be false in order to restart the task loop and begin detecting the area for an object again.


Sawyer1TaskImage3.png


7. Add a Set To node to reset the pass/fail signal. This must be done before the task repeats otherwise the behavior of Sawyer 2 will continue to run. This may be clearer later on in this tutorial once the task for Sawyer 2 is built. For now, set the variable Pass/Fail (out/Detect) to false in this node.


Sawyer1TaskImage4.png


 This is how the task should look for Sawyer 1:


Sawyer1BehaviorTree.png


8. Open the task for Sawyer 2. This task will be reacting to a pass/fail signal sent from Sawyer 1. If that signal is detected, Sawyer 2 will perform a basic pick and place routine. Start by adding a Move To node that is in a safe, neutral position for the arm.

9. Add a Do If node which will look for the ready signal from Sawyer 2. Set the variable to Pass/Fail (in/React) == true.


Sawyer2TaskImage1.png


10. Now add a basic pick and place sequence. Please see the Performing a Pick and Place tutorial for how to build this behavior.


Sawyer2BehaviorTree1.png


11. At the end of the place sequence, add a Set To node. This will set the ready signal back to Sawyer 1 to low. Sawyer 1 will wait for this signal to turn high again before detecting if another part is present. Set Ready_out (out/React) to 0 or false.


Sawyer2TaskImage2.png


12. Finally, add another Set To after the safe pose to turn the ready signal high. This will initiate the part detection sequence on Sawyer 1. Meanwhile, Sawyer 2 will be waiting for the pass/fail signal before breaking into the pick and place sequences. Set Ready_out (out/React) to true to create this behavior.


Sawyer2TaskImage3.png


13. The final task for Sawyer 2 is shown below. This tutorial shows how to create a basic task structure and place all of the logic correctly to get two devices to communicate via TCP/IP. The specific components of the user’s task should be modified as needed with any required features for the application.


Sawyer2BehaviorTree2.png