Control algorithm for holonomic robot that balances on single spherical wheel

This paper presents the control algorithm for the new type of robot that balances on a single spherical wheel. This type of robot is called Ballbot and unlike other statically stable robots, it has a high gravity centre and a very small footprint. The robot is dynamically stable, which means that if the controller stops working, the entire construction will fall over. Because of that, it needs a special control algorithm to keep the balance. The presented Ballbot is fitted with sensors such as gyroscope and accelerometer and controls motors with omni-directional wheels to move the robot in any direction. This paper presents theoretical information about balancing robots and the most important elements of the robot. Next, the design concept of the controller based on STM32 family, control algorithms and filters were proposed and implemented. In the final section of this paper, the investigation results were presented and discussed.


Introduction
Statically stable mobile robots with height enough to interact with a human in a convenient way very often have big, heavy and wide wheelbase to achieve a low centre of gravity. This low gravity centre is necessary to prevent the fall when robot accelerates. Our robot can be as tall as a human being and does not have the drawback typical of conventional robots. The robot balances on a single spherical wheel. Unlike other balancing robots like Segway (balancing on two wheels) this robot does not need to turn in the direction of movement -it can move in every direction without changing its orientation. This article presents the construction of a robot with omni-directional wheels, IMU sensors and a complementary filter.
The outcome of the construction/research works were the proposed IMU filter, control algorithm and a working robot.
The presented robot design is known in the literature, which traditionally refers to it as "Ballbot". Ballbot is a robot that balances on a single spherical wheel. Because the whole construction is unstable and cannot work without a controller, it is dynamically stable. The main feature that distinguishes this robot is a single connection point to the ground. This fact causes that the robot is unstable, which means that when the controller stops working, the robot falls off the ball. Another important feature of Ballbots is their ability to move in any direction without changing their orientation while simultaneously being able to change their orientation in place. This feature causes that Ballbot to be an extremely agile and highly manoeuvrable bot, whose motion is somewhat similar to the motion of a human. As a result, the robot operates comfortably in restricted, crowded and dynamically changing environments. Balancing robots work on the principle of inverted pendulum and were invented by Ralph Hollis [2,3,4,5].
The entire system is presented in Fig. 1.

Real construction
The construction is based on threaded rods and shelves. The structure like this provides enough strength and stiffness while ensuring sufficient room for battery, electronics and motors. A completed Ballbot is presented in Fig. 2.

2D inverted pendulum
The idea of an inverted pendulum has been in the scope of scientific interest for some time. The cart-pendulum problem has been considered as a canonical problem in the control systems literature. The Ballbot is the development of a one-dimensional inverted pendulum. The idea of the proposed control system is to represent the robot as two separate inverted pendulums. Each of them works in a single plane. Planes are mutually perpendicular and one pendulum is independent of each other. The planes in question, XZ and YZ, are shown in Fig. 3.

IMU sensors
Owing to the need to obtain the orientation of the robot, it was fitted with two IMU sensors. One is the gyroscope, and the second one is the accelerometer. The implemented MPU-6050 chip is a MEMS sensor that contains a 3-axis gyroscope and a 3-axis accelerometer. To read data from the sensor, I2C interface was used. Fig. 4 shows raw data acquired from sensors. As shown, neither of the sensors is capable of providing reliable data for the control algorithm. The accelerometer data is noisy due to vibrations from the robot frame. Fig.  4B shows even more noise provided by working stepper motors.

Complementary filter
To determine the orientation of the robot the fusion of sensors is needed. The most used filters are: Kalman filter, Madgwick filter and complementary filter. In this study it was resolved that the simplest complementary filter should be the most effective solution.
The accelerometer provides the signal that needs to be filtered by the low-pass filter to cut-off high frequencies. On the other hand, the gyroscope readings should be filtered by the high-pass filter to avoid drift. Complementary filter adds positive features of both the signal and the output of the filter and is reliable for implementation in the main controller.
The proposed complementary filter is shown in Fig.  6.   Fig. 6. Scheme of proposed complementary filter.

Results
Complementary filter has only one variable parameter; its sensitivity was adjusted to achieve the best results.  The graph shows all negative characteristic of the signal from gyroscope (drift) and accelerometer (noise) and also shows that complementary filter was sufficient to provide the signal that is both responsive and free from noise.

Control algorithm
The Ballbot is "dynamically stable," which means that the design is in the need for a controller. The proposed solution consisted of an algorithm employing 3-axis acceleration signals , , and 2-axis gyroscope signals , . The outputs of the controller are three frequency signals 1 , 2 , 3 that are directly connected to the stepper motor drivers. This frequency is proportional to the speed of the motors that is represented by 1 , 2 , 3 . Because the authors used stepper motors, the speed of the motor is known and there is no need to use additional sensors to obtain the motor speed. An overview of the controller is shown in Fig. 8. The regulator has two inputs for control signals and . These signals are obtained from a smartphone.

Fig. 8. Overview of the control algorithm
The controller is based on 4 PID regulators. Two cascades connected to PID regulators are responsible for one of the robot's planes. As mentioned in Section 2.3, the controller is divided into two independent and perpendicular planes. Two PID controllers are needed for each plane. The "plane regulators" are totally independent of each other and act as if there were to be two inverted pendulums.
Because there are two parts of control with different dynamics (balancing and keeping the set speed) the authors proposed to use two cascade PID regulators per each plane. The first control loop is responsible for establishing the angle that robot has to balance around; the second loop is responsible for keeping the robot in balance.
The purpose of the first regulator is to obtain equilibrium angle , in which the robot will move at a set speed. This angle is continually changing and is dependent on the slope of the ground, obstacles under the ball and the robot's mass centre.
The second PID controller is responsible for balancing the robot and maintaining the angle calculated in the first loop.

Motors and wheels
Ballbots presented in the literature are based on different motors and wheels e.g. a mouse-ball system or a fourmotor system with servo and omni-directional wheels. In this study, the three-stepper motor is mounted at an angle of 120°. This design allows moving the ball in any direction. Fig. 10 presents the proposed system. Because three motors are implemented, none of them can be directly connected to the regulator. Speed signals from the regulator, ′ and ′, are computed and the speed of the motors is obtained.

Results
Coefficients of 4 PID regulators were adjusted manually to obtain the best results. Fig. 11 shows the angle of the robot in one plane during balancing. Fig. 11 also compares data from the accelerometer and complementary filter. Due to the vibrations the accelerometer data is very noisy and the signal is reached a 10° angle. The accelerometer alone is not sufficient. On the other hand, complementary filter provides data that is reliable to balance the robot at an angle of 2°.     Fig. 14 present the robot's path when moving from the starting to the end point. The plot shows that the Ballbot is able to move from one point on the floor to another. All data shown in Fig. 13 and Fig.  14 are obtained from the stepper motors. Fig. 14 presents the path of the robot when it is pushed off the equilibrium point. The robot was forced to move in a different direction and his objective was to maintain the starting position marked on the graph.
The controller proposed in this paper is sufficient to keep the robot in balance and it is much simpler than the controllers proposed in [9,13,14]. According to Fig. 13 and Fig. 14 the robot is also able to keep the stationary position when pushed and moves in any direction.  The work described in this paper was funded from 02/22/DSPB/1434.