# Implementation of Robots Integration in Scaled Laboratory Environment for Factory Automation
## 3 Mobile Robot and Industrial Robot Design
### Software of Mobile Robot  
Mobile robot software consists of several interconnected ROS packages to provide navigation in both known and unknown environments. The main packages used for mapping and navigation are as follows:  
* The RTAB-SLAM ROS package, assigned to provide system (mobile robot) with both map of the environment and robot localization. * The TEB ROS package provides a path for a robot to follow, based on a map and odometry from the RTAB-SLAM package. * The RoboClaw ROS package enables integration of the motor drivers with the rest of the ROS system. Additionally, ROS drivers for the LiDAR sensor and RealSense camera are used to provide communication between them and the rest of the system. Figure 3 shows connections between the ROS nodes used on the mobile robot. Mobile robot motion and path planning are provided inside the move_base ROS package. The global_planner node, upon receiving a goal which is described as the desired position and orientation of a robot, outputs a path based on the map created by the RTAB-SLAM node, considering only static obstacles. Obstacle avoidance is provided inside the TEB_planner node, using the Laser Scan topic acquired from the RPLiDAR node (ROS topics are named buses over which nodes exchange messages [34]). The final output of move_base gives the RoboClaw node the desired velocity of the robot base, which is then transformed into corresponding motor speeds. Topics global_costmap and local_costmap, based on the configuration of corresponding nodes, provide distances from obstacles which are not considered safe for a robot to be close to, and path planners adjust trajectories based on those cost maps. To control the mobile robot platform, the main PC communicates with a motor controller using a dedicated ROS _motordriver_ros_ package. The _motordriver_ros_ package is implemented in Python programming language, enabling easier and faster modifications. The ROS driver package for the motor driver is separated in two parts. The first part communicates with motor controllers using the USB protocol and provides different measurements, such as encoder status, motor current, etc. It also provides a way to set the motor speed to the desired value. The second part of the _motordriver_ros_ driver communicates  
Figure 2: The forklift-type mobile robot with Mecanum wheel carrying EURO pallet with eight crates. with the rest of the system, providing information about the robot's speed and position and waits for a new speed command to be delivered by a path planner. The four wheeled Mecanum drive can be controlled in two ways. The first way is the standard four wheeled drive, where control and path planning algorithms assume that the mobile platform can move only forward/backward and rotate in place: in other words, with more movement constraints than the Mecanum drive. The control of such a mobile platform is done using the standard approach for controlling a differential drive mobile robot. To provide more flexibility in the mobile robot motion, speed commands provided by the path planner are converted to four separated motor speeds, each for different motor, using a motion model with constraints for mobile platforms with the Mecanum wheels approach described in [35]. Since Mecanum wheels can cause drift that is not sensed by wheel encoders, we had to rely on localization from SLAM. Based on our experience, we decided to use the RTAB-SLAM algorithm [15], as it performs good results for indoor environment accuracy improvements with path loop closure. In order to evaluate localization from the RTAB-SLAM algorithm and demonstrate the improvement of localization after the loop closure, we prepared a setup to measure coordinates of the mobile robot with an external precise measurement system. We used a motion capture system from the company Vicon, which relied on reflective markers and eight fast infrared cameras. The motion capture system was set up to capture the location of the markers placed on a mobile robot to track its location in the environment (cf. Figure 4).