Design of cricket control system based on visual inspection

Aiming at nonlinear characteristic of the cricket system, the control system is designed based on MCU k60 and PD fuzzy controller. System test shows that the characteristic of dynamic response is good and the system steady state error is small. The integral control scheme of system is accurate, effective and stable, the path control and fixed-point control of the ball is accurate.


Introduction
Cricket system is a multivariable and strongly coupled nonlinear system and is a two-dimensional extension of the cue system. It provides a simply-constructed model to verify different kinds of control algorithms and process is Intuition. The cricket system is essentially a typical open-loop unstable complex nonlinear system, so that the control system of it is a good example of complex nonlinear systems control in practical engineering. Therefore, it is very significant to design a reasonable and effective model to control the cricket system.

Hardware structure of cricket system
The hardware structure of the cricket system is shown in Figure 1. It is mainly composed of a camera, a ball and plate, a controller, connecting rod mechanism and a high-precision digital servo.  In system, rectangular plate is supported by a triangular structure with a universal wheel at the top, and the universal wheel is located at the geometric center of the plate. The ball is placed over the plate and the moving trace of the ball need to be controlled. To achieve control requirements, the plate's air posture must be adjustable. Therefore coordinate system with the origin placed at the center of the plate is established in which the X axis and the Y axis along the plate's length and width, Regulating mechanism of the plate is provided by two connecting rods with universal joints, the top of the rods (universal joints)supporting at X axis and Y axis and the end of the rods connected to high-precision digital servo, so that the angle of the plate can be controlled by adjusting the rotation angle of the digital servo which is controlled by MCU K60. The ball position detection is realized by visual inspection, and the tilt angle of the plate is realized by the angle sensor.

Control principle of a cricket system
The block diagram of the system's control principle is shown in the following figure: after define the require moving trace or expected position of the ball, MCU driven digital servo rotating to change the plate attitude, at the same time by receiving the flat attitude data and ball position information data, MCU correcting output data after control algorithm calculating these data so that adjust. (1)Visual inspection The image data is obtained by camera OpenMV which provides interface library, then the actual position coordinate of ball is calculated by data-processing through sharpening, filtering and edge detection algorithms in image processing algorithms, through the data interface, the real-time information of the ball position coordinates will be obtain, and then the control signal will be obtain through the control algorithm.
(2) Plate attitude detection According to the mechanical structure of the system, the plate is fixed on the Z axis and can rotate in space around the X axis and the Y axis. At this point, the ball has four degrees of freedom on the plate. For the space attitude of the plate, an angle sensor MPU6050 is used to detect the angle of rotation around the X axis and Y axis, then space attitude data of the plate is gained after data fusion calculating.
(3) Motion control The control part of the cricket system is a digital system. Micro-controller K60, with 32 bit Floating-point arithmetic, realizes the control model algorithm: according to the expected position of the ball, actual position, the current attitude of the plate and the control algorithm, the rotation angle of the high precision digital servo is calculated, and the attitude of the plate is controlled by controlling the rotation angle of the digital servo.
The hardware structure of the control system is shown in figure 3:

Control Model Design
For nonlinear cricket system, good dynamic response needs accurate control of the moving trace of the ball by adjusting the attitude of the plate, small steady-state error of the control system lead to the accuracy position that the ball stopped. The PID classical control method can not obtain the desired control performance, so fuzzy control is adopted. Furthermore, the PD fuzzy controller has good dynamic characteristics, for the steady state error, motor vibration is used when the ball is near equilibrium point to eliminate the static error caused by pure PD control.
The controller structure is shown in figure 4:   In figure 4, Δe is position error, r is rate of change position error, Δu is the output of the controller. According to controller structure and system hardware structure, the ball moves in two-dimensional space, the control strategy is same when the ball moving along the X direction and moving along the Y direction. So the ball's moving in one dimensional direction can be controlled first, then get experiment data and then using it to modify the algorithm structure and parameters, so another ball's moving dimensional direction can also be controlled.
Determination of input variables: Centered on the origin of the coordinate system, the distance between small ball coordinate and center point is one dimension. After the control rules are completed, the variable, the change rate of small ball position is another one-dimensional variable, input variables are: ext=xt-x0, eyt=yt-y0; ecxt=ext-ex (t-1), ecyt=eyt-ey (t-1). According to the hardware structure and characteristics of the system and experimental data, the basic universe of positional error and its rate of change are[300, 300], [-50, 50]. According to the input, taking 7 language variables to describe position, change rate of position and control quantity change: A1: (PB), A2(PM), A3(PS), A4(0), B1(NS), B2(NM), B3(NB).
According to the movement characteristics of the ball in the device, that is the position of the ball, change rate of the position and the experimental data, the control status table is obtained: query table is set up according to the rules, and the program is completed in keil5 environment and implemented by MCU K60 with ARM kernel.

System Verification
On the basis of the above work, the hardware andsoftware of the system were designed and tested: the expected position are origin of coordinate, coordinate position (100,100) and (-200,-100),the initial position of ball is random. The response performance of the system was shows in table 1. The test data show that the control system is stable, the movement of the ball was controlled and the system error is acceptable.

Conclusions
The system test shows that the performance of dynamic response speed and steady-state error meet the control requirements, the moving trace of ball can be controlled, the average error of position is