Application of the MyRIO Based Mobile Robot Using Vision System

The paper develops an auto mobile robotics that has the feature of image identification through a set of designed experiments. It is used in automatic industry and the application of AGV. The main controller of mobile robot is myRIO-1900 which is developed by America National Instruments. The inner controller is ARM Cortex-A9, it has two I/O ports, and it adopts MXP and MSP. This device includes and integrates analogy input, analogy output, digital I/O, LED, a button, accelerator, a set of Xilinx FPGA, processor, memory, hard disk, and image identification processing module. It uses Tetrix and Matrix components combining with RC motor to be an arm to solve Competition problem, and it also uses trapezoidal acceleration algorithm and PID algorithm to control more precisely. It applies NI LabVIEW Vision Assistant to do image identification processing to help mobile robot finish specified action.


Introduction
With the incoming of Artificial Intelligence Era, robot education is gradually being valued. The output value of robots in Taiwan has been increasing year by year, and it is an important industry promoted by government and companies. Whether home appliances, entertainment, automatic robots in factory or medical care supply of seniors, all have a promising future, but compared with Japan and South Korea's market, the R & D and commercialization are slow. Robot education still has great room for improvement in Taiwan. Robots have become next super-tech star after computers and Internet. All over the world are working hard to promote robot industry. Robot education has continued to take root to inspire students' interests in this field. In fact, robot education not only inspires children's interests in science and technology, but also cultivates talented people. For example, Lego cooperated with National Instruments (NI). With the promotion of Industry 4.0 and Productivity 4.0, the industry seeks to integrate intelligent automation in order to use in factory's production and transportation. Through artificial intelligence combines with robots, it can replace lots of human resources and provide more efficient production and transportation. Behind robot education, there are a lot of creative and logical thinking. For example, students used to learn univariate quadratic equations in school, but through robot education, it can let students learn the application of these formulas which is far more effective. Extending robot education and assisting Ministry of Education to promote the science and technology education curriculum is important. As a result, children can be cultivated in their childhood to face and think about future high-tech society.

The Structure of System
The autonomous mobile robotics (as shown in Figure 1) consists of three parts: positioning system, motion control system, and image recognition system. The autonomous mobile robot includes power system, human-machine interface monitoring system, computer vision system, motor control system, and sensor system. The main control core is myRIO-1900 (as shown in Figure 2), and Tetrix and Matrix are the core components. The program is written by Labview2018 software which is developed by National Instruments. The humanmachine interface monitoring, data transmission, image vision, and motor control are all performed by National Instruments LabVIEW2018. The main core of myRIO controller is NI Single-Board RIO which is developed by National Instruments (NI). It is suitable for teaching, competition, and robot development with Tetrix and Matrix Base set metal kits. The embedded system of NI Single-Board RIO takes LabVIEW as the core, it allows users to integrate motors, sensor controls and creative assembly of metal kits more easily. With the expansion board, LabVIEW software writing programs is easier than traditional one. In addition, the programming language is similar to C language. The only difference is that LabVIEW integrates programming language, interface design, algorithms, visual development, measurement tools, communication modes, etc. Its functionality is relatively powerful, but its basic structure of programming language is still based on C language. LabVIEW is easier for users to do integration development than other programming languages. LabVIEW (Laboratory Virtual Instrumentation Engineering Workbench) is a graphical program compilation platform which is developed by America National Instruments Corporation. LabVIEW was designed for automatic control of instruments in the early days, and now it has become a mature high-level programming language. LabVIEW consists of three parts: Block Diagram, Front Panel, and Icon/Connector as shown in Figures 3 and 4. LabVIEW not only edits and designs programming, but also designs the interface. It is much easier for people without a programming foundation to learn than other programming languages.

Motion Control
PID is a common algorithm in the industry. People usually use it in the factories to control heating and cooling systems, flow control and pressure control. However, in this paper, PID is used to control the movement of robots, and with trapezoidal acceleration and deceleration described in next section, it makes the position of robots' movement more accurate. The setting  ( 1 ) Ratio control motion is K c multiplies the deviation (e). K c means the gain of controller. When there is only ratio control, the system will have steady-state deviation. The formula is as follows: u p (t) = K c e ( 2 ) Ratio and integral control used to eliminate the steadystate deviation. In order to eliminate the steady-state deviation, the controller must input an integral term and accumulate the system deviation over time. T i indicates the integration time constant, and the following represents the integration action: ( 3 ) Ratio and differential control used to eliminate transient error. Adding differential terms can accelerate system response time, but adding too much will cause system instability. T d means differential time constant, and it is expressed as follows: ( 4 ) In the PID loop, the response value required by above three calculation methods for motor controller is shown as below: If the control motor does not consider precise motion control, generally only needs I/O to control forward and reverse. When more precise positioning control is required, motors will have a little deviation due to some small tolerances. For example, when two same specification motors were controlled, they run at different speed, and made the car turned to left or right. In this paper, when AGV is in the motion control, we use trapezoidal acceleration and deceleration to make it move more accurately. In addition, it will make the car avoid overshoot when braking. Using trapezoidal acceleration/deceleration to control is better than using simple acceleration/deceleration without trapezoidal. For instance, when driving speed is from 0 to 100, then see the red light and do emergency braking, or do slowly brake when see the red light. Trapezoidal acceleration and deceleration use similar principles to control.

Image Recognition
When you need a specific color, threshold adjustment is used to analyze, process and delete unnecessary color images. Figures 5 and 6 show histograms of each plane of color images that stored in HSL format. The threshold range of grayscale representation in shaded area is the color in each plane. The pixels in color image will be set to 1 in the binary image, and the color value is between 165 and 215, the saturation value is between 0 and 30, and the brightness value is between 25 and 210. Consequently, Hue, Saturation, and Luminance of colors can be defined more clearly, and it is different from general RGB. The method to identify images in this paper is dividing the graphics into 81 points (Figure 6), 1 is black square and 0 is white square. After images conversion, they will be saved in database in txt file (Figure 7). Convert 16 graphics into 16 txt files, then store them in the same folder and store into the memory of myRIO, wait for recognition images comparing with the database.
In this paper, the fancy ball recognition is directly inputting RGB values, then binarizing the eight colors. This can improve the speed of image processing and the accuracy of finding balls. The recognition results can be found in the human-machine interface (as shown in Figure 8).

Experimental Results
Using image recognition, the area of the ball and the current position of the ball in the image can be calculated. The coordinates in the image must be converted into the coordinates of the robot, so that the coordinates of the ball   can be handled well. Then find out the ball's radius through the image, you can know the seat of the ball on the court. After the experimental measurement, the sphere image radius is about 184 at 20cm. However, the principle of farthest distortion and recent distortion must be considered, otherwise the image will be misjudged. If it is wrongly judged, you can cross-compare the measured radius and the distance from the original setting to solve the problem of misjudgement. The sphere image will shrink because of the distance, and zoom in if the distance is close. Using the ratio conversion method, you can convert the distance from the camera to the physical sphere by a few centimeters.

Conclusions
This paper mainly uses myRIO controller to develop competition platform and teaching materials for domestic mobile robotics competition. The robot's movement and rotation motion control uses trapezoidal acceleration and deceleration and PID to control. MyRIO can define foot position, WIFI module and camera to let mobile robot complete the competition. The structure of mobile robot uses Tetrix Robotics and Matrix Base Set to install. About the motor, it uses a gear ratio of 64:1 DC servo motor with high torque characteristics which developed by K-Kingdom. Therefore, it can make mobile robot apply in AGV. After experiments, it has good consequence in moving objects and image recognition of Pool.

Appendix
Features of the armed car in this paper:  The control of movement uses trapezoidal acceleration and deceleration to make mobile robotics move more accurately.  It can find color balls and two-color balls accurately, and catch the target effectively.  The image recognition does not require complicated algorithms. Vision Acquisition of LabVIEW makes writing image programs much more efficient, and lets robot's integration easier.  It is effective to use single camera to estimate the distance between target object (sphere) and the vehicle.