# Implementation of Robots Integration in Scaled Laboratory Environment for Factory Automation
## 4 System Integration and Experiment  
The integration of the system is obtained by the cloud infrastructure with open platform for innovations in logistics (OPIL). OPIL is the open IoT platform that enables digital virtualization, automated scenario setup and communication interface for different factory floor resources. Mobile robots, AGVs, workers, sensors and factory IT infrastructure can be connected through this platform in order to develop and test factory logistic automation. Figure 9 shows the high level organization of integration of our robotic systems with the OPIL platform. Figure 8: Block diagram for controlling the ABB IRB 140 robot arm from the ROS application. The connection between robots and the cloud is established with the messaging system based on the FIWARE open architecture. The deployment scheme for OPIL-based systems contains the following modules:  
* OPIL server as a cloud infrastructure responsible for hosting the modules, such as task planner, context management, HMI (human-machine interface), SP (sensing and perception). * Different nodes in the field, including mobile robots, AGVs, forklifts and sensors. Generic components of the OPIL server are distributed in a multi-layer architecture, where the bottom layer (IoT nodes layer) components enable interaction with the physical world. This layer may include the following components:
* Robotic agent nodes (RAN) as nodes responsible for dealing with the physical actors. In the OPIL world, that could be manipulation agents (intended for loading and unloading the goods and products) or moving agents (intended for moving goods or products from one place to another). * Human agent nodes (HAN) as nodes in charge of interfacing with humans. * Sensor agent node (SAN), i.e., nodes that allow data transfer from various sensing sources to the cloud. As an illustration of RAN node functionality, let us consider the robot's motion in dynamic environments. Robot goals can be acquired from servers on the local network, or from the cloud. Setting the robot's target point starts with reading the current desired position of a robot inside of a facility and publishing that information on an adequate ROS topic. Upon reaching the destination, a task command is issued to a robot, based on readings from a server. The message consists of the position and task command, such as the lifting up or down robot tool. Additionally, the message has the maximum allowed velocity of a robot, desired acceleration rate, etc. Algorithm 1 describes the process executed inside the RAN module. Similarly, it is necessary to provide the main system with current sensor readings of the robot's environment. The ROS node tasked with this job is called the sensor agent node (SAN). SAN feeds sensor readings, such as LaserScan received from a LiDAR sensor, to a server. Those readings provide the system with the robot's current environmental status, based on which the next goal is generated. The new goal is updated over a certain part of the message body generated on server. Figure 9: System architecture of robots integration with OPIL platform. ```
Initialize ROS node;  Open connection to a server loop  read current assignment from a server  publish goal to ROS topic if task command issued then  call ROS service for task execution endif  send current robot pose to server (odometry readings) endloop
```  
**Algorithm 1** Goal and task reading. As previously mentioned, abb_driver, written in RAPID and C++ programming languages, was used to control the robotic arm using the ROS-I platform, while the sorting algorithm was written in the Python programming language. The application for palletizing consists of two modules. The sorting/palletizing module (cf. Algorithm 2) and module for communication with OPIL platform (cf. Algorithm 3). The sorting algorithm serves to relocate the industrial crates from the input pallet to the appropriate output pallet specified by the logistics system.