Invention content
It is provided the invention aims to overcome the deficiencies in the prior art a kind of based on the mobile machine for improving A star strategies
People's paths planning method.
In order to achieve the above objectives, the technical solution adopted by the present invention is:A kind of mobile robot based on improvement A star strategies
Paths planning method, it includes the following steps:
(a) laser data and mileage that mobile robot obtains are subjected to processing with slam algorithms and obtain .pgm formats
Grating map, the grating map binaryzation is made by two-dimensional array;
(b) grating map of binaryzation is built into Voronoi diagram using dynamic dimension promise picture library;
(c) according to the node coordinate on the Voronoi diagram, the potential energy for obtaining corresponding node is calculated by formula (I), and
Build corresponding Voronoi costs map;
In formula, α is the fall off rate of potential energy,For the control range of potential energy;
(d) the beginning and end position of the mobile robot map reference is transformed into from its own coordinate system to fasten,
Inspection is played with whether the coordinated indexing of terminal is legal;The map coordinates system is the laser number that the mobile robot obtains
According to mileage coordinate system;
(e) initializing the g cost values of all nodes makes g (ni)=∞, wherein n be node, i=1 ...,
mapsize;Newly-built one is drawn up table, calculates total cost value f (s)=g (s)+α of the starting point1× h (s), wherein s are starting point,
α1For weight coefficient, then table will be drawn up described in starting point loading;When the g costs for drawing up table not and be the empty and described terminal
Value enters cycle when being infinite, until finding target point, then recalls whole path;
(f) smoother is used to carry out discrete whole path smooth.
Optimally, in step (a), traverse the pixel of the grating map, when its value be 0, then assignment 0;Otherwise
Value > 0, assignment 1.
Optimally, in step (c), control α andParameter value make potential energy value equably from barrier to Voronoi diagram
Side on it is continuously distributed.
Optimally, in step (d), also judge whether the grid of the beginning and end is occupied by barrier.
Optimally, enter cycle when the g cost values for drawing up table not and be the empty and described terminal are infinite, including following
Step:
(e1) it is present node to define node minimum in f cost values, labeled as being accessed, and by the node from institute
It states to draw up in table and delete;
(e2) it is chosen at adjacent node of the node on map and there is no barrier as the present node;
When the adjacent node g cost values be it is infinite, calculate the g cost values of the present node:When the adjacent segments
When point is located on straight line, g cost values are g (vi)=g (vi-1)+1×(1+w×p(vi));When the adjacent node is located at diagonal member
When on line, g cost values areWherein, viIndicate that i-th of node, w are the power of potential energy
Value coefficient, p (vi) indicate the point potential energy value;Calculate the total cost value f (v of the present nodei)=g (vi)+α1×h
(vi), h (vi) it is heuristic function cost value h (vi)=| x1-x2|+|y1-y2|, and table is drawn up in present node loading;
When the g cost values of the adjacent node are non-infinite, skip the adjacent node and do not visit again;
(e3) it repeats step (e1) and (e2) to continually look for, until finding terminal, recalls whole path.
Optimally, step (f) includes the following steps:
(f1) by whole path according to formulaIt is divided into k sections;WhereinTo round up,
Length is path length;Step is step-length and step=λ/resolution, λ are can to set step parameter, and resolution is
Map resolution ratio;
Coordinate points are then averaging as follows to every section of path:ave_xi=sum_xi/stepi、ave_yi=sum_
yi/stepi, wherein i ∈ [1, k) it is integer, sum_xi=sum_xi-1+xi, sum_yi=sum_yi-1+yi;It collects described average
Coordinate points are as sampled point;
(f2) use cubic spline interpolation algorithm to the sampled point into row interpolation.
Since above-mentioned technical proposal is used, the present invention has following advantages compared with prior art:The present invention is based on improve A
The method for planning path for mobile robot of star strategy, it is only necessary to which one is drawn up table, judges whether the node is accessed with g cost values
Come over substitution pass list, also only needs to calculate once to the g cost values of each node, memory and computing resource is greatly saved,
Accelerate convergence speed of the algorithm;Voronoi diagram has also been incorporated, has made path far from barrier, finally obtains one using smoother
Optimal path.
Specific implementation mode
The present invention is based on the method for planning path for mobile robot for improving A star strategies, as shown in Figure 1, it includes following step
Suddenly:
(a) laser data and mileage that mobile robot obtains are subjected to processing with slam algorithms and obtain .pgm formats
Grating map (each pixel be 0~255 gray value);The grating map binaryzation is stored in a two-dimensional array
In (as create Voronoi diagram input, specially traverse the pixel of entire map, if value=0, assignment 0 is no
Then 0 assignment 1 of value >);Fig. 2 is our company's floor maps that mobile robot obtains, and is obtained by slam algorithms;It generally comprises
.pgm with two files of .yaml;.pgm it is the gray level image for including 256 grades of gray values .yaml is corresponding configuration file (packet
The information such as filename, resolution ratio and origin containing image);Wherein, there are three types of gray value, white area 0, tables in map
Show robot wheeled region;Gray area is zone of ignorance, indicates that robot cannot enter;Black region is barrier, table
Show that robot cannot collide;
(b) (international conference on intelligent are specifically referred to using dynamic dimension promise picture library
robots and systems,2010:The grating map of binaryzation 281-286) is built into Voronoi diagram;Physical interface ten
Divide simply, calling initializeMap () and update (), principle is only updated to ring using a dynamic variable
The influential barrier in border has very high update efficiency.The expression barrier of black in Fig. 3, grey lines are that Tyson is polygon
The side of shape;The figure has following feature:1, discrete points data there are one being contained only in each Thiessen polygon;2, in Thiessen polygon
Point to corresponding discrete point distance it is nearest;3, distance phase of the point on Thiessen polygon side to the discrete point on its both sides
Deng.As seen from Figure 3, Voronoi maps can be in the intermediate path for generating a near linear on road.
(c) Voronoi maps provide any one position to the position of barrier near the point and range information;It can be with
According to the node coordinate on Voronoi diagram, the potential energy for obtaining corresponding node is calculated by formula (I), and build corresponding
Voronoi cost maps;
In formula, α is the fall off rate (α ∈ [0, ∞) of potential energy, and α values are smaller, potential energy decline it is faster),For potential energy
Control rangeAs α andWhen being arranged to suitable parameter, potential energy value will equably from barrier to
It is continuously distributed on Voronoi diagram side.Fig. 4 is the Voronoi cost maps created, as seen from the figure, the both sides (obstacle on road
Object) potential energy is maximum, toward road among potential energy slowly reduce, to the side of most intermediate Thiessen polygon on potential energy minimum be 0;That is traversal ground
Each node on figure, if the node on barrier, assignment 1;If on Thiessen polygon side, assignment 0;If two
Between person, the node is calculated to the distance of neighbouring barrier, substitutes into potential energy formula.Voronoi cost maps are made one
Table provides look-up table for subsequent searching algorithm.
The cost map has following feature:1, potential energy P ∈ [0,1] are continuously distributed on 0 to 1;2, when on map point (x,
Y) on barrier or when interior, potential energy is up to 1;3, when the point (x, y) on map is on Thiessen polygon side, potential energy minimum
It is 0.
(d) the beginning and end position of mobile robot is transformed into map reference from its own coordinate system to fasten, is checked
It plays and whether the coordinated indexing of terminal is legal (specially judges whether beginning and end is the same point, judge 0 < mx <
Mapwidth and 0 < my < mapheight judges whether beginning and end grid is occupied by barrier using look-up table);It is described
Map coordinates system is using the lower left corner of map as the rectangular coordinate system of coordinate origin;
(e) the g cost values for initializing all nodes are infinite, i.e. g (ni)=∞, wherein n be node, i=1 ...,
mapsize.Here it no longer needs to close list, only need to create one draws up table (i.e. OpenList), the total cost value f of zequin
(s)=g (s)+α1× h (s), wherein s are starting point, α1For weight coefficient.Then starting point is packed into OpenList;
Enter cycle when the g cost values that OpenList is not the empty and described terminal are infinite, until finding target point, so
After recall whole path, specially:
(e1) it is present node to define node minimum in f cost values, labeled as being accessed, and by the node from institute
It states to draw up in table and delete;
(e2) it is chosen at adjacent node of the node as the present node on map and not in barrier;
Adjacent node as shown in fig. 6, generally around eight nodes of present node, i.e., on, under, left, right, upper left is right
On, lower-left, bottom right.When the adjacent node g cost values be it is infinite, calculate the g cost values of the present node:When the phase
When neighbors is located on straight line, g cost values are g (vi)=g (vi-1)+1×(1+w×p(vi));When the adjacent node be located at pair
When on the oblique line of angle, g cost values areWherein, viIndicate that i-th of node, w are potential energy
Weight coefficient, p (vi) indicate the point potential energy value;Calculate the total cost value f (v of the present nodei)=g (vi)+α1×
h(vi), h (vi) it is heuristic function cost value h (vi)=| x1-x2|+|y1-y2|, and table is drawn up in present node loading;
(e3) it repeats step (e1) and (e2) to continually look for, until finding target point (i.e. terminal), then recalls whole road
(backtracking path is to determine next node according to the g cost values of each node to diameter;Target point is traversed to starting point, reversed searching
The consecutive points of node find out that node of g cost value minimums as next node every time, and iteration continues successively until rising
Point can find whole path).
(f) it uses smoother to carry out discrete whole path smooth, specifically includes following steps:
(f1) original route is sampled:Since original route is discrete, it is understood that there may be singular point, therefore directly to original route
Sampling may get singular point.It is segmented used here as to original route, it is sampled point then to take the average value of its every section coordinate, this
Sample is it is possible to prevente effectively from the above problem.Specially:By whole path according to formulaIt is divided into k sections;Wherein
To round up, length is path length;Step is step-length and step=λ/resolution, λ are can to set step parameter,
Resolution is map resolution ratio;Coordinate points are then averaging as follows to every section of path:ave_xi=sum_xi/
stepi、ave_yi=sum_yi/stepi, wherein i ∈ [1, k) it is integer, sum_xi=sum_xi-1+xi, sum_yi=sum_
yi-1+yi;The average coordinates point is collected as sampled point;
(f2) use cubic spline interpolation algorithm to the sampled point into row interpolation.
After having sampled point, so that it may with interpolation.Interpolation algorithm has very much, since high order interpolation does not restrain and unstable,
Low order interpolation slickness is inadequate, therefore used here as common cubic spline interpolation algorithm to sampling-point interpolation.It is defined on [a, b]
On just like lower node a=x0< x1< ... < xn-1< xn=b is divided into n sections, cubic spline equation is full for this n+1 sampled point
The following condition of foot:1, in every section of section [xi,xi+1], S (x)=Si(x);2, meet S (xi)=yi;3, the first derivative S ' of S (x)
(x) and second dervative S " (x) is continuous on [a, b].Polynomial equation on every section is Si(x)=ai+bi(x-xi)+ci(x-xi
)2+di(x-xi)3, wherein ai, bi, ci, diFor undetermined coefficient.As soon as section having 4 unknowm coefficients, n sections need 4n equation.Also
Two equations are provided by endpoint, usually by three kinds of methods:1, natural boundary;2, fixed boundary;3, not a node boundary.According to
Hermite interpolating functions,Whereinx∈[xi,xi+1], hi=xi+1-xi, i=0,1 ..., n-1;Side is added
Behind boundary, a tri-diagonal system can be obtained, all undetermined coefficients are calculated, every section of S (x) can be acquired and (utilize equation
The step-length for determining interpolation, generally is 0.05m), to path interpolation to obtain the path being made of smoothed curve, such as Fig. 5 institutes
Show, the centre on the whole roads Dou;Clearly as can be seen that although this paths is not shortest, but comparatively safe (road
Diameter about 38m, used time 0.065s or so).Entire method is simple, and it is convenient to realize, calculation amount is small, ensure that machine to a certain extent
The safety of device people's global path.Experiments have shown that no matter the size in channel, algorithm can cook up always one it is complete, continuously, put down
It is sliding, and ensure the executable global path among road.
The above embodiments merely illustrate the technical concept and features of the present invention, and its object is to allow person skilled in the art
Scholar cans understand the content of the present invention and implement it accordingly, and it is not intended to limit the scope of the present invention, all according to the present invention
Equivalent change or modification made by Spirit Essence, should be covered by the protection scope of the present invention.