Path planning method, device, storage medium and electronic device
By calculating the relative position and offset angle of the source point and destination point, drawing curve segments and setting display properties, the problem of path overlap and poor display effect in path planning is solved, and an aesthetic and clear path display is achieved.
Patent Information
- Application Number
- CN202111649733.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2041-12-29
AI Technical Summary
In the prior art, path planning by connecting straight lines is likely to result in path overlap, while path planning is performed by randomly connecting curves, so the path display effect is poor.
By obtaining the coordinates of the source point and the destination point, determining their relative position and calculating the offset angle, the first and second reference points are obtained, and the curve segment with the source point as the starting point and the destination point as the end point is drawn, and cubic spline interpolation is used Method to take points and connect, determine the path, and set display properties according to the road condition information.
It avoids path overlap, improves the aesthetics and clarity of path display, ensuring intuitive display of paths, especially when the data volume is large, it does not affect the visual effect.
Smart Images

Figure CN114296729B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of path planning, and in particular to a path planning method, device, storage medium and electronic device. Background Art
[0002] In the field of Web UI (Website User Interface) technology, people's requirements for data visualization are becoming more and more diverse. Among them, the path display of flat maps is a data visualization application.
[0003] In the path display of a flat map, the data relationship describing the movement and transmission between two geographical locations on the flat map, that is, the path, needs to be displayed in the form of a line. Specifically, the path between two points on a flat map can be described by connecting straight lines, but if it is simply connected into a straight line, the paths will overlap when the two points are in the same position but have different departure and arrival directions. In order to avoid overlapping paths, curves can also be drawn according to different directions. However, since there can be countless curves between two points, randomly drawn curves will result in an unsightly display effect due to different bending angles.
[0004] That is, when there are too many lines between two geographical locations, resulting in a huge amount of data, path planning by connecting straight lines will result in a large number of path overlaps, and path planning by randomly connecting curves cannot meet the requirement of clear display.
[0005] Currently, no effective solution has been proposed to address the problem that path planning by connecting straight lines in related technologies easily leads to path overlap, while path planning by randomly connecting curves leads to poor path display effect. Summary of the invention
[0006] The present application provides a path planning method, device, storage medium and electronic device to solve the problem in the related art that path planning by connecting straight lines easily causes path overlap, while path planning by randomly connecting curves results in poor path display effect.
[0007] According to one aspect of the present application, a path planning method is provided. The method includes: obtaining the coordinates of a source point and a destination point, and determining the relative position between the source point and the destination point according to the coordinates of the source point and the destination point; determining the offset angle corresponding to the source point to the destination point based on the relative position to obtain a first offset angle, and determining the offset angle corresponding to the destination point to the source point based on the relative position to obtain a second offset angle; offsetting the source point according to the first offset angle and a preset distance to obtain a first reference point, and offsetting the destination point according to the second offset angle and a preset distance to obtain a second reference point, wherein the preset distance is less than the distance between the source point and the destination point; determining a curve segment starting from the source point, ending at the destination point, and passing through the first reference point and the second reference point in sequence, and determining the path between the source point and the destination point according to the curve segment.
[0008] Optionally, determining the offset angle corresponding to the source point to the destination point based on the relative position to obtain the first offset angle includes: calculating the angle between the source point and the destination point to obtain the first angle; comparing the ordinate value of the source point with the ordinate value of the destination point, and determining the first offset direction based on the comparison result; offsetting the first angle in the first offset direction by a preset angle to obtain the first offset angle; determining the offset angle corresponding to the destination point to the source point based on the relative position to obtain the second offset angle includes: calculating the angle between the destination point and the source point to obtain the second angle; comparing the ordinate value of the destination point with the ordinate value of the source point, and determining the second offset direction based on the comparison result; offsetting the second angle in the second offset direction by a preset angle to obtain the second offset angle.
[0009] Optionally, determining a curve segment with a source point as the starting point, a destination point as the end point, and passing through a first reference point and a second reference point in sequence includes: using a cubic spline interpolation method to sequentially select points between the source point, the first reference point, the second reference point and the destination point to obtain multiple points; and sequentially connecting the multiple points to obtain a curve segment.
[0010] Optionally, determining the path between the source point and the destination point based on the curve segment includes: obtaining road condition information from the source point to the destination point; determining display attributes of the curve segment based on the road condition information, and displaying the curve segment based on the display attributes to obtain the path, wherein the display attributes include at least one of the following: color, line width, and transparency.
[0011] Optionally, determining the path between the source point and the destination point based on the curve segment includes: starting from the source point, displaying the points on the curve segment in sequence at preset intervals, and after displaying the destination point, canceling the display of the points on the curve segment, returning to the source point, and displaying the points on the curve segment in sequence at preset intervals.
[0012] Optionally, starting from the source point, displaying the points on the curve segment in sequence at preset intervals includes: starting from the source point, traversing multiple points in sequence at preset intervals, displaying a graphic centered on the coordinates of the current point, and canceling the display of the graphic corresponding to the previous point when displaying the graphic corresponding to the current point.
[0013] Optionally, before displaying the points on the curve segment in sequence according to preset intervals starting from the source point, the method also includes: acquiring road condition information between the source point and the destination point; determining display attributes of the points on the curve segment based on the road condition information, wherein the display attributes include at least one of the following: color, transparency, size of the graphic corresponding to the point, size of the preset interval, and display time interval between two adjacent points.
[0014] According to another aspect of the present application, a path planning device is provided. The device includes: a first acquisition unit, used to acquire the coordinates of a source point and a destination point, and determine the relative position between the source point and the destination point according to the coordinates of the source point and the destination point; a first determination unit, used to determine the offset angle corresponding to the source point to the destination point based on the relative position to obtain a first offset angle, and determine the offset angle corresponding to the destination point to the source point based on the relative position to obtain a second offset angle; a second acquisition unit, used to acquire a first reference point and a second reference point, offset the source point according to the first offset angle and a preset distance to obtain a first reference point, and offset the destination point according to the second offset angle and a preset distance to obtain a second reference point, wherein the preset distance is less than the distance between the source point and the destination point; a second determination unit, used to determine a curve segment starting from the source point, ending at the destination point, and passing through the first reference point and the second reference point in sequence, and determine the path between the source point and the destination point according to the curve segment.
[0015] According to another aspect of an embodiment of the present invention, a non-volatile storage medium is provided. The non-volatile storage medium includes a stored program. When the program is executed, the device where the non-volatile storage medium is located is controlled to execute a path planning method.
[0016] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising a processor and a memory; the memory stores computer-readable instructions, and the processor is used to execute the computer-readable instructions, wherein a path planning method is executed when the computer-readable instructions are executed.
[0017] Through the present application, the following steps are adopted: obtaining the coordinates of the source point and the destination point, and determining the relative position between the source point and the destination point according to the coordinates of the source point and the destination point; determining the offset angle corresponding to the source point to the destination point based on the relative position to obtain the first offset angle, and determining the offset angle corresponding to the destination point to the source point based on the relative position to obtain the second offset angle; offsetting the source point according to the first offset angle and the preset distance to obtain the first reference point, and offsetting the destination point according to the second offset angle and the preset distance to obtain the second reference point, wherein the preset distance is less than the distance between the source point and the destination point; determining a curve segment with the source point as the starting point and the destination point as the end point, and passing through the first reference point and the second reference point in sequence, and determining the path between the source point and the destination point according to the curve segment, solving the problem that the path planning by connecting straight lines in the related art is easy to cause path overlap, and the path planning by randomly connecting curves is poor in path display effect. By determining the first and second reference points and the first and second offset angles to draw the path, the path overlap caused by the same position but different directions of the two points when drawing the path is achieved, and the display effect is beautiful enough. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] Figure 1 is a flow chart of a path planning method provided according to an embodiment of the present application;
[0020] Figure 2 It is a static path diagram between a source point and a destination point provided according to an embodiment of the present application;
[0021] Figure 3 is a flow chart of calculating the offset angle between a source point and a destination point provided according to an embodiment of the present application;
[0022] Figure 4 is a flow chart for determining a dynamic path between a source point and a destination point provided according to an embodiment of the present application;
[0023] Figure 5 It is a schematic diagram of a path planning device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0025] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] According to an embodiment of the present application, a path planning method is provided.
[0028] Figure 1 is a flow chart of a path planning method according to an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:
[0029] Step S102, obtaining the coordinates of the source point and the coordinates of the destination point, and determining the relative position between the source point and the destination point according to the coordinates of the source point and the coordinates of the destination point.
[0030] Specifically, the source point is the starting point of the path to be determined, and the destination point is the end point of the path to be determined. The relative distance and relative direction are determined according to the coordinates of the source point and the coordinates of the destination point to obtain the relative position between the source point and the destination point.
[0031] Step S104, determining the offset angle corresponding to the source point to the destination point based on the relative position to obtain a first offset angle, and determining the offset angle corresponding to the destination point to the source point based on the relative position to obtain a second offset angle.
[0032] Specifically, the method for determining the offset angle is to determine the relative positions of the two points based on the provided coordinates (Xstart, Ystart) and (Xend, Yend) of the source point and the destination point on the plane map, and then determine the offset direction based on the relative positions between the two points, and the offset angle is determined by the offset direction.
[0033] Step S106, offset the source point according to the first offset angle and the preset distance to obtain a first reference point, and offset the destination point according to the second offset angle and the preset distance to obtain a second reference point, wherein the preset distance is less than the distance between the source point and the destination point.
[0034] Specifically, the straight-line distance from the source point to the destination point is the original distance, the preset distance can be (1 / 3)*original distance, reference point 1 is selected at a position (1 / 3)*original distance from the starting point in the direction of the first offset angle, and reference point 2 is selected at a position (1 / 3)*original distance from the arrival point in the direction of the first offset angle, thereby obtaining four points: source point, reference point 1, reference point 2 and destination point.
[0035] Step S108, determining a curve segment starting from the source point and ending at the destination point, passing through the first reference point and the second reference point in sequence, and determining a path between the source point and the destination point based on the curve segment.
[0036] Specifically, Figure 2 It is a static path diagram between the source and destination points, such as Figure 2 As shown, all points on the curve segment can be displayed to obtain a static path between the source point and the destination point. In addition, the points on the curve segment can be displayed in sequence from the source point to the destination point to obtain a dynamic path between the source point and the destination point. When the positions of the two points are the same but the departure and arrival directions are different, the dynamic path can intuitively display the path direction.
[0037] There are many ways to determine a curve between multiple points. Optionally, in the path planning method provided in an embodiment of the present application, determining a curve segment with a source point as the starting point, a destination point as the end point, and passing through a first reference point and a second reference point in sequence includes: using cubic spline interpolation to sequentially select points between the source point, the first reference point, the second reference point and the destination point to obtain multiple points; and sequentially connecting the multiple points to obtain a curve segment.
[0038] Specifically, the cubic spline interpolation method is used to interpolate between four points so that all points between the source point and the destination point are on the same curve, and when the last point is determined, the coordinates of the destination point are used for correction to obtain a coordinate set of all points. Further, the points in the coordinate set are connected in sequence to obtain a curve segment. The path planning method provided in the embodiment of the present application obtains the coordinates of the source point and the destination point, and determines the relative position between the two points according to the coordinates of the two points; determines the first offset angle corresponding to the direction from the source point to the destination point and the second offset angle corresponding to the direction from the destination point to the source point based on the relative position; offsets the source point according to the first offset angle and the preset distance to obtain the first reference point, and offsets the destination point according to the second offset angle and the preset distance to obtain the second reference point; determines the curve segment that passes through the source point, the first and second reference points, and the destination point in sequence to obtain the path between the source point and the destination point. The problem that the path planning in the related art is performed by connecting straight lines and randomly connecting curves, which easily causes path overlap and poor path display effect. Thus, the path overlap caused by the same position but different directions of the two points when drawing the path is achieved, and the display effect is beautiful enough.
[0039] Optionally, in the path planning method provided in the embodiment of the present application, the offset angle corresponding to the source point to the destination point is determined based on the relative position, and obtaining the first offset angle includes: calculating the angle between the source point and the destination point to obtain the first angle; comparing the ordinate value of the source point with the ordinate value of the destination point, and determining the first offset direction according to the comparison result; shifting the first angle in the first offset direction by a preset angle to obtain the first offset angle. The offset angle corresponding to the destination point to the source point is determined based on the relative position, and obtaining the second offset angle includes: calculating the angle between the destination point and the source point to obtain the second angle; comparing the ordinate value of the destination point with the ordinate value of the source point, and determining the second offset direction according to the comparison result; shifting the second angle in the second offset direction by a preset angle to obtain the second offset angle.
[0040] Specifically, taking the determination of the first angle as an example, when determining the first angle, it can be determined according to the horizontal and vertical coordinate values of the source point and the destination point and the angle calculation formula. When determining the first offset direction, the vertical coordinate of the source point and the vertical coordinate of the destination point can be compared. If the vertical coordinate of the source point is less than or equal to the vertical coordinate of the destination point, the comparison result is 1, and the offset direction is the positive direction. If the vertical coordinate of the source point is greater than the vertical coordinate of the destination point, the comparison result is -1, and the offset direction is the negative direction. When determining the preset offset angle, in order to make the final display effect beautiful, a fixed value of 0.2rad can be taken. After obtaining the first angle, the first offset direction and the preset angle, the first offset angle can be obtained by offsetting the preset angle on the first angle toward the first offset direction.
[0041] Optionally, Figure 3It is a flowchart for calculating the offset angle between the source point and the destination point, such as Figure 3 As shown, the first offset angle is calculated with the source point as the starting point and the destination point as the arrival point.
[0042] First, determine the calculation formula for the first angle by checking whether the slope of the line between the two points exists. If so, use the formula a=arctan((Yend-Ystart) / (Xend-Xstart)) to calculate the current angle a, which is the first angle. If not, compare Ystart with the Yend of the arrival point. If Ystart is less than or equal to Yend, then the current angle a is recorded as 90 degrees, otherwise it is recorded as -90 degrees.
[0043] After calculating the existing angle, the coordinates of the starting point, the arrival point and the direction of the straight path are used to determine the size of the starting point Xstart and the arrival point Xend, so as to decide whether the existing angle is increased or decreased by 0.2rad. If Xstart is less than or equal to Xend, then 0.2rad is reduced based on the existing angle to obtain the first offset angle. Otherwise, 0.2rad is increased based on the existing angle to obtain the first offset angle.
[0044] It should be noted that the method for determining the second offset angle when the destination point is the starting point and the source point is the arrival point is the same as the calculation method in the above embodiment, which will not be described in detail in this embodiment.
[0045] After determining the curve segment, it is necessary to determine the display attributes of the curve segment so as to obtain the path between the source point and the destination point. In the path planning method provided in the embodiment of the present application, optionally, in the path planning method provided in the embodiment of the present application, determining the path between the source point and the destination point according to the curve segment includes: obtaining road condition information from the source point to the destination point; determining the display attributes of the curve segment according to the road condition information, and displaying the curve segment according to the display attributes to obtain the path, wherein the display attributes include at least one of the following: color, line width, and transparency.
[0046] For example, when going from point A to point B, it is necessary to know whether there is congestion on this section of the path. If this section of the path is congested, the color of the curve segment can be set to red, and the size of the line can be set to a thicker size, so as to indicate that there is traffic congestion on this section of the path. If this section of the path is not congested, the color of the curve segment can be set to green, and the size of the line can be set to a thinner size, so as to indicate that there is no congestion on the current section of the road. In addition, different display transparency can be used to show the degree of congestion.
[0047] Through the above embodiments, a static path is obtained, but the static path cannot reflect the direction of the path. In order to further display the direction of the path, a dynamic path can be determined. Optionally, in the path planning method provided in the embodiment of the present application, the drawing of the dynamic path includes: starting from the source point, displaying the points on the curve segment in sequence at preset intervals, and after displaying the destination point, canceling the display of the points on the curve segment, returning to the source point, and displaying the points on the curve segment in sequence at preset intervals.
[0048] Specifically, the display of the dynamic path is based on the points on the static path. After obtaining the point set consisting of all the points on the static path, a part of the points in the point set is selected to display the dynamic path. For example, starting from the source point, every other point in the point set corresponding to the static path can be used as a display point on the dynamic path, thereby obtaining a dynamic path containing direction information.
[0049] In order to more intuitively display the direction of the dynamic path, optionally, in the path planning method provided in the embodiment of the present application, starting from the source point, the points on the curve segment are displayed in sequence at preset intervals, including: starting from the source point, traversing multiple points in sequence according to the intervals of preset points, displaying a graphic centered on the coordinates of the current point, and canceling the display of the graphic corresponding to the previous point when displaying the graphic corresponding to the current point.
[0050] Specifically, a dynamic node sliding in a direction from a source point to a destination point may be drawn on the basis of a static path to form a dynamic path, thereby clearly showing the direction of the path.
[0051] Dynamic path drawing is based on the set of points in the static path. Starting from the source point, a dot of a different color is drawn with the coordinates of the points in the set as the center of the circle, and the previous dot is canceled. This continues downward to form a moving light spot, indicating the direction of movement.
[0052] Figure 4 is a flow chart for determining a dynamic path between a source point and a destination point according to an embodiment of the present application, such as Figure 4 As shown in the figure, the specific process is: starting from the first point, set step to 0, and draw the second point every other point (i.e. step+2), which can create a sense of tailing visually. When step is greater than or equal to the length of the coordinate set of all points, then set step=0 and redraw from the first point, where the length of the coordinate set is determined by the number of points in the set.
[0053] The dynamic path drawn by this embodiment can intuitively indicate the path direction. When the source point and the destination point are the same but in opposite directions, a symmetrical path with opposite bending angles can be drawn according to the opposite directions, and the path direction is indicated by dynamic nodes. Therefore, even if the amount of data is large, the visual effect will not be affected by too many paths.
[0054] Optionally, in the path planning method provided in an embodiment of the present application, before displaying the points on the curve segment in sequence according to a preset interval starting from a source point, the method also includes: obtaining road condition information between the source point and the destination point; determining display attributes of the points on the curve segment based on the road condition information, wherein the display attributes include at least one of the following: color, transparency, size of the graphic corresponding to the point, size of a preset interval, and display time interval between two adjacent points.
[0055] For example, when it is necessary to indicate the cargo transportation between A and B, on the same route, the transportation modes between A and B include electric vehicles, motorcycles, and cars. When displaying dynamic routes, they can be displayed in different shapes. For example, when an electric vehicle is used to transport from A to B, the graphic corresponding to the point can be set to a triangle, and the size of the graphic can be used to indicate the amount of cargo transported. When the amount of cargo transported is small, the color of the curve segment can be set to green, and the size of the preset interval can be used to indicate the departure interval between two electric vehicles. The display time interval between two adjacent points can be used to display the transportation speed of the electric vehicle.
[0056] In an optional embodiment, the path planning method of the present application can be applied to the scheduling of shared bicycles in the city. The coordinates of each scheduling point of the shared bicycle are obtained to determine the relative positions of each scheduling point; then the offset angle on the scheduling path is determined based on the relative positions of each scheduling point; each scheduling point is offset according to the offset angle to obtain a reference point; the corresponding curve segments are determined for each scheduling point and the reference point, and then the scheduling path of the shared bicycle is drawn by the curve segments. The different colors, line widths and transparencies on the scheduling path can display the number of existing vehicles at each location and the daily scheduling status of shared bicycles, thereby realizing visualization of scheduling management, which is conducive to formulating more reasonable and efficient scheduling plans.
[0057] In an optional embodiment, the path planning method of the present application can also be applied in the network security industry. For situations where the network security industry often encounters attack incidents, the situational awareness system of the attacked party needs to indicate on the map where the attack came from and where the attack area is. In addition, the situational awareness system also needs to mark all attack incidents on the map, and can clearly see which area of all areas has been attacked the most, has the highest threat level, and where the attacks came from, so that network security personnel can focus on handling attack incidents based on this information. Using this method for path display, when there are many attack incidents, static paths that do not overlap can clearly and accurately display the source and destination of all attack incidents, and dynamic path identification can clearly indicate the direction of the attack. In addition, by changing the color of the dots and lines and the prompt box to indicate additional attributes, the display effect can be icing on the cake.
[0058] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0059] The present application also provides a path planning device. It should be noted that the path planning device in the present application can be used to execute the path planning method provided in the present application. The path planning device provided in the present application is introduced below.
[0060] Figure 5 Schematic diagram of a path planning device according to an embodiment of the present application. Figure 5 As shown, the device includes: a first acquisition unit 10, a first determination unit 20, a second acquisition unit 30, and a second determination unit 40.
[0061] Specifically, the first acquisition unit 10 is used to acquire the coordinates of the source point and the coordinates of the destination point, and determine the relative position between the source point and the destination point according to the coordinates of the source point and the coordinates of the destination point.
[0062] The first determination unit 20 is used to determine the offset angle corresponding to the source point to the destination point based on the relative position to obtain a first offset angle, and to determine the offset angle corresponding to the destination point to the source point based on the relative position to obtain a second offset angle.
[0063] The second acquisition unit 30 is used to acquire the first reference point and the second reference point, offset the position of the source point according to the first offset angle and the preset distance to obtain the first reference point, and offset the position of the destination point according to the second offset angle and the preset distance to obtain the second reference point, wherein the preset distance is less than the distance between the source point and the destination point.
[0064] The second determining unit 40 is used to determine a curve segment starting from the source point and ending at the destination point, passing through the first reference point and the second reference point in sequence, and determine a path between the source point and the destination point according to the curve segment.
[0065] The path planning device provided by the embodiment of the present application obtains the coordinates of the source point and the coordinates of the destination point through the first acquisition unit 10, and determines the relative position between the source point and the destination point according to the coordinates of the source point and the coordinates of the destination point; the first determination unit 20 determines the offset angle corresponding to the source point to the destination point based on the relative position to obtain the first offset angle, and determines the offset angle corresponding to the destination point to the source point based on the relative position to obtain the second offset angle; the second acquisition unit 30 obtains the first reference point and the second reference point, offsets the position of the source point according to the first offset angle and the preset distance to obtain the first reference point, and offsets the position of the destination point according to the second offset angle and the preset distance to obtain the second reference point, wherein the preset distance is less than the distance between the source point and the destination point; the second determination unit 40 determines a curve segment starting from the source point, ending at the destination point, and passing through the first reference point and the second reference point in sequence, and determines the path between the source point and the destination point according to the curve segment, thereby solving the problem that path planning in the related art is performed by connecting straight lines and randomly connecting curves, which easily causes path overlap and poor path display effect. Thereby achieving the effect that when drawing a path, there will be no path overlap caused by two points having the same position but different directions, and the display effect is beautiful enough.
[0066] Optionally, in the path planning device provided in the embodiment of the present application, the first determination unit 20 includes a first determination module, which is used to determine the offset angle corresponding to the source point to the destination point based on the relative position, and obtain the first offset angle. The first determination module includes: a first calculation submodule, which is used to calculate the angle between the source point and the destination point to obtain the first angle; compare the ordinate value of the source point with the ordinate value of the destination point, and determine the first offset direction according to the comparison result; offset the first angle to the first offset direction by a preset angle to obtain the first offset angle;
[0067] In addition to determining the first offset angle, the first determination unit 20 also determines an offset angle corresponding to the destination point to the source point based on the relative position, and obtains the second offset angle, including: calculating the angle between the destination point and the source point to obtain the second angle; a first comparison submodule, used to compare the ordinate value of the destination point with the ordinate value of the source point, and determine the second offset direction according to the comparison result; the first offset submodule offsets the second angle by a preset angle to the second offset direction to obtain the second offset angle.
[0068] Optionally, in the path planning device provided in an embodiment of the present application, the second determination unit 40 includes: a sampling module, used to use cubic spline interpolation to sequentially select points between a source point, a first reference point, a second reference point and a destination point to obtain multiple points; a connection module, used to sequentially connect multiple points to obtain a curve segment.
[0069] Optionally, the second determination unit 40 also includes: a first acquisition module, used to obtain road condition information from the source point to the destination point; a second determination module, used to determine the display attributes of the curve segment according to the road condition information, and display the curve segment according to the display attributes to obtain the path, wherein the display attributes include at least one of the following: color, line width and transparency.
[0070] Optionally, the second determination unit 40 also includes: a first display module, which is used to display the points on the curve segment in sequence according to a preset interval starting from the source point, and after displaying the destination point, cancel the display of the points on the curve segment, return to the source point, and display the points on the curve segment in sequence according to the preset interval.
[0071] Optionally, the first display module includes: a first display submodule, which is used to start from the source point, traverse multiple points in sequence according to the intervals of preset points, display a graphic centered on the coordinates of the current point, and cancel the display of the graphic corresponding to the previous point when displaying the graphic corresponding to the current point.
[0072] Optionally, the first display module also includes: a first acquisition submodule, used to acquire road condition information between a source point and a destination point; a first determination submodule, used to determine display attributes of the points on the curve segment based on the road condition information, wherein the display attributes include at least one of the following: color, transparency, size of the graphics corresponding to the points, size of a preset interval, and display time interval between two adjacent points.
[0073] The above-mentioned path planning device includes a processor and a memory. The above-mentioned first acquisition unit 10, first determination unit 20, second acquisition unit 30, second determination unit 40, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0074] The processor includes a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and by adjusting the kernel parameters, the path drawing will not overlap due to two points being in the same position but in different directions, and the display effect is beautiful enough.
[0075] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0076] An embodiment of the present application further provides a non-volatile storage medium, the non-volatile storage medium including a stored program, wherein when the program is executed, the device where the non-volatile storage medium is located is controlled to execute a path planning method.
[0077] The embodiment of the present application also provides an electronic device, comprising a processor and a memory; the memory stores computer-readable instructions, and the processor is used to run the computer-readable instructions, wherein a path planning method is executed when the computer-readable instructions are run. The electronic device in this article can be a server, a PC, a PAD, a mobile phone, etc.
[0078] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0079] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0080] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0081] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0082] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0083] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0084] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0085] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0086] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A path planning method, characterized in that: include: Acquire the coordinates of a source point and the coordinates of a destination point, and determine the relative position between the source point and the destination point according to the coordinates of the source point and the coordinates of the destination point; Determine the offset angle corresponding to the source point to the destination point based on the relative position to obtain a first offset angle, and determine the offset angle in the direction from the destination point to the source point based on the relative position to obtain a second offset angle; The source point is shifted according to the first shift angle and the preset distance to obtain a first reference point, and the destination point is shifted according to the second shift angle and the preset distance to obtain a second reference point, wherein the preset distance is less than the distance between the source point and the destination point; Determine a curve segment starting from the source point, ending at the destination point, and sequentially passing through the first reference point and the second reference point, and determine a path between the source point and the destination point according to the curve segment; Among them, determining a curve segment with the source point as the starting point, the destination point as the end point, and passing through the first reference point and the second reference point in sequence includes: using cubic spline interpolation to sequentially select points between the source point, the first reference point, the second reference point and the destination point to obtain multiple points; and sequentially connecting the multiple points to obtain the curve segment.
2. The method according to claim 1, characterized in that: Determining the offset angle corresponding to the source point to the destination point based on the relative position, obtaining the first offset angle includes: calculating the angle between the source point and the destination point to obtain the first angle; comparing the ordinate value of the source point with the ordinate value of the destination point, and determining a first offset direction according to the comparison result; offsetting the first angle by a preset angle toward the first offset direction to obtain the first offset angle; Determining an offset angle from the destination point to the source point based on the relative position, obtaining a second offset angle includes: calculating an angle between the destination point and the source point to obtain a second angle; comparing a ordinate value of the destination point with a ordinate value of the source point, and determining a second offset direction based on the comparison result; and offsetting the preset angle at the second angle toward the second offset direction to obtain the second offset angle.
3. The method according to claim 1, characterized in that Determining the path between the source point and the destination point according to the curve segment includes: Obtaining road condition information from the source point to the destination point; The display attribute of the curve segment is determined according to the road condition information, and the curve segment is displayed according to the display attribute to obtain the path, wherein the display attribute includes at least one of the following: color, line width and transparency.
4. The method according to claim 1, characterized in that: Determining the path between the source point and the destination point according to the curve segment includes: Starting from the source point, the points on the curve segment are displayed in sequence according to the preset intervals, and after displaying the destination point, the display of the points on the curve segment is canceled, and the process returns to the source point and displays the points on the curve segment in sequence according to the preset intervals.
5. The method according to claim 4, characterized in that Starting from the source point, displaying points on the curve segment in sequence at preset intervals includes: Starting from the source point, the multiple points are traversed in sequence according to the intervals of the preset points, a graphic centered on the coordinates of the current point is displayed, and when the graphic corresponding to the current point is displayed, the graphic corresponding to the previous point is canceled.
6. The method according to claim 4, characterized in that Before displaying the points on the curve segment in sequence at preset intervals starting from the source point, the method further includes: Acquire the road condition information between the source point and the destination point; The display attributes of the points on the curve segment are determined according to the road condition information, wherein the display attributes include at least one of the following: color, transparency, size of a graphic corresponding to the point, size of the preset interval, and display time interval between two adjacent points.
7. A path planning device, characterized in that: include: The first acquisition unit is used to acquire the coordinates of the source point and the coordinates of the destination point, and determine the relative position between the source point and the destination point according to the coordinates of the source point and the coordinates of the destination point The first determining unit is used to determine the offset angle corresponding to the source point to the destination point based on the relative position to obtain the first offset angle, and to determine the offset angle corresponding to the destination point to the source point based on the relative position to obtain the second offset angle A second acquisition unit is used to acquire a first reference point and a second reference point, perform a position shift on a source point according to a first shift angle and a preset distance to obtain a first reference point, and perform a position shift on a destination point according to a second shift angle and a preset distance to obtain a second reference point, wherein the preset distance is less than a distance between the source point and the destination point; A second determining unit is used to determine a curve segment starting from the source point and ending at the destination point, passing through the first reference point and the second reference point in sequence, and determine a path between the source point and the destination point according to the curve segment; Among them, the second determination unit includes: a sampling module, which is used to use cubic spline interpolation method to sequentially select points between the source point, the first reference point, the second reference point and the destination point to obtain multiple points; a connection module, which is used to sequentially connect the multiple points to obtain the curve segment.
8. The device according to claim 7, characterized in that The first determining unit includes: The first determination module is used to determine the offset angle corresponding to the source point to the destination point based on the relative position, and obtain the first offset angle; the first determination module includes: a first calculation submodule, used to calculate the angle between the source point and the destination point, and obtain the first angle; a first comparison submodule, used to compare the ordinate value of the source point and the ordinate value of the destination point, and determine the first offset direction according to the comparison result; the first offset submodule, used to offset the first angle to the first offset direction by a preset angle, and obtain the first offset angle; The second determination module is used to determine the offset angle corresponding to the destination point to the source point based on the relative position, and obtain the second offset angle; the second determination module includes: a second calculation submodule, used to calculate the angle between the destination point and the source point, and obtain the second angle; a second comparison submodule, used to compare the ordinate value of the destination point with the ordinate value of the source point, and determine the second offset direction according to the comparison result; a second offset submodule, used to offset a preset angle on the second angle to the second offset direction, and obtain the second offset angle.
9. The device according to claim 7, characterized in that The second determining unit includes: The first acquisition module is used to obtain the road condition information from the source point to the destination point; the third determination module is used to determine the display attributes of the curve segment according to the road condition information, and display the curve segment according to the display attributes to obtain the path, wherein the display attributes include at least one of the following: color, line width and transparency.
10. The device according to claim 7, characterized in that The second determining unit further includes: The first display module is used to display the points on the curve segment in sequence according to the preset interval starting from the source point, and after displaying the destination point, cancel the display of the points on the curve segment, return to the source point, and display the points on the curve segment in sequence according to the preset interval.
11. The device according to claim 10, characterized in that The first display module comprises: The first display submodule is used to start from the source point, traverse multiple points in sequence according to the intervals of preset points, display a graphic centered on the coordinates of the current point, and cancel the display of the graphic corresponding to the previous point when displaying the graphic corresponding to the current point.
12. The device according to claim 10, characterized in that The first display module also includes: The first acquisition submodule is used to obtain the road condition information between the source point and the destination point; the first determination submodule is used to determine the display attributes of the points on the curve segment according to the road condition information, wherein the display attributes include at least one of the following: color, transparency, size of the graphic corresponding to the point, size of the preset interval, and display time interval between two adjacent points.
13. A non-volatile storage medium, characterized in that: The non-volatile storage medium is used to store a program, wherein: When the program is running, the device where the non-volatile storage medium is located is controlled to execute the path planning method described in any one of claims 1 to 6.
14. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores computer-readable instructions, and the processor is used to execute the computer-readable instructions, wherein the computer-readable instructions, when executed, execute the path planning method described in any one of claims 1 to 6.
