The Real Time Remote Motion Control of Two Wheeled Mobile Balance Robot by Using Video Streaming

This study presents the motion control of a real time two wheeled balance robot capable of moving back and forward, turning right and left and video streaming via IP (Internet Protocol) camera on it. A C++ based visual user interface is created on PC (Personal Computer) in order to control of the designed Two Wheeled Mobile Balance Robot (TWMBR). By means of the interface, all controller parameters of the robot can be changed via wireless communication module on it. Moreover, the robot’s tilt angle with respect to time, linear displacement and controller output can be observed simultaneously. Within the robot control interface, the videos from IP camera is transferred into the operator screen via TCP/IP (Transmission Control Protocol/Internet Protocol) communication protocol. So, the robot can be controlled via arrow keys and visual interface on PC remotely by an operator. Acceleration and gyro sensors are fused by means of a real-time Kalman Filter so that robot can keep its balance in both moving and stable state in the designed system. Thus, an accurate tilt angle control is realized. Classic PID (Proportional-IntegralDerivative) algorithm is used as robot controller. In conclusion, via IP camera on the robot, the real-time motion control is performed and data diagrams about motion control are obtained.


INTRODUCTION
Many researchers worldwide have made lots of research about TWMBR which is capable of standing in upright position [1][2][3][4].One of the most important reasons why these researchers have paid much attention to this subject is that it is able to keep its balance on two wheels and it has a very good maneuverability on confined space and sharp corners.It has also a time variable and non-linear structure.Therefore, many researchers implement original algorithms on it easily and they have the chance of observing real-time efficiency of controller algorithms they developed.A well controller design should be made in order that the robot keeps itself in upright position.In literature, various controller designs have been implemented on balance robot.Because most of these designs are based on simulation.It's not exactly understood what kind of reaction the robot gives in a realtime system.In this study, robot controller algorithms in literature have been carefully analysed and a real-time controller has been designed for the robot.At the same time its motion control which is necessary for moving somewhere to somewhere and fulfilling its duties is achieved.The videos taken from wireless IP camera on the robot can be watched via a visual interface.Therefore, operator is able to make remote control of the robot easily.We have detailed information about the environment during its navigation thanks to two servo motors on the robot which tunes camera angle.The comprehensive information about the designed TWMBR is mentioned in next sections.

The Hardware of the Balance Robot
Because that the robot has a nonlinear structure a suitable mechanic structure should be built to be able to have a stable equilibrium point.Therefore TWMBR system, which has a very well mechanical structure, was designed as shown in Fig. 1.To achieve a proper center of gravity for the robot 3 layered cylinder shaped fibre-glass plates were used.At the bottom part of the designed robot there are 2 identical permanent magnetic DC (Direct Current) motors coupled to a gearbox with integrated encoder.Besides, STM32F103RBT6 development board, which has Cortex M3 based microprocessor and controls the whole robot system, was used.MEMS (Micro-Electro-Mechanical System) based MPU-6050 balance sensor on which there is acceleration and gyro sensors and an 11.1V and 1750mA lithium polymer battery supplying the camera are also at this bottom layer.On the mid-layer there is dual serial DC motor controller board and an adjusted voltage regulator.There are also a pan-tilt servo motor camera mechanism and a wireless camera which are able to work in harmony together.Fig. 2 shows the general block diagram of the robot's hardware substructure.

Visual Control Interface
A C++ based graphic user interface was designed in order to update the robot's controller parameters online and observe them real-time and for the remote control of the designed robot system.The control interface is given in Fig. 3.

Figure 3. Robot control interface
Control software of the robot was run real-time via this control interface.Robot parameter curves such as tilt angle change, displacement data of the right and left wheel and controller output during moving and stable state of the robot were also obtained via the interface.

Equations of Motion of the Robot
In this section, the equations of motion of TWMBR in Fig. 1 were derived.Considering these equations the system control and motion control were realised.Firstly, as shown in Fig. 4, some robot parameters were determined such as center of gravity, height, width and wheel diameter.

Figure 5. Diagram of forces and moments acting on the robot
The model parameters and variables of the robot are shown in Table 1.Assume that there is no slip between the wheels and the surface, the balancing forces and moments acting on right and left wheel are expressed as in equations 1 and 2, respectively.

Table 1. The robot parameters and variables
Moments regarding O point and balancing forces acting on pendulum on x axis direction are shown in equations 3 and 4.
Moments acting on chassis on z axis and balancing forces acting on the chassis along x axis are given in equations 5.
Balancing the moments acting on the chassis and pendulum with respect to z axis are given in equation 6.
At the end of some mathematical operations about equations 1, 2, 3, 4, 5, 6, TWMBR's equations of motion such as heading angle acceleration, acceleration along x axis and tilt angle acceleration are given in equations 7, 8, 9 respectively.The following equations show that the robot's motion control depends on which variables and parameters.Taking all these into consideration the robot's sensitive motion control algorithms were successfully achieved.
In the equations above; ߗ is positive for all ∅ ∈ ܴ.
Reference [5] gives detailed information about how TWMBR's equations of motion are derived.

The Controller Structure of the Robot
The classic PID controller algorithm was applied on the designed balance robot system.Eq. ( 15) describes PID controller of the robot: The control signal is thus a sum of three terms: the Pterm (it's the proportional to the error), the I-term (it's proportional to integral of the error), and the D-term (it's is proportional to derivative of the error).The controller parameters include proportional gain ‫ܭ‬ , integral gain ‫ܭ‬ and derivative gain ‫ܭ‬ ௗ .In Fig. 6, as the general block diagram of the robot shows, the reference angle value must be dynamic in order that the robot moves backward and forward, turning right and left.Where ‫ݕ‬ ො describes the measured process variable, ‫ݎ‬ is the reference variable, ‫ݑ‬ denotes the control signal and ݁ represent the control error ‫ݎ(‬ − ‫ݕ‬ ො).The reference variable is often called the set point.

Figure 6. The robot control block diagram
Approximate PID controller parameters of the robot were firstly defined by means of Ziegler Nichols method.Thus, the system made oscillation by using just proportional controller parameters and then, by choosing the half value of these parameters rough ‫ܭ‬ value of the system was obtained.After that, ‫ܭ‬ and ‫ܭ‬ ௗ gain values were added to the system via control interface respectively.Finally, the optimum controller parameter for the system was obtained.

Motion Control of the Robot
It's necessary that the data about the robot should be analysed properly for the correct remote control of it.Firstly, the data during stable balance of the robot and its behaviour need to be analysed carefully.As a result of practical experiments about the adopted balance robot, robot control algorithms were derived, which are necessary for the robot moving back and forward, turn right and left.Later, they were applied on the robot.Fig. 7 shows the side view of motion control of TWMBR on the coordinate system.

Figure 10. The robot's parameter variables graphics
According to the Fig. 10 (a) the robot tilt angle changes between −20 ° degree and +20 ° degree from the equilibrium point.The tilt angle at the state of stable balance of the robot changes between −5 ° degree and +5 ° degree.When the robot reference angle value changes in order to make the robot carry out desired actions, the robot tilt angle change increases or decreases.As a result of the increase and decrease, as Fig. 10 (

Figure 1 .
Figure 1.The designed TWMBROn the top layer there is a second 11.1 V and 1750mA lithium polymer battery providing energy for the robot.There are also a pan-tilt servo motor camera mechanism and a wireless camera which are able to work in harmony together.Fig.2shows the general block diagram of the robot's hardware substructure.

Figure 2 .
Figure 2. The general block diagram of the robot

Figure 4 .
Figure 4.The three dimensional view of the robot

‫ܨ‬
, ‫ܨ‬ ோ Interacting forces between the left and right wheels and the chassis ‫ܪ‬ , ‫ܪ‬ ோ Friction forces acting on the left and right wheels ܶ , ܶ ோ Torques provided by wheel actuators acting on the left and right wheels ݂ ௗ , ݂ ௗோ External forces acting on the left and right wheels ߠ , ߠ ோ Rotational angles of the left and right wheels ‫ݔ‬ , ‫ݔ‬ ோ Displacements of the left and right wheels along the ‫-ݔ‬axis ∅ Tilt angle of the pendulum ߖ Heading angle of the vehicle ‫ݔ‬ Displacement of the vehicle along the ‫-ݔ‬axis ‫ܯ‬ ௪ Mass of the wheel ‫ܬ‬ ௪ Moment of inertia of the wheel with respect to the ‫-ݕ‬axis ܴ Radius of the wheel ݉ Mass of the Pendulum ݃ Gravity acceleration ݈ Distance from the point ܱ to the center of gravity, ‫,ܩܱܥ‬ of the pendulum ‫ܦ‬ Distance between the left and right wheels along the ‫-ݕ‬axis ‫ܯ‬ Mass of the chassis ‫ܬ‬ Moment of inertia of the chassis about the ‫-ݕ‬axis ‫ܬ‬ ௩ Moment of inertia of the chassis and pendulum about the ‫-ݖ‬axis ‫ܨ‬ Interacting force between the pendulum and the chassis on the ‫-ݔ‬axis ‫ܯ‬ Interacting moment between the pendulum and the chassis on the y-axis ‫ܬ‬ = ݈݉ ଶ Moment of inertia of pendulum with respect to the ‫-ݕ‬axis

Figure 7 .Figure 8 .
Figure7.Side-view of the robot motion coordinate system ‫ݖ‬ (1), ‫ݖ‬ (2), ‫ݖ‬ (3) and ‫ݖ‬ (4) denote the system's center of gravity values with respect to the motion of the balance robot system.At the same time, ‫ݖ‬ denotes the robot wheel's center of gravity value.The robot, as shown in Fig.4, has to lean forward +5 ° degree (i.e.185 °) from the equilibrium point and the both wheels have to rotate forward in order to move forward simultaneously.The robot has to lean backward −5 ° degree (i.e.175 °) from the equilibrium point and the both wheels have to rotate backward in order to move backward simultaneously.To be able to turn right or left, it has to lean forward +2 ° (i.e.182 °) degree and one of the wheels has to move forward towards the desired direction and the other wheel has to stay fixed.The motion of the robot was achieved via arrow keys and interface running in the PC (Personal Computer) environment remotely.Then the orientation data were derived at the state of moving and stable of the robot.The control algorithm flow diagram regarding the motion control of the robot is given in Fig.8.

Figure 9 .
Figure 9. Robot motion control graphicsThe average velocity of the robot with respect to time are circled and enumerated on the graphics in Fig.9.The tilt angle change and controller output are given in Fig.10, respectively.
b) shows, the control output signal of the robot changes, too.To measure the tilt angle properly, the data obtained from gyroscope and acceleration sensors were fused via Kalman filter.The motion control of the robot was performed real-time according to DC motor's rotation direction by changing robot's reference input values.The robot is also capable of video streaming via IP camera on it.The image was transferred real-time within the designed robot control interface via TCP/IP communication protocol.By means of pan/tilt servo motor module we are able to transfer image from every aspect.Thus, a TWMBR model which can be used in many fields was done by providing it with lots of functionalities.