## 3 Description of the Control System  
Over the years, in the area of autonomous devices used in industrial applications, significant developments have been observed. Robots have become an inseparable part of modern automation. A constant improvement in microprocessors and programmable systems makes robotic constructions capable of carrying out more and more computationally demanding operations. In the case of autonomous (self-driving) robots, it is not allowed to place the main control loop in the cloud control system, due to a possible connection problem or data-transfer delay, and therefore a real-time operating system should be used. Thus, sufficient computational power on board of a robot chassis is required. This is possible using edge computing systems (e.g., NVIDIA Jetson modules). On the other hand, the application of these processing units is strongly governed by their high price. Additionally, to fulfill the requirements of modern industry, controllers with wireless connection protocols on board should be applied. In this project, an ESP32 module has been used. The ESP32 board is a low-cost microcontroller system developed by Espressif Systems. When comparing this module with other popular development boards (e.g., Nucleo), the communication possibilities should be emphasized. It is considered as a microcontroller dedicated to Internet of Things applications. Not only does the ESP32 contain Wi-Fi and Bluetooth modules, but it also integrates some basic sensors on board (e.g., Hall sensor and touch sensor). The main unit of the board is powered by a dual-core Tensilica microprocessor (240 MHz). In addition to the typical GPIO pins used for connections, it also provides an analog-to-digital converter (12 channels) and DAC (2 channels). Additional details of the specifications are presented in Table 1. Considering the advantages of this device, it seems a perfect solution for a low-cost main control unit in a developed construction. The ESP32, combined with popular microcontroller units (e.g., STM32 boards), creates a powerful control system capable of running advanced applications in real time, which makes it a perfect tool for autonomously driving robots. The whole control system consisted of different microcontrollers. All of them worked in a master-slave system. The main microcontroller ensured the wireless connection with the robot, transferred the (read) data to the control web page and received proper instructions sent by the user. The main task was focused on calculations of inverse kinematics, which was obligatory to receive the information on which drive should be activated in a specific moment (with a proper reference speed in order to move the robot in desired direction). It was also responsible for collecting data from sensors. The control system was divided into two subsections: the first one was responsible for motion control of the robot, while the second one controlled the leveling system of the chassis. Each of them received the control commands from the master device (ESP32 module). The structure of the control system is shown in Figure 1.  
The first part of the control structure was responsible for motion control of the robot. The whole drive module was divided into two parts. The first one controlled the front axle drives, while the second one was responsible for the rear axle. Each of them was equipped with two independent in-wheel BLDC motors. For each axle, a dedicated BLDC controller was designed. The control algorithm was implemented in the STM32F103R microcontroller. The BLDC control module, in the form of an independent board, contained both power and control modules. Different ways to control a BLDC motor have been described in the literature [32]. In the case of brushless motors, it is demanded to ensure a correct phase switching sequence instead of delivering a proper voltage to its terminals [33]. To ensure correct operation, an electronic commutator is required (usually in the form of a 3-phase inverter module).