This article describes the communication between the FlexiBowl separation system from ars and the HORST robot system.
1. Version Information
This article, the example programs, and the functions refer to the following versions:
- horstFX 2023.11.01
- FlexiBowl Revision 2.6 - Edition 08/2022
2. Introduction
FlexiBowl is a versatile feeding system that uses the movement of a rotating surface actuated by a servo drive and an encoder to ensure the correct alignment and singulation of parts. It can handle part families with dimensions ranging from 1-250 mm and weights from 1-250 g. The FlexiBowl is available in 5 different models.
This article discusses the communication between the robot system HORST and the FlexiBowl. At the end of the article, a global function set containing commands to control the FlexiBowl can be downloaded.
3. System Setup
The setup and assembly of the system are well described in the assembly manual of the FlexBowl. ars provides a Windows application that allows users to control and configure the FlexiBowl through a graphical user interface.
4. Communication
Communication between the robot and the FlexiBowl can occur through both digital and TCP/IP methods. It is important to note that only one of these options can be used during operation. In the ars user interface, the "Enable Digital I/O" switch must be activated for digital communication. When the digital interface is enabled, access to the graphical user interface is restricted since it also communicates via TCP/IP.
This article primarily focuses on communication via TCP/IP. This communication option has the advantage that all the parameters, for example for the FlexiBowl's shake or move process, can be transferred. On the other hand, the digital interface currently has the advantage that the FlexiBowl can be controlled even during the robot's movement. This may potentially reduce the cycle time in an application.
Comprehensive information on communication can be found in the assembly manual of the FlexiBowl.
4.1 TCP/IP
4.1.1 Setting up the IP Address
In order for the FlexiBowl to be able to communicate with the robot or with the Windows PC via the graphical user interface, both participants must be in the same IP address range. Instructions on how to set the robot's IP address can be found in the following article: Change the IP address.
The IP address of the FlexiBowl can be changed using the Windows application "IP Address Tool" which is provided with the FlexiBowl. It is recommended to first bring the PC into the same range as the standard IP address of the FlexiBowl (192.168.1.10). After launching the IP Address Tool, you can enter this address into the top textfield IP Address. Multiple addresses can be set in the FlexiBowl using a built-in Dip-Switch, which can be mechanically selected. By default, it is positioned at 1. The "Read from Drive" button allows you to retrieve the stored and assigned addresses on the FlexiBowl. To avoid manually adjusting the Dip Switch of the FlexiBowl, you can change the IP address at Switch Position 1. It is recommended to save the changes after altering the IP address by using the "Save to Drive" button. When reconnecting, remember to bring the PC back to the appropriate IP address range.
4.1.2 Establishing the Connection
The following function in horstFX allows you to establish a connection to the FlexiBowl.
var IPFlexibowl = "192.168.0.20";
var PortFlexibowl = 7776;
var SocketFlexibowl = null;
// Establish connection to Flexibowl
connectToFlexibowl();
// Establish connection to Flexibowl
function connectToFlexibowl()
{
var [ConnectSuccessFlexibowl, socket_local] = openSocket(IPFlexibowl, PortFlexibowl, 10000);
if(ConnectSuccessFlexibowl == 1.0)
{
showHint("Connection to Flexibowl established");
SocketFlexibowl = socket_local;
}
else
{
showError("An error occurred while connecting to the Flexibowl! The program is aborted for safety reasons!");
exitRobotScript();
}
}
4.1.3 Sending information to the FlexiBowl
To send information to the FlexiBowl, it is essential to follow the correct syntax. A message consists of three parts as follows:
- Header: Chr(0) Chr(7)
- Command: For example, use "QX2" for the "Move" command (The command set can be found starting from page 68 in the assembly manual of the FlexiBowl).
- Footer: Chr(13)
This can be implemented in horstFX as follows:
var SocketFlexibowl = null;
var Command = "QX2";
writeToFlexibowl(Command);
// Send message to Flexibowl
function writeToFlexibowl(Command)
{
var Header = "\0" + "\x07";
var Futher = "\r";
var WriteSuccess = writeSocket(SocketFlexibowl, Header+Command+Futher);
if(WriteSuccess != 1.0)
{
showError("An error occurred while writing to the Flexibowl! The program is aborted for safety reasons!");
exitRobotProgram();
}
}
4.1.4 Reading information from the FlexiBowl
The FlexiBowl answers whether the message sent to it was correctly interpreted. The message consists of three parts as follows:
- Header: Chr(0) Chr(7)
- Echo: % If the message was correctly interpreted; otherwise, in case of an error ?
- Footer: Chr(13)
This can be implemented in horstFX as follows:
// Get and check echo of Flexibowl command
function getCommandEchoFlexibowl()
{
readFromFlexibowl();
if (Data.charAt(2) != "%")
{
showError("The Flexibowl could not interpret the command correctly! \nThe program is aborted for safety reasons!");
exitRobotProgram();
}
}
// Read message of Flexibowl
function readFromFlexibowl()
{
var [ReadSuccess, Data_local] = readSocketToDelimiter(SocketFlexibowl, "\r", 10000);
Data = Data_local;
if (ReadSuccess != 1.0)
{
showError("An error occurred while reading from the Flexibowl! The program is aborted for safety reasons!");
exitRobotProgram();
}
}
4.1.5 Closing the Connection
In case of program termination or errors, it is important to properly close the socket connection to the FlexiBowl. This can be achieved by using the following function call:
closeSocket(SocketFlexibowl);
4.1.6 Complete example function
To correctly send a command to the FlexiBowl, it is important to first check if the FlexiBowl is ready to receive the command or if it is currently performing another action (such as the Quick-Emptying function, which may take some time). In the following scenario, the robot waits until the FlexiBowl is ready to execute an action (using the function getStateFlexibowl()). After confirming that the FlexiBowl is not in an error state, the desired action is then sent to it.
The following code excerpt illustrates a "move command" for the FlexiBowl. This function is designed to be easily used as a global function in a horstFX program. More information on this topic can be found in Section 5: Utilizing Functions in horstFX
function Flexibowl_move()
{
// Move parts on the Flexibowl
var IPFlexibowl = "192.168.0.20";
var PortFlexibowl = 7776;
var SocketFlexibowl = null;
var Data = null;
// Establish connection to Flexibowl
connectToFlexibowl();
try
{
moveFlexibowl();
}
finally
{
var CloseSuccessFlexibowl = closeSocket(SocketFlexibowl);
}
// Establish connection to Flexibowl
function connectToFlexibowl()
{
var [ConnectSuccessFlexibowl, socket_local] = openSocket(IPFlexibowl, PortFlexibowl, 10000);
if(ConnectSuccessFlexibowl == 1.0)
{
showHint("Connection to Flexibowl established");
SocketFlexibowl = socket_local;
}
else
{
showError("An error occurred while connecting to the Flexibowl! The program is aborted for safety reasons!");
exitRobotScript();
}
}
// Move the Flexibowl with the current parameters
function moveFlexibowl()
{
showHint("Move Flexibowl");
getStateFlexibowl();
var Command = "QX2";
writeToFlexibowl(Command);
// Check CommandEcho of Flexibowl
getCommandEchoFlexibowl();
}
// Check if Flexibowl ist ready and has performed previous action
function getStateFlexibowl()
{
var Command = "IO";
var CountLoops = 0;
writeToFlexibowl(Command);
sleep(50);
readFromFlexibowl();
// Get last significant bit of Flexibowl message
var Ready = Data.substr(Data.length-2, Data.length);
// Wait until Flexibowl is ready to perform an action
while ( (Ready != 1) && (CountLoops < 500) )
{
writeToFlexibowl(Command);
sleep(50);
readFromFlexibowl();
Ready = Data.substr(Data.length-2, Data.length);
if ( (CountLoops % 10) == 0 )
{
showHint("Flexibowl is busy");
}
sleep(100);
CountLoops = CountLoops + 1;
}
getErrorStateFlexibowl();
}
// Check the Error State of Flexibowl
function getErrorStateFlexibowl()
{
var Command = "IOY";
writeToFlexibowl(Command);
readFromFlexibowl();
// Get last significant bit of Flexibowl message
var Error = Data.substr(Data.length-2, Data.length);
if (Error == 1)
{
showError("The Flexibowl has an internal error! \n"+
"You can try to reset the flexibowl via the function: resetAlarmFlexibowl() or try a reboot. \n\n" +
"The program is aborted for safety reasons!");
exitRobotProgram();
}
}
// Get and check echo of Flexibowl command
function getCommandEchoFlexibowl()
{
readFromFlexibowl();
if (Data.charAt(2) != "%")
{
showError("The Flexibowl could not interpret the command correctly! \nThe program is aborted for safety reasons!");
exitRobotProgram();
}
}
// Send message to Flexibowl
function writeToFlexibowl(Command)
{
var Header = "\0" + "\x07";
var Futher = "\r";
var WriteSuccess = writeSocket(SocketFlexibowl, Header+Command+Futher);
if(WriteSuccess != 1.0)
{
showError("An error occurred while writing to the Flexibowl! The program is aborted for safety reasons!");
exitRobotProgram();
}
}
// Read message of Flexibowl
function readFromFlexibowl()
{
var [ReadSuccess, Data_local] = readSocketToDelimiter(SocketFlexibowl, "\r", 10000);
Data = Data_local;
if (ReadSuccess != 1.0)
{
showError("An error occurred while reading from the Flexibowl! The program is aborted for safety reasons!");
exitRobotProgram();
}
}
// Close sockets and exit robot program
function exitRobotProgram()
{
closeSocket(SocketFlexibowl);
sleep(1000);
exitRobotScript();
}
}
5 Utilizing Functions in horstFX
All commands of the FlexiBowl are available as global functions in horstFX, allowing them to be directly accessed in the program or through a macro button.
5.1 Adding global functions to horstFX
In Section 6, the functions can be downloaded. Subsequently, these can be transferred to the robot or Windows PC using a USB stick.
The functions must be copied to the following directory on the robot system:
home -> fruitcore -> functions -> textual
If the directory does not exist yet, it is because no global function has been created on the robot system. In this case, you can easily create a global textual dummy function using horstFX. After creating it, the folders should now be present.
On the Windows system, you can find the functions folder in the same directory where the save files or the tools are located.
Documents\fruitcore\functions\textual
If the directory does not exist yet, it is likely because no global function has been created on the Windows system. In this case, you can easily create a global textual dummy function using horstFX. After creating it, the folders should now be present.
5.2 Calling and modifying textual functions in horstFX
In horstFX, functions can be called or modified after adding them. It is important to ensure that the IP address in each function matches the IP address of the Flexibowl and falls within the range of the robot's or computer's IP address. The IP address can be easily changed at the beginning of each function.
Within the functions, only the IP address or the port should be adjusted, as otherwise, the function may no longer work. An exception is the "Flexibowl_setParameters" function, in which parameters for shake or move commands can be adjusted.
The functions can be called using the "Function Call" action.
5.3 Function Call via Macro Button
To control the FlexiBowl without running a program, for example during setup, the respective functions can be executed using macro buttons. These buttons can be configured within the program and then easily accessed for use.