Digital Morphological Filter and Smart Car Path Memory

introduction

This article refers to the address: http://

The “Freescale” Cup National College Student Smart Car Competition Rules clearly states that the smart car runs two laps on the track and records the best lap times, which makes the path memory algorithm possible. As shown in Figure 1, the track memory algorithm slowly passes a circle at the safest speed on the first lap and saves the track information. The second lap optimizes the speed and corner decisions based on the saved information. , thus achieving good results on the second lap. No matter how far the smart car's sensor looks ahead, it can only predict the situation of the track within a limited distance while running. The smart car with the track memory algorithm has a comprehensive understanding of the entire track on the second lap, so that under the same conditions, it will be more advantageous than the smart car that does not use the track memory.

11.jpg

Accurately remembering the track information on the first lap is the basis of the second lap control strategy and the key to the success of the game. However, in the first lap, no matter how good the control strategy is, the car will always deviate more or less from the track. The steering angle information of the steering gear will always have a certain degree of glitch and disturbance and other large errors, which are enough to cause the processor. Misjudgment. If it is applied directly to the second lap control without treatment, it will cause serious interference to the car, and it is impossible to finish the race at the limit speed or rush out of the track. There are two common methods of processing: one is to discard the interference value by threshold comparison, but at the same time the track information is also discarded together with the interference information; the other is to average the interference to multiple locations through low-pass filtering, but at the same time destroy the track. The original information, and the effect is not very obvious when the amplitude of the interference is large.

Mathematical Morphology is a new type of digital image processing method and theory. Its main content is to design a set of transformations (operations), concepts and algorithms to describe the basic features of the image. A very efficient nonlinear filtering technique is provided which depends only on the local shape characteristics of the signal. Therefore, it is more effective than traditional linear filtering in aspects such as shape analysis, pattern recognition, visual verification, and computer vision.

Comparison of algorithm selection and experimental results

Mathematical morphology operations are based on two basic operations, corrosion and expansion, leading to several other common mathematical morphology operations. There are only seven basic operations in mathematical morphology: corrosion, expansion, open operations, closed operations, hits, refinements, and coarsening, which are the basis of all morphology. They are defined as follows:

Let X denote a digital image. Let us assume that the image is binary, that is, if the value is only 1 or 0, then X represents a binary signal set, and B is a simple compact set called "structural element". The results of X being inflated and corroded by B can be defined as:

22.jpg

In the field of digital graphics processing, mathematical morphology is mainly used for nonlinear deformation, which can locally modify the geometric characteristics of the signal and provide information about the geometric characteristics of the signal. According to the morphological characteristics of different signals, different mathematical morphology operations can be used to process the signals. These mathematical forms and operations are regarded as mathematical shape filters. In this application method, each signal is treated as a set in the Euclidean space of the appropriate dimension. Mathematical morphological filters are defined as sets of operations that morph the signal to provide digital information about its geometry. Corrosion, expansion, open and closed operations are the simplest morphological operations for binary signals that are considered to be aggregates. These filters can also be extended to multidimensional signals. At this time, the morphological filter uses the definition of the mathematical shape operation of the gray value map. In the following, we will discuss how to apply the mathematical shape filter to the processing of the steering angle signal (one-dimensional digital signal), to achieve the method of removing impulse noise and reducing the disturbance, and programming and fast calculation on the single chip microcomputer.

Mathematical morphological filters are usually used in the processing of two-dimensional graphics. In order to generalize the mathematical morphology filter to the processing of one-dimensional signals, the basic operations of corrosion, expansion, open and closed operations are introduced in one dimension. Definition in signal processing:

Let H and K be the domains of h[n] and k[n] respectively, and the lengths are N and M, respectively, and generally N>M. Both H and K are integer sets.

h[n] refers to a digitized sequence containing the steering angle signal, and k[n] refers to a sequence of structural elements.

h is corroded by k:

33.jpg

A digital morphological filtering method is used, and a reasonable algorithm is also selected. Among them, how to select the length of the template sequence is the key. If the template sequence is too long, the useful signal will be filtered out as noise. If it is too short, the purpose of filtering out noise will not be achieved. In the case of a certain sampling rate, the length of the sequence is proportional to the time, which requires the length of the template to be less than the minimum turning time of the model car, which is greater than the maximum time of the servo disturbance. The first lap allows the model car to pass at a constant speed, which has two advantages:

1) The minimum turn time can be fixed to determine the length of the template. The non-uniform speed through the time-varying turning time is variable, and the template length is required to be variable, which results in complicated subsequent processing and low stability.

2) The order of the sampling sequence can be directly converted into displacement, which is convenient for subsequent control strategy processing. Compared with the displacement obtained by the product of non-uniform speed and time, the displacement obtained by direct conversion is more accurate (on the standard Korean track, the track length error obtained by direct conversion of the experimental model car is less than 5cm, and the speed and time product are obtained by the length of the track. The error is above 10cm).

The experimental system is on the track shown in Figure 2. The sampling rate of the track information of the smart car is 200 Hz, and the data of the first circle is run at a constant speed of 1.5 m/s as shown in Fig. 3. It can be seen that there are serious burrs and disturbances in the corner information of the steering gear in the curve, which cannot be directly used for the control strategy of the second circle. Figure 4 shows the result of using the third-order Butterworth filter in matlab. The suppression effect of interference is still not ideal, and the computational complexity is too large, so the microcontroller can not bear it. Figure 5 shows the data processed by morphological filtering. The track information is complete and accurate and can be applied to subsequent control strategies.

2.jpg

Figure 2 The track used in the experimental system

3.jpg

Figure 3 Track information recorded on the first lap

4.jpg

Figure 4 Data processed by the 3rd order Butterworth filter

5.jpg

Figure 5: Morphological filtered data

Fast Algorithm for Mathematical Morphology Filtering

Since the mathematical shape filter consists of only addition, subtraction and comparison operations, its operation is relatively simple. Therefore, it is suitable for application on a microcontroller with relatively weak computational functions and can achieve good results. In the past, most of the digital filters were difficult to implement due to the limitation of storage capacity, calculation speed and word length, and the morphological filter provided a new way for the single-chip microcomputer to apply digital filters instead of the previous analog filters.

According to the definition of corrosion, in order to calculate the corrosion value of f(n), it is necessary to know the data of the point w (w is the width of the structural element) before the point; and to calculate the result of the expansion of f(n), it is necessary to know the Point the data after the point w. Since the operation is a corrosion operation followed by an expansion operation, the result of the open operation can be obtained only from the wth point to the (L-w+1) point in the data of length L.

As shown in Figure 6, we define a sequence of templates whose length is the same as the width of the structural elements. The initial value of the template consists of the corrosion values ​​of the first w points. Taking the nth point as an example, the value of the template sequence is expanded in the forward direction along the point, and the result of the operation is the result of the opening operation of the point. At the same time, the etching operation is continued in the backward direction of the point to obtain the corrosion value at the (n+1)th point. The corrosion value of the (n+1) point is taken as the last point of the template sequence, and the front (w-1) point of the template sequence is sequentially moved forward by one position. The updated template value can be used to perform the expansion operation of the (n+1) point to obtain the open operation value at the (n+1) point. If you continue this way, you can complete all the open operations. Similar methods can be used to increase the speed of calculations.

6.jpg

Figure 6 Mathematical Morphology Filtering Fast Algorithm

Thus, when a piece of data of length N is processed by using M zeros as its structural elements, a comparison operation of 2 × M × N times is required when the calculation is performed by a general method. When using the fast algorithm, the minimum value can be obtained while comparing the maximum value, and the (N-M+1)×M comparison operations are reduced, so that the execution speed of the program is nearly doubled, and The algorithm can realize the real-time processing of the path memory information, which greatly facilitates the formulation of the second circle control strategy. Therefore, it makes the morphological filtering method more suitable for the processing of path information.

Experiment and conclusion

Through the experiments of different sensors (photocells and CCD) smart cars on different tracks, it is found that for the smart cars of the photocell scheme and the CCD scheme, the track memory algorithm can improve the speed of the second circle to some extent. After the smart car uses the morphological filtering algorithm to process the track memory data, not only the stability and accuracy of the driving have been greatly improved, but also the resource consumption of the MCU is not greatly increased, and the complicated control strategy can be supported at the same time. The above scheme has strong versatility and is suitable for smart cars with different sensor schemes and different control algorithms.

Led Sign

Led Sign,Led Display Sign Board,Customized Led Display,Customized Led Display

ShenZhen Megagem Tech Co.,Ltd , https://www.megleddisplay.com