This page provides a detailed overview of how to create a task in which two devices communicate via TCP/IP.
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.
- 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.
- Getting Started with Intera 5
- Configuring End of Arm Tooling
- Creating a Sequence of Moves
- Performing a Pick and Place
- Using Signals and Variables
- Creating a Vision Action
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
This is how the task should look for Sawyer 1:
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.
10. Now add a basic pick and place sequence. Please see the Performing a Pick and Place tutorial for how to build this behavior.
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.
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.
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.
Was this article helpful?
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
We appreciate your effort and will try to fix the article