Method and device for detecting path deviation of vehicle
By dynamically updating the distance between the vehicle and the path point through the cloud server, combined with the earth curvature correction algorithm and the maximum deviation distance threshold, the problem of insufficient GPS positioning accuracy is solved, and accurate detection and real-time control of vehicle path deviation are achieved.
Patent Information
- Application Number
- CN202510794560.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-09-12
AI Technical Summary
When existing technologies rely on GPS positioning systems to detect vehicle path deviation, they are limited by environmental factors and hardware equipment, resulting in low positioning accuracy. This makes it difficult to accurately determine whether the vehicle has deviated from its route, affecting real-time control and early warning effects.
The cloud server calculates the distance between the vehicle's current position and multiple pre-configured path points, dynamically updates the nearest path point as a benchmark, calculates the spherical distance using the earth curvature correction algorithm, and sets a maximum deviation distance threshold. An alarm is triggered only when the vehicle continues to deviate and exceeds the safety tolerance range.
It reduces the false alarm rate, provides real-time and reliable basis for deviation judgment, accurately captures violations, and effectively reduces the risk of illegal vehicle use.
Smart Images

Figure CN120628146A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of vehicle path planning, and in particular to a method and device for detecting vehicle deviation from a path. Background Art
[0002] With the development of the commercial vehicle sector, more and more vehicles are being leased instead of sold, or companies are assigning drivers to their vehicles. To this end, many companies hope to use technology to monitor vehicle trajectories in real time, ensuring that drivers adhere to designated routes. This can help reduce operating costs, prevent illegal use, and mitigate potential vehicle losses.
[0003] Currently, related technologies primarily rely on GPS positioning systems, using a vehicle's location information to determine whether its driving path deviates from its intended trajectory. Most methods employ a simple path comparison approach to determine whether a vehicle has strayed from its intended route. However, the accuracy of GPS signals is often affected by environmental factors and hardware limitations, resulting in low positioning accuracy. This can lead to discrepancies between the vehicle's actual driving trajectory and the calculated path in some complex environments, making it difficult to accurately determine whether the vehicle has strayed from its intended route, impacting real-time control and early warning capabilities. Summary of the Invention
[0004] The embodiments of the present invention provide a method and device for detecting vehicle deviation from a path, aiming to solve the problems existing in the above-mentioned background technology.
[0005] In order to solve the above-mentioned technical problems, the present invention is achieved as follows: In a first aspect, an embodiment of the present invention provides a method for detecting vehicle deviation from a path, which is applied to a cloud server and includes: Determining a target planned path pre-configured for a target vehicle, the target planned path including a plurality of path points; While the target vehicle is traveling, obtaining the current position of the target vehicle; Among the multiple path points, determining the path point closest to the current position of the target vehicle as the current target path point; In a case where the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance, it is determined that the target vehicle deviates from the target planned path.
[0006] Optionally, among the multiple path points, determining the path point closest to the current position of the target vehicle as the current target path point includes: Check whether the target path point determined previously exists; In the absence of a previously determined target pathpoint, sequentially calculating a distance between each of the plurality of pathpoints and the current position of the target vehicle; For any path point, if the distances between the previous path point and the next path point of the path point and the current position of the target vehicle are both greater than the distance between the path point and the current position of the target vehicle, the path point is determined as the current target path point.
[0007] Optionally, among the multiple path points, determining the path point closest to the current position of the target vehicle as the current target path point includes: Check whether the target path point determined previously exists; In the case where there is a target path point determined previously, among the n path points before and after the target path point, the path point closest to the current position of the target vehicle is updated as the current target path point, where n is an integer greater than or equal to 1.
[0008] Optionally, among the n path points adjacent to and before the target path point, updating the path point closest to the current position of the target vehicle as the current target path point includes: Obtain the latitude and longitude coordinates of the current position of the target vehicle, and the latitude and longitude coordinates of each of the n path points adjacent to and before the target path point; Converting the difference between the latitude and longitude coordinates of each of the n path points adjacent to the target path point and the latitude and longitude coordinates of the current position of the target vehicle into corresponding radians to obtain the radian difference between the n path points adjacent to the target path point and the current position of the target vehicle; Determining an intermediate variable based on the latitude and longitude coordinates of the current position of the target vehicle, the latitude and longitude coordinates of each of n path points adjacent to and before the target path point, and the arc difference between the n path points adjacent to and before the target path point and the current position of the target vehicle, wherein the intermediate variable represents the effect of the earth's curvature on the distance between the path point and the current position of the target vehicle; Obtaining the distances between n path points adjacent to and before the target path point and the current position of the target vehicle based on the intermediate variable and a preset earth radius constant; Among the n path points adjacent to and before the target path point, the path point with the smallest distance from the current position of the target vehicle is updated as the current target path point.
[0009] Optionally, the method further includes: Generate multiple candidate planned paths for the target vehicle based on the starting and ending points of each of the multiple tasks to be performed by the target vehicle through a cloud map, and associate an identifier of each candidate planned path with the VIN code of the target vehicle; Generating a path point set for each candidate planning path according to the multiple candidate planning paths, and configuring a maximum deviation distance for each candidate planning path; Each candidate planning path, the path point set of each candidate planning path, and the maximum deviation distance are stored in the database of the cloud server.
[0010] Optionally, determining a target planning path preconfigured for the target vehicle includes: Determining a VIN code of the target vehicle, and determining identifiers of a plurality of candidate planned paths associated with the target vehicle based on the VIN code of the target vehicle; Determining a current time, and determining a target task currently being performed by the target vehicle based on the current time; A target planning path corresponding to the target task is determined from the multiple candidate planning paths.
[0011] Optionally, after determining, among the multiple path points, the path point closest to the current position of the target vehicle as the current target path point, the method further includes: Calculating the difference between the sequence number of the current target path point and the sequence number of the previously determined target path point; When the difference between the sequence number of the current target path point and the sequence number of the previously determined target path point is less than a preset reverse traffic determination threshold, it is determined that the target vehicle deviates from the target planned path.
[0012] Optionally, the method further includes: Setting a deviation status flag for the binding relationship between the target vehicle and the target planned path, and updating the value of the deviation status flag to a first value when the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance; The method further comprises: A deviation status flag is set for the binding relationship between the target vehicle and the target planned path, and when the distance between the current target path point and the current position of the target vehicle does not exceed the maximum deviation distance, the value of the deviation status flag is updated to a second value.
[0013] Optionally, in a case where the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance, the method further comprises: checking whether the value of the deviation status flag jumps from the second value to the first value; When the value of the deviation status indicator changes from the second value to the first value, a corresponding alarm message is generated and sent to the terminal of the target vehicle, and a remote control instruction is generated according to a speed limit policy pre-configured for the target planned path, where the speed limit policy includes at least one of the following: Limiting the maximum speed of the vehicle to a first speed value; limiting the maximum speed of the vehicle to a second speed value lower than the first speed value; Send a vehicle lock command to prohibit the target vehicle from starting.
[0014] In a second aspect, an embodiment of the present invention provides a vehicle deviation detection device, which is applied to a cloud server and includes: A first determining module is configured to determine a target planned path pre-configured for a target vehicle, wherein the target planned path includes a plurality of path points; An acquisition module is used to acquire the current position of the target vehicle while the target vehicle is traveling; A second determining module is configured to determine, among the plurality of path points, a path point closest to the current position of the target vehicle as a current target path point; The third determination module is configured to determine that the target vehicle deviates from the target planned path when the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance.
[0015] Optionally, the second determining module includes: The second determination submodule is used to check whether there is a target path point determined previously; a third determining submodule, configured to sequentially calculate the distance between each of the plurality of path points and the current position of the target vehicle in the absence of a previously determined target path point; The fourth determination submodule is used to determine any path point as the current target path point when the distances between the previous path point and the next path point of the path point and the current position of the target vehicle are both greater than the distance between the path point and the current position of the target vehicle.
[0016] Optionally, the second determining module includes: A fifth determination submodule, configured to check whether a previously determined target path point exists; The sixth determination submodule is used to update the path point closest to the current position of the target vehicle as the current target path point among the n path points before and after the target path point when there is a target path point determined previously, where n is an integer greater than or equal to 1.
[0017] Optionally, the sixth determining submodule includes: A first determining unit is configured to obtain the latitude and longitude coordinates of the current position of the target vehicle, and the latitude and longitude coordinates of each of n path points adjacent to and before the target path point; a second determining unit, configured to convert the difference between the latitude and longitude coordinates of each of the n path points adjacent to the target path point and the latitude and longitude coordinates of the current position of the target vehicle into corresponding radians, thereby obtaining the radian difference between the n path points adjacent to the target path point and the current position of the target vehicle; a third determining unit, configured to determine an intermediate variable based on the latitude and longitude coordinates of the current position of the target vehicle, the latitude and longitude coordinates of each of n path points adjacent to the target path point, and the arc difference between the n path points adjacent to the target path point and the current position of the target vehicle, wherein the intermediate variable represents an effect of the earth's curvature on the distance between the path point and the current position of the target vehicle; a fourth determining unit, configured to obtain, based on the intermediate variable and a preset earth radius constant, a distance between n path points adjacent to and preceding the target path point and the current position of the target vehicle; The fifth determining unit is configured to update the path point having the smallest distance from the current position of the target vehicle among the n path points adjacent to and before the target path point as the current target path point.
[0018] Optionally, the device further comprises: an associating module, configured to generate, through a cloud map, a plurality of candidate planned paths for the target vehicle based on the respective starting and ending points of the plurality of tasks to be performed by the target vehicle, and to associate an identifier of each candidate planned path with the VIN code of the target vehicle; A generating module, configured to generate a path point set for each candidate planning path according to the plurality of candidate planning paths, and configure a maximum deviation distance for each candidate planning path; The storage module is used to store each candidate planning path, the path point set of each candidate planning path, and the maximum deviation distance in the database of the cloud server.
[0019] Optionally, the first determining module includes: a seventh determination submodule, configured to determine a VIN code of the target vehicle and, based on the VIN code of the target vehicle, determine identifiers of a plurality of candidate planned paths associated with the target vehicle; an eighth determining submodule, configured to determine a current time, and based on the current time, determine a target task currently being performed by the target vehicle; The ninth determining submodule is configured to determine a target planning path corresponding to the target task from the plurality of candidate planning paths.
[0020] Optionally, the device further comprises: a calculation module, configured to calculate a difference between the sequence number of the current target path point and the sequence number of the previously determined target path point; The fourth determination module is used to determine that the target vehicle deviates from the target planned path when the difference between the serial number of the current target path point and the serial number of the target path point determined last time is less than a preset reverse judgment threshold.
[0021] Optionally, the device further comprises: a first updating module, configured to set a deviation status flag for a binding relationship between the target vehicle and the target planned path, and update a value of the deviation status flag to a first value when a distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance; The device further comprises: The second updating module is used to set a deviation status identifier for the binding relationship between the target vehicle and the target planned path, and to update the value of the deviation status identifier to a second value when the distance between the current target path point and the current position of the target vehicle does not exceed the maximum deviation distance.
[0022] Optionally, the device further comprises: A checking module, configured to check whether the value of the deviation status indicator jumps from the second value to the first value; a generating module, configured to generate corresponding warning information and send it to a terminal of the target vehicle when the value of the deviation status indicator jumps from the second value to the first value, and generate a remote control instruction according to a speed limit policy pre-configured for the target planned path, wherein the speed limit policy includes at least one of the following: Limiting the maximum speed of the vehicle to a first speed value; limiting the maximum speed of the vehicle to a second speed value lower than the first speed value; Send a vehicle lock command to prohibit the target vehicle from starting.
[0023] The technical solutions provided by the embodiments of the present invention bring at least the following beneficial effects: The present invention calculates the distance between the vehicle's position and the path point, continuously updates the nearest path point as a reference during vehicle travel, and judges the deviation status based on the real-time distance between the point and the vehicle. This overcomes the sensitivity of static path comparison to positioning fluctuations. Even if the vehicle experiences a brief position jump due to signal interference, stability judgment can still be made based on the dynamically anchored nearest path point, reducing the false alarm rate. At the same time, by presetting the maximum deviation distance threshold, an alarm is triggered only when the vehicle continues to deviate and exceeds the safe fault tolerance range, avoiding frequent false alarms that interfere with operations while accurately capturing real violations. This provides enterprises with a real-time and reliable basis for deviation judgment, effectively reducing the risk of illegal vehicle use. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0025] Figure 1 1 is a schematic diagram of the steps of a method for detecting vehicle deviation from a path provided by one embodiment of the present invention; Figure 2 is a schematic diagram of pre-configuration of candidate planning paths in one embodiment of the present invention; Figure 3 is a schematic diagram of a vehicle deviation control architecture according to one embodiment of the present invention; Figure 4 is a schematic diagram of the current position of a vehicle and some trajectory points in one embodiment of the present invention; Figure 5 The present invention is a block diagram of a vehicle deviation detection device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. In the description of the embodiments of the present invention, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In the present invention, "at least one" refers to one or more, and "more than one" refers to two or more. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or multiple items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0027] Traditional GPS path monitoring solutions, due to insufficient signal accuracy and static full-path comparison, are prone to frequent misjudgments due to positioning drift in scenarios like commercial vehicle rentals. Furthermore, the massive computational effort makes real-time control difficult. This paper proposes a deviation detection method based on dynamic pathpoint anchoring. Its core features include: rapidly locking onto the nearest target pathpoint through progressive search, calculating the spherical distance between that point and the vehicle using an Earth curvature correction algorithm (such as the Haversine formula), and determining deviation only when the deviation exceeds a preset maximum distance. This method triggers speed limiting and vehicle lock commands, enabling real-time path deviation detection and vehicle control.
[0028] Figure 1 This is a schematic diagram of the steps of a method for detecting vehicle deviation from a path provided by an embodiment of the present invention. Figure 1 , the method is applied to a cloud server, comprising: Step S101 : determining a target planned path pre-configured for a target vehicle, wherein the target planned path includes a plurality of path points.
[0029] The cloud server first locates the specific driving path that the target vehicle should currently follow (i.e., the target planned path). The target planned path is composed of a series of continuous geographic coordinate points (path points) that represent the vehicle's authorized driving corridor. In this embodiment, each path point has a corresponding serial number and longitude and latitude coordinates. During specific implementation, because the target vehicle may be bound to multiple candidate paths, it is necessary to retrieve all its associated paths through the vehicle's unique identification (VIN code). The current time is automatically matched to the task the vehicle is currently performing (such as performing an A to B transport task at 10 am), thereby filtering out the currently effective target planned path from multiple candidate paths.
[0030] The path point set of the target planning path and parameters such as the preset maximum deviation distance are retrieved from the cloud database in real time, providing benchmark data for subsequent deviation judgment.
[0031] In an optional implementation, before step S101, the method further includes: In step S201, a plurality of candidate planned paths of the target vehicle are generated through a cloud map according to the starting points and end points of the plurality of tasks to be performed by the target vehicle, and an identifier of each candidate planned path is associated with the VIN code of the target vehicle.
[0032] Figure 2 FIG. 1 is a schematic diagram of pre-configuration of candidate planning paths in one embodiment of the present invention. Figure 2 As shown, the user enters multiple transportation task parameters to be performed by the target vehicle in the cloud map interface, including the starting point, end point and optional transit points of each task (for example, from "Warehouse A" to "Port C" requires passing through "Transfer Station B").
[0033] The integrated cloud-based mapping service is used to generate candidate planned routes for each task. Alternatively, standardized routes can be generated based on the navigation SDK's path planning algorithm, and users can also hand-draw custom routes directly on the map (for special road conditions).
[0034] After each candidate path is generated, an association is established with the VIN code of the target vehicle and persistently stored in the form of structured data, forming a "one vehicle, multiple paths" binding architecture.
[0035] A single vehicle can be bound to multiple routes (for multi-tasking), and a single route can be bound to multiple vehicles (for fleet collaborative tasks).
[0036] Step S202: generating a path point set for each candidate planned path according to the plurality of candidate planned paths, and configuring a maximum deviation distance for each candidate planned path.
[0037] The continuous trajectory of each candidate planning path is discretized into a sequence of longitude and latitude coordinates to obtain a set of path points for each candidate planning path.
[0038] Configure a maximum deviation distance for each path independently. This distance defines the maximum lateral tolerance a vehicle is allowed to deviate from the path. Departures below this distance are considered normal driving fluctuations, while those exceeding this distance trigger deviation warnings and control measures.
[0039] Step S203: storing each candidate planned path, the path point set of each candidate planned path, and the maximum deviation distance in the database of the cloud server.
[0040] The complete information of the candidate planning path (including path ID, path point set, and maximum deviation distance) is stored in the path configuration table of the cloud database, and the vehicle-path binding relationship (VIN code and path ID) is stored in the vehicle-path association table of the cloud database.
[0041] Among them, the path point collection is stored using the spatial data type to support fast spatial distance calculation; the vehicle path association table is synchronously written to the Redis cache to reduce the real-time query pressure of the database. When the binding relationship changes, the cache update can be triggered through the message queue.
[0042] In an optional implementation, step S101 specifically includes steps S1011 to S1013: Step S1011 , determining the VIN code of the target vehicle, and determining, based on the VIN code of the target vehicle, identifiers of multiple candidate planned paths associated with the target vehicle.
[0043] The cloud server obtains the target vehicle's unique device identifier (PDID) through real-time data reported by the vehicle (such as MQTT messages). The PDID serves as the original key for vehicle-to-vehicle communication and is converted into a globally unique VIN using a preset device-to-vehicle mapping table.
[0044] Based on the VIN code of the target vehicle, query the vehicle path association table to obtain the unique identifiers (path ID list) of all candidate planning paths bound to the vehicle.
[0045] Step S1012, determining the current time, and determining the target task currently being performed by the target vehicle based on the current time.
[0046] The cloud server accesses the task scheduling database, which stores all pending tasks of the target vehicle (such as task ID, starting point, end point, and planned execution time window).
[0047] Based on the current timestamp (e.g., UTC), the target vehicle's task list is traversed, selecting tasks whose time windows overlap the current time (e.g., Task A scheduled for 9:00-12:00, matches the current time of 10:30). If multiple tasks have overlapping time windows (e.g., Task A has not yet completed, while Task B has already begun), the target task is selected based on the pre-set priority or the latest task activation rule. Cancelled, completed, or unstarted tasks are excluded, ensuring that only tasks in the "Executing" state are activated.
[0048] Step S1013: Determine a target planning path corresponding to the target task from the multiple candidate planning paths.
[0049] As mentioned above, each candidate planning path is pre-associated with one or more task IDs. Based on the target task ID determined in step S1012, the path ID set bound to it is retrieved.
[0050] If the target task is associated with only a single path (e.g., task X is uniquely bound to path P), P is directly selected as the target planning path. If multiple paths are associated (e.g., task X is bound to paths P1 and P2), the path with the shortest total mileage is selected, or the path with the lowest congestion index based on real-time traffic data is selected.
[0051] Extract the complete parameters of the target planning path from the database, including the set of path points and the maximum deviation distance.
[0052] Step S102: Acquire the current position of the target vehicle while the target vehicle is traveling.
[0053] Figure 3 This is a schematic diagram of a vehicle deviation control architecture according to an embodiment of the present invention. Figure 3 During the target vehicle's driving process, the GPS device continuously monitors and records the target vehicle's real-time location information, including longitude, latitude, and other related motion status (such as speed and direction). The location information is uploaded to the cloud server via the wireless communication network. After receiving the location information reported by the target vehicle, the cloud server will parse and process it and associate the target vehicle's current location information with its VIN code. To ensure the accuracy and real-time nature of the location data, the vehicle's location information is updated regularly or continuously, and the data quality is monitored to filter out invalid data with poor signals. Finally, the cloud server stores the target vehicle's real-time location information and formats it into standard longitude and latitude coordinates, providing an accurate basis for subsequent path deviation judgments.
[0054] Step S103 : determining, among the multiple path points, the path point closest to the current position of the target vehicle as the current target path point.
[0055] The target path point refers to the closest path point corresponding to any vehicle position. The target path point serves as a relative reference point for the target vehicle and is updated in real time as the target vehicle moves along the target planned path.
[0056] In an optional implementation, step S103 specifically includes steps S1031 to S1033: Step S1031, check whether there is a target path point determined previously.
[0057] The cloud server searches the target vehicle's state cache (e.g., Redis) and searches by VIN code index to see if there is a previously calculated target pathpoint record for the target vehicle. This determines whether the current calculation for the target pathpoint is the first one. If a previously calculated target pathpoint record exists and the timestamp is within a reasonable window, the process proceeds to step S1033.
[0058] Step S1032: In the absence of the target path point determined previously, the distance between each of the plurality of path points and the current position of the target vehicle is calculated in sequence.
[0059] If there is no previously determined target pathpoint (i.e., the current calculation for the target pathpoint is the first), the distance between each pathpoint and the vehicle's current position is calculated, starting from the starting point of the target planned path. The distance values are recorded and compared in real time, and the current minimum distance is dynamically updated.
[0060] When the distances of N consecutive path points (e.g., N=3) are detected to be monotonically increasing, the subsequent calculations are terminated (since the path is continuous, the distances must continue to increase). For example, if the distances of point P1 = 10m, P2 = 15m, and P3 = 20m, the calculations of point P4 and subsequent points are terminated.
[0061] Step S1033: For any path point, if the distances between the previous path point and the next path point of the path point and the current position of the target vehicle are both greater than the distance between the path point and the current position of the target vehicle, the path point is determined as the current target path point.
[0062] For any path point P_i (path point with sequence number i), determine the distance D_i between the path point P_i and the current position of the target vehicle, as well as the distance between its predecessor point P_{i-1} and the current position of the vehicle, and record them as D_{prev} and D_{next} respectively.
[0063] When D_{prev}>D_i and D_{next}>D_i, the path point P_i is determined as the current target path point, that is, P_i is the local minimum point on the path curve (such as Figure 4 Point C in ), eliminating saddle point or suboptimal interference. Figure 4 This is a schematic diagram of the current position of the vehicle and some of the trajectory points in one embodiment of the present invention. Figure 4, when the current position of the target vehicle is point A, the distance between path point b and the current position of the target vehicle is greater than the distance between path point c and the current position of the target vehicle, and the distance between path point d and the current position of the target vehicle is greater than the distance between path point c and the current position of the target vehicle. Therefore, the current target path point is anchored as path point c.
[0064] If P_i is the path endpoint (starting point / end point), when P_i satisfies D_i less than the distance between adjacent unilateral points, it is directly confirmed as the target path point.
[0065] In an optional implementation, step S103 specifically includes steps S1034 to S1035: Step S1034, checking whether there is a target path point determined previously.
[0066] The implementation of step S1034 is the same as or similar to that of step S1031 and will not be repeated here.
[0067] Step S1035: If there is a target path point determined previously, the path point closest to the current position of the target vehicle among the n path points before and after the target path point is updated as the current target path point, where n is an integer greater than or equal to 1.
[0068] See Figure 4 If the target vehicle's current location is point A and a previously determined target pathpoint (A) exists, there's no need to traverse the entire pathpoint set. Instead, the search is performed by directly expanding n pathpoints forward and backward, centered around target pathpoint A. This expansion of n pathpoints is because the target vehicle may make a U-turn during normal driving, which may cause the current target pathpoint to be updated forward. Among the n pathpoints preceding and following the target pathpoint, the one closest to the target vehicle's current location is updated as the current target pathpoint.
[0069] In an optional implementation, step S1035 specifically includes steps S10351 to S10355: Step S10351, obtaining the longitude and latitude coordinates of the current position of the target vehicle, and the longitude and latitude coordinates of each of the n path points adjacent to and before the target path point.
[0070] Obtain the current latitude and longitude coordinates of the target vehicle, as well as the latitude and longitude coordinates of each of the n path points before and after the target vehicle.
[0071] Step S10352, convert the difference between the longitude and latitude coordinates of the n adjacent path points before and after the target path point and the longitude and latitude coordinates of the current position of the target vehicle into corresponding radians, and obtain the radian difference between the n adjacent path points before and after the target path point and the current position of the target vehicle.
[0072] For each neighboring path point P_j of the target path point, calculate the latitude difference between the target vehicle's current position, that is, the difference between the latitude of P_j and the target vehicle's current latitude (unit: degrees).
[0073] Similarly, for each neighboring path point P_j of the target path point, the longitude difference between the target vehicle's current position is calculated, that is, the difference between the longitude of P_j and the target vehicle's current longitude (unit: degrees).
[0074] Multiply the difference between P_j's longitude and the target vehicle's current longitude / latitude by π / 180 to convert it to radians. For example, a latitude difference of 1.5° is converted to 1.5 × π / 180 ≈ 0.02618 radians.
[0075] Step S10353, determines an intermediate variable based on the latitude and longitude coordinates of the current position of the target vehicle, the latitude and longitude coordinates of each of the n path points adjacent to the target path point, and the radian difference between the n path points adjacent to the target path point and the current position of the target vehicle. The intermediate variable represents the influence of the earth's curvature on the distance between the path point and the current position of the target vehicle.
[0076] For each neighboring path point P_j, the following parameters are calculated in sequence and synthesized into intermediate variables. Specifically, take half the radian difference of the latitude and calculate the square of its sine value; similarly, take half the radian difference of the longitude and calculate the square of its sine value; further, calculate the product of the target vehicle's latitude and the cosine value of the latitude of P_j.
[0077] The above three items are combined according to: (sine square of latitude) + (cosine product of latitude) × (sine square of longitude) to obtain the intermediate variable V_j.
[0078] The intermediate variable V_j represents the spherical angular distance, which is a mathematical abstraction of the relationship between the sides and angles of a spherical triangle. Its value range is [0,1]. The closer it is to 1, the greater the spherical distance between the two points.
[0079] The present invention quantifies the influence of the earth's curvature on the distance into a calculable parameter through an intermediate variable.
[0080] Step S10354: Obtain the distances between the n adjacent path points before and after the target path point and the current position of the target vehicle based on the intermediate variable and the preset earth radius constant.
[0081] Multiply the intermediate variable by the preset earth radius constant to obtain the actual spatial distance (unit: kilometers). The actual spatial distance is the distance between the adjacent path point P_j and the current position of the target vehicle.
[0082] Step S10355: among the n path points adjacent to and before the target path point, the path point with the smallest distance to the current position of the target vehicle is updated as the current target path point.
[0083] Step S104 , when the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance, determining that the target vehicle deviates from the target planned path.
[0084] After determining the current target path point, the distance between the current target path point and the vehicle's real-time position is compared with the maximum deviation distance preset for the target planning path.
[0085] If the calculated distance exceeds the maximum deviation distance, it is determined that the target vehicle has deviated from the target planned path.
[0086] The present invention calculates the distance between the vehicle's position and the path point, continuously updates the nearest path point as a reference during vehicle travel, and judges the deviation status based on the real-time distance between the point and the vehicle. This overcomes the sensitivity of static path comparison to positioning fluctuations. Even if the vehicle experiences a brief position jump due to signal interference, stability judgment can still be made based on the dynamically anchored nearest path point, reducing the false alarm rate. At the same time, by presetting the maximum deviation distance threshold, an alarm is triggered only when the vehicle continues to deviate and exceeds the safe fault tolerance range, avoiding frequent false alarms that interfere with operations while accurately capturing real violations. This provides enterprises with a real-time and reliable basis for deviation judgment, effectively reducing the risk of illegal vehicle use.
[0087] In an optional implementation, after step S103, the method further includes: Step S301, calculating the difference between the sequence number of the current target path point and the sequence number of the target path point determined last time.
[0088] Get the sequence number of the current target path point in the path point set, as well as the sequence number of the previous target path point.
[0089] Calculate the arithmetic difference between the two sequence numbers. A positive difference indicates that the target vehicle is moving in the forward direction along the path, a negative difference indicates that the target vehicle is moving in the reverse direction, and a difference of 0 indicates that the target vehicle has not moved.
[0090] Step S302, when the difference between the serial number of the current target path point and the serial number of the target path point determined last time is less than a preset reverse traffic determination threshold, it is determined that the target vehicle deviates from the target planned path.
[0091] If the sequence number difference is less than the preset reverse driving threshold, the vehicle is deemed to be traveling in the wrong direction and is determined to have deviated from the target planned path. The reverse driving threshold can be dynamically configured based on the path point density and vehicle speed.
[0092] In an optional embodiment, the method further includes: A deviation status flag is set for the binding relationship between the target vehicle and the target planned path, and when the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance, the value of the deviation status flag is updated to a first value.
[0093] The method further comprises: A deviation status flag is set for the binding relationship between the target vehicle and the target planned path, and when the distance between the current target path point and the current position of the target vehicle does not exceed the maximum deviation distance, the value of the deviation status flag is updated to a second value.
[0094] To manage the binding relationship between vehicles and route plans, a deviation status flag is set for each vehicle-route binding pair. The deviation status flag is stored as a Boolean value or enumeration. The first value (True / 1) indicates that the vehicle has deviated from the current route plan, triggering a control state. The second value (False / 0) indicates that the vehicle is in a compliant driving state and no intervention is required.
[0095] When it is detected that the real-time distance between the current position of the target vehicle and the target path point exceeds the preset maximum deviation distance (step S104 is established), the deviation state flag of the binding relationship is updated to the first value.
[0096] If the target vehicle's position meets the path requirements again (real-time distance ≤ maximum deviation distance), the flag is updated to the second value, indicating that the target vehicle has returned to a state of compliant driving.
[0097] The present invention records historical deviation results through status identification, ensuring that operations are triggered only when new deviation events or status jumps occur, avoiding repeated alarms.
[0098] In an optional embodiment, when the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance, the method further includes: Step S401: Check whether the value of the deviation status indicator jumps from the second value to the first value.
[0099] Check the historical value and current value of the deviation state flag. When the deviation state flag jumps from the second value (compliant) to the first value (deviation), it indicates that the target vehicle deviates from the compliant state for the first time and enters the deviation state.
[0100] If the deviation status flag is already the first value (eg, continuously deviating), the alarm is skipped to avoid repeated notifications.
[0101] Step S402: When the value of the deviation status indicator changes from the second value to the first value, a corresponding alarm message is generated and sent to the terminal of the target vehicle, and a remote control instruction is generated according to the speed limit policy pre-configured for the target planned path, where the speed limit policy includes at least one of the following: Limiting the maximum speed of the vehicle to a first speed value; limiting the maximum speed of the vehicle to a second speed value lower than the first speed value; Send a vehicle lock command to prohibit the target vehicle from starting.
[0102] Generate a structured alert message and push it to the enterprise monitoring platform and driver terminals via the message queue. For example, a structured alert message might read: Vehicle A deviated from route D at C km on Highway B, triggering speed limit control.
[0103] According to the speed limit policy bound to the route planning (pre-configured on the cloud server), remote control instructions are generated. The execution logic of the instructions corresponding to the speed limit policy is as follows: the first level speed limit limits the vehicle's maximum speed to a first speed value (such as 60km / h); the second level speed limit limits the vehicle's maximum speed to a second speed value (such as 30km / h); the vehicle lock command prohibits the vehicle from starting the engine or forces it to shut down.
[0104] See Figure 3 ,The cloud server encapsulates the remote control instructions corresponding to the speed limit strategy into standardized instructions (compatible with cockpit protocols of different brands) and sends them to the vehicle terminal through the MQTT channel.
[0105] After the cockpit of the target vehicle receives the command, it writes into the ECU control module through the CAN bus to enforce the speed limit / vehicle lock operation.
[0106] The vehicle terminal returns the command execution result to the cloud server and updates the command status log.
[0107] When the target vehicle returns to a compliant state (the deviation state flag jumps to the second value), a speed limit release instruction is generated and issued to restore the vehicle's original power performance.
[0108] Figure 5 This is a structural block diagram of a vehicle deviation detection device provided by an embodiment of the present invention, see Figure 5 , the device is applied to a cloud server, comprising: A first determining module 501 is configured to determine a target planned path pre-configured for a target vehicle, wherein the target planned path includes a plurality of path points; An acquisition module 502 is used to acquire the current position of the target vehicle while the target vehicle is traveling; A second determining module 503 is configured to determine, among the multiple path points, a path point closest to the current position of the target vehicle as a current target path point; The third determining module 504 is configured to determine that the target vehicle deviates from the target planned path when the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance.
[0109] In an optional implementation, the second determining module includes: The second determination submodule is used to check whether there is a target path point determined previously; a third determining submodule, configured to sequentially calculate the distance between each of the plurality of path points and the current position of the target vehicle in the absence of a previously determined target path point; The fourth determination submodule is used to determine any path point as the current target path point when the distances between the previous path point and the next path point of the path point and the current position of the target vehicle are both greater than the distance between the path point and the current position of the target vehicle.
[0110] In an optional implementation, the second determining module includes: A fifth determination submodule, configured to check whether a previously determined target path point exists; The sixth determination submodule is used to update the path point closest to the current position of the target vehicle as the current target path point among the n path points before and after the target path point when there is a target path point determined previously, where n is an integer greater than or equal to 1.
[0111] In an optional implementation, the sixth determining submodule includes: A first determining unit is configured to obtain the latitude and longitude coordinates of the current position of the target vehicle, and the latitude and longitude coordinates of each of n path points adjacent to and before the target path point; a second determining unit, configured to convert the difference between the latitude and longitude coordinates of each of the n path points adjacent to the target path point and the latitude and longitude coordinates of the current position of the target vehicle into corresponding radians, thereby obtaining the radian difference between the n path points adjacent to the target path point and the current position of the target vehicle; a third determining unit, configured to determine an intermediate variable based on the latitude and longitude coordinates of the current position of the target vehicle, the latitude and longitude coordinates of each of n path points adjacent to the target path point, and the arc difference between the n path points adjacent to the target path point and the current position of the target vehicle, wherein the intermediate variable represents an effect of the earth's curvature on the distance between the path point and the current position of the target vehicle; a fourth determining unit, configured to obtain, based on the intermediate variable and a preset earth radius constant, a distance between n path points adjacent to and preceding the target path point and the current position of the target vehicle; The fifth determining unit is configured to update the path point having the smallest distance from the current position of the target vehicle among the n path points adjacent to and before the target path point as the current target path point.
[0112] In an optional embodiment, the device further includes: an associating module, configured to generate, through a cloud map, a plurality of candidate planned paths for the target vehicle based on the respective starting and ending points of the plurality of tasks to be performed by the target vehicle, and to associate an identifier of each candidate planned path with the VIN code of the target vehicle; A generating module, configured to generate a path point set for each candidate planning path according to the plurality of candidate planning paths, and configure a maximum deviation distance for each candidate planning path; The storage module is used to store each candidate planning path, the path point set of each candidate planning path, and the maximum deviation distance in the database of the cloud server.
[0113] In an optional implementation, the first determining module includes: a seventh determination submodule, configured to determine a VIN code of the target vehicle and, based on the VIN code of the target vehicle, determine identifiers of a plurality of candidate planned paths associated with the target vehicle; an eighth determining submodule, configured to determine a current time, and based on the current time, determine a target task currently being performed by the target vehicle; The ninth determining submodule is configured to determine a target planning path corresponding to the target task from the plurality of candidate planning paths.
[0114] In an optional embodiment, the device further includes: a calculation module, configured to calculate a difference between the sequence number of the current target path point and the sequence number of the previously determined target path point; The fourth determination module is used to determine that the target vehicle deviates from the target planned path when the difference between the serial number of the current target path point and the serial number of the target path point determined last time is less than a preset reverse judgment threshold.
[0115] In an optional embodiment, the device further includes: a first updating module, configured to set a deviation status flag for a binding relationship between the target vehicle and the target planned path, and update a value of the deviation status flag to a first value when a distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance; The device further comprises: The second updating module is used to set a deviation status identifier for the binding relationship between the target vehicle and the target planned path, and to update the value of the deviation status identifier to a second value when the distance between the current target path point and the current position of the target vehicle does not exceed the maximum deviation distance.
[0116] In an optional embodiment, the device further includes: A checking module, configured to check whether the value of the deviation status indicator jumps from the second value to the first value; a generating module, configured to generate corresponding warning information and send it to a terminal of the target vehicle when the value of the deviation status indicator jumps from the second value to the first value, and generate a remote control instruction according to a speed limit policy pre-configured for the target planned path, wherein the speed limit policy includes at least one of the following: Limiting the maximum speed of the vehicle to a first speed value; limiting the maximum speed of the vehicle to a second speed value lower than the first speed value; Send a vehicle lock command to prohibit the target vehicle from starting.
[0117] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, apparatuses, electronic devices, and storage media. Accordingly, embodiments of the present invention may take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to magnetic disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0118] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods and apparatus according to the embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as the combination of processes and / or blocks in the flowcharts and / or block diagrams, 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 terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer readable memory that can guide a computer or other programmable data processing terminal device to work in a specific way, so that the instructions stored in the computer readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, so that a series of operation steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0119] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0120] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used solely to distinguish one entity or operation from another, and do not necessarily require or imply any actual relationship or order between these entities or operations. Furthermore, the term "comprising" or any other variant thereof is intended to encompass non-exclusive inclusion, such that a process, method, article, or terminal device comprising a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. Without further limitation, elements specified by the phrase "comprising..." do not preclude the presence of additional identical elements in the process, method, article, or terminal device comprising the elements. The above detailed description of a vehicle deviation detection method and apparatus provided by the present invention has been presented. Specific examples have been used herein to illustrate the principles and implementations of the present invention. The description of the above embodiments is intended only to facilitate understanding of the method and its core concept. Furthermore, those skilled in the art will appreciate that variations in the specific implementation and scope of application are possible based on the principles of the present invention. In summary, the contents of this specification should not be construed as limiting the present invention.
Claims
1. A method for detecting vehicle deviation from a path, characterized in that: Applied to cloud servers, including: Determining a target planned path pre-configured for a target vehicle, the target planned path including a plurality of path points; While the target vehicle is traveling, obtaining the current position of the target vehicle; Among the multiple path points, determining the path point closest to the current position of the target vehicle as the current target path point; In a case where the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance, it is determined that the target vehicle deviates from the target planned path.
2. The method according to claim 1, characterized in that Determining, among the multiple path points, a path point closest to the current position of the target vehicle as the current target path point includes: Check whether the target path point determined previously exists; In the absence of a previously determined target pathpoint, sequentially calculating a distance between each of the plurality of pathpoints and the current position of the target vehicle; For any path point, if the distances between the previous path point and the next path point of the path point and the current position of the target vehicle are both greater than the distance between the path point and the current position of the target vehicle, the path point is determined as the current target path point.
3. The method according to claim 1, characterized in that Determining, among the multiple path points, a path point closest to the current position of the target vehicle as the current target path point includes: Check whether the target path point determined previously exists; In the case where there is a target path point determined previously, among the n path points before and after the target path point, the path point closest to the current position of the target vehicle is updated as the current target path point, where n is an integer greater than or equal to 1.
4. The method according to claim 3, characterized in that Updating the path point closest to the current position of the target vehicle among the n path points before and after the target path point as the current target path point includes: Obtain the latitude and longitude coordinates of the current position of the target vehicle, and the latitude and longitude coordinates of each of the n path points adjacent to and before the target path point; Converting the difference between the latitude and longitude coordinates of each of the n path points adjacent to the target path point and the latitude and longitude coordinates of the current position of the target vehicle into corresponding radians to obtain the radian difference between the n path points adjacent to the target path point and the current position of the target vehicle; Determining an intermediate variable based on the latitude and longitude coordinates of the current position of the target vehicle, the latitude and longitude coordinates of each of n path points adjacent to and before the target path point, and the arc difference between the n path points adjacent to and before the target path point and the current position of the target vehicle, wherein the intermediate variable represents the effect of the earth's curvature on the distance between the path point and the current position of the target vehicle; Obtaining the distances between n path points adjacent to and before the target path point and the current position of the target vehicle based on the intermediate variable and a preset earth radius constant; Among the n path points adjacent to and before the target path point, the path point with the smallest distance from the current position of the target vehicle is updated as the current target path point.
5. The method according to claim 1, wherein The method further comprises: Generate multiple candidate planned paths for the target vehicle based on the starting and ending points of each of the multiple tasks to be performed by the target vehicle through a cloud map, and associate an identifier of each candidate planned path with the VIN code of the target vehicle; Generating a path point set for each candidate planning path according to the multiple candidate planning paths, and configuring a maximum deviation distance for each candidate planning path; Each candidate planning path, the path point set of each candidate planning path, and the maximum deviation distance are stored in the database of the cloud server.
6. The method according to claim 5, characterized in that Determining a target planning path pre-configured for the target vehicle, including: Determining a VIN code of the target vehicle, and determining identifiers of a plurality of candidate planned paths associated with the target vehicle based on the VIN code of the target vehicle; Determining a current time, and determining a target task currently being performed by the target vehicle based on the current time; A target planning path corresponding to the target task is determined from the multiple candidate planning paths.
7. The method according to claim 1, characterized in that After determining, among the multiple path points, the path point closest to the current position of the target vehicle as the current target path point, the method further includes: Calculating the difference between the sequence number of the current target path point and the sequence number of the previously determined target path point; When the difference between the sequence number of the current target path point and the sequence number of the previously determined target path point is less than a preset reverse traffic determination threshold, it is determined that the target vehicle deviates from the target planned path.
8. The method according to claim 1, characterized in that The method further comprises: Setting a deviation status flag for the binding relationship between the target vehicle and the target planned path, and updating the value of the deviation status flag to a first value when the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance; The method further comprises: A deviation status flag is set for the binding relationship between the target vehicle and the target planned path, and when the distance between the current target path point and the current position of the target vehicle does not exceed the maximum deviation distance, the value of the deviation status flag is updated to a second value.
9. The method according to claim 8, characterized in that In the event that the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance, the method further includes: checking whether the value of the deviation status flag jumps from the second value to the first value; When the value of the deviation status indicator changes from the second value to the first value, a corresponding alarm message is generated and sent to the terminal of the target vehicle, and a remote control instruction is generated according to a speed limit policy pre-configured for the target planned path, where the speed limit policy includes at least one of the following: Limiting the maximum speed of the vehicle to a first speed value; limiting the maximum speed of the vehicle to a second speed value lower than the first speed value; Send a vehicle lock command to prohibit the target vehicle from starting.
10. A device for detecting vehicle deviation from a path, characterized in that: Applied to cloud servers, including: A first determining module is configured to determine a target planned path pre-configured for a target vehicle, wherein the target planned path includes a plurality of path points; An acquisition module is used to acquire the current position of the target vehicle while the target vehicle is traveling; A second determining module is configured to determine, among the plurality of path points, a path point closest to the current position of the target vehicle as a current target path point; The third determination module is configured to determine that the target vehicle deviates from the target planned path when the distance between the current target path point and the current position of the target vehicle exceeds a maximum deviation distance.
Citation Information
Cited By
Vehicle final assembly offline quality inspection method, robot and system
CN122084632A