Unmanned driving communication method, device, equipment and storage medium
By starting the message bus component and creating a communication node in the first process of the unmanned driving system, the message transmission interruption caused by the master node failure is solved, and the reliability and real-timeness of message transmission in the unmanned driving system is realized.
Patent Information
- Application Number
- CN202210023102.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-10
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2042-01-10
AI Technical Summary
In existing unmanned driving systems, failure of the master node will cause interruption of message transmission between functional modules, and under a large number of topics and messages, the master node processing delay is large and cannot meet the requirements of real-time message transmission.
In the first process of the unmanned driving system, the message bus component is started and the communication node is created. The communication mode of each communication node is determined through the predetermined communication configuration file, and the message transmission and subscription are realized, avoiding dependence on the master node. And improve the real-time nature of message transmission.
By starting the message bus component within the process and creating communication nodes, the message transmission interruption caused by master node failure is solved, and the reliability and real-timeness of message transmission in unmanned driving systems are improved.
Smart Images

Figure CN114546672B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of unmanned driving technology, and in particular to an unmanned driving communication method, device, equipment and storage medium. Background Art
[0002] Unmanned equipment has been widely used in many fields such as national defense and national economy. With the continuous improvement of science and technology, unmanned equipment will be further developed, bringing more convenience to people's lives. Unmanned equipment can sense the surrounding environment, thereby realizing autonomous driving in the environment and reaching the destination. The unmanned driving system controls the unmanned equipment through functional modules, including perception module, positioning module, prediction module, planning module and control module. The functional module needs to obtain the output results of the upstream module and transmit its own output results to the downstream module, which requires the development of various functional modules of the unmanned driving system in a software development platform with message transmission function. At present, the Robotic Operation System (ROS) has been widely used in the development of unmanned driving systems.
[0003] In the prior art, a master node is usually set up to provide services for registering and naming communication nodes for each functional module. The communication nodes corresponding to each functional module are all slave nodes, and the communication nodes are used to receive and send messages for the functional modules corresponding to them. In ROS, a publish-subscribe node-to-node communication framework is provided, and the transmission of messages between communication nodes can be achieved through this publish-subscribe method. The communication between communication nodes needs to be implemented through the master node. The communication node that publishes the message publishes the topic on the master node and sends the message to the topic. The communication node that subscribes to the message can receive the message in the topic as long as it subscribes to the topic on the master node.
[0004] However, since the communication nodes corresponding to each functional module need to publish and subscribe messages through the master node, once the master node fails to work, the slave node also fails to work, resulting in the inability to transmit messages between the functional modules in the unmanned driving system. In addition, when there are a large number of topics and messages in the system, the master node has a large delay in processing publishing and subscription services, which cannot meet the unmanned driving system's requirements for real-time message transmission. Summary of the invention
[0005] This specification provides an unmanned driving communication method, device, equipment and storage medium to partially solve the above-mentioned problems existing in the prior art.
[0006] This manual adopts the following technical solutions:
[0007] This specification provides an unmanned driving communication method, including:
[0008] Create the first process;
[0009] Starting a message bus component in the first process and creating a communication node in the first process;
[0010] Determining, according to a predetermined communication configuration file, a communication mode in which each communication node communicates through a message bus component; wherein the message bus component in the first process is used to communicate with the communication node in the first process;
[0011] receiving a message sent by a communication node within the first process;
[0012] Determine the topic to which the message belongs, and determine the queue corresponding to the topic as the designated queue; wherein the same topic corresponds to the same queue;
[0013] Insert the message into the tail of the specified queue;
[0014] According to the communication method, when the first process and the process where the communication node subscribes to each message in the designated queue is located are different processes of the same device or processes in different devices, each message in the designated queue is sent to the message bus component in the process where the communication node subscribes to each message in the designated queue is located according to the order of each message in the designated queue; when the first process and the process where the communication node subscribes to each message in the designated queue is located are the same process, each message in the designated queue is sent to the communication node subscribed to each message in the designated queue in the first process according to the order of each message in the designated queue.
[0015] Optionally, according to a predetermined communication configuration file, determining a communication mode for each communication node to communicate through a message bus component specifically includes:
[0016] Determine, according to a predetermined communication configuration file, a relationship between the first process and a process where a communication node for subscribing to a message is located; the relationship includes that the first process and the process where the communication node for subscribing to a message is located are in the same process or in different processes in the same device or in different devices;
[0017] Determine, according to the relationship between the first process and the process where the communication node subscribing to the message is located, a communication mode in which the communication node communicates through the message bus component;
[0018] When the relationship is that the first process and the process where the communication node subscribing to the message is located are the same process, the communication method is to send the message to the communication node subscribing to the message in the first process through the in-process transmission component;
[0019] When the relationship is that the first process and the process where the communication node subscribing to the message is located are in different processes in the same device, the communication method is to send the message to the message bus component in the process where the communication node subscribing to the message is located through the inter-process transmission component of the same device;
[0020] When the relationship is that the first process and the process where the communication node that subscribes to the message is located are processes in different devices, the communication method is to send the message to the message bus component in the process where the communication node that subscribes to the message is located through the inter-process transmission component of different devices.
[0021] Optionally, the message sent by the communication node within the first process is generated by a message producer in the unmanned driving device and published by the communication node within the first process to the topic corresponding to the message; the communication node within the first process is used to send messages to the message bus component within the first process for the message producer in the unmanned driving device and / or to obtain messages from the message bus component within the first process for the message consumer in the unmanned driving device.
[0022] Optionally, sending each message in the designated queue to a message bus component in a process where a communication node subscribing to each message in the designated queue is located specifically includes:
[0023] The message bus component in the process where the communication node subscribing to each message in the specified queue is located is used as the message bus component to be communicated; and a topic subscription request corresponding to the topic sent by the message bus component to be communicated is received;
[0024] When each message in the designated queue corresponding to the topic subscribed by the to-be-communicated message bus component is received, each message in the designated queue corresponding to the topic is sent to the to-be-communicated message bus component.
[0025] Optionally, sending each message in the designated queue corresponding to the topic to the to-be-communicated message bus component specifically includes:
[0026] Determine, in the message bus components within the first process, a component corresponding to the specified queue; wherein one queue corresponds to one component;
[0027] Each message in the designated queue corresponding to the topic is sent to the to-be-communicated message bus component through the component corresponding to the designated queue.
[0028] Optionally, sending each message in the designated queue to a communication node in the first process that subscribes to each message in the designated queue specifically includes:
[0029] receiving a topic subscription request corresponding to a topic sent by a communication node within the first process;
[0030] When each message in the designated queue corresponding to the topic subscribed by the communication node in the first process is received, each message in the designated queue corresponding to the topic is sent to the communication node in the first process.
[0031] Optionally, sending each message in the designated queue corresponding to the topic to a communication node in the first process specifically includes:
[0032] Determine, in the message bus components within the first process, a component corresponding to the specified queue; wherein one queue corresponds to one component;
[0033] Each message in the designated queue corresponding to the topic is sent to a communication node in the first process that subscribes to each message in the designated queue corresponding to the topic through a component corresponding to the designated queue.
[0034] This specification provides an unmanned driving communication device, including:
[0035] A process creation module, used for creating a first process;
[0036] A startup module, used to start the message bus component in the first process and create a communication node in the first process;
[0037] A communication mode determination module, used to determine the communication mode for each communication node to communicate through the message bus component according to a predetermined communication configuration file; wherein the message bus component in the first process is used to communicate with the communication node in the first process;
[0038] A message receiving module, used for receiving a message sent by a communication node in the first process;
[0039] A designated queue determination module is used to determine the topic to which the message belongs, and determine the queue corresponding to the topic as the designated queue; wherein the same topic corresponds to the same queue;
[0040] A message insertion module, used for inserting the message into the tail of the designated queue;
[0041] A message sending module, for, according to the communication mode, when the first process and the process where the communication node subscribes to the messages in the designated queue are located are different processes of the same device or processes in different devices, sending each message in the designated queue to the message bus component in the process where the communication node subscribes to the messages in the designated queue is located according to the sorting of the messages in the designated queue; when the first process and the process where the communication node subscribes to the messages in the designated queue are the same process, sending each message in the designated queue to the communication node subscribed to the messages in the designated queue in the first process according to the sorting of the messages in the designated queue.
[0042] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned unmanned driving communication method is implemented.
[0043] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned unmanned driving communication method when executing the program.
[0044] At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects:
[0045] In an unmanned driving communication method provided in this specification, a message bus component is started and a communication node is created in the created first process. The message bus component in the first process inserts the received message into the designated queue corresponding to the topic to which the message belongs. According to the relationship between the first process and the process where the communication node subscribes to the message is located, it is determined whether to send the message to the message bus component in the process where the communication node subscribes to the message is located, or to send the message to the communication node subscribed to the message in the process where the message is located. By starting the message bus component and creating the communication node in the process, the problem that when the message bus component in one process cannot work, other processes cannot work is avoided, thereby improving the reliability of message transmission in the unmanned driving system; because the communication node sends and receives messages through the message bus component, the decoupling between the message producer and the message consumer is achieved, and the real-time nature of message transmission is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:
[0047] Figure 1 A schematic diagram of a system architecture applicable to an unmanned driving communication method in this specification;
[0048] Figure 2 A flowchart of an unmanned driving communication method in this specification;
[0049] Figure 3 A schematic diagram of an unmanned driving communication device provided in this specification;
[0050] Figure 4 The corresponding Figure 2 Schematic diagram of electronic equipment. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0052] With the rapid development of unmanned driving technology, building a low-cost, low-power, and highly stable unmanned driving system to support large-scale operations has become one of the urgent problems to be solved in unmanned driving technology. In order to support the collaborative operation of multiple computing nodes and maximize resource utilization, an unmanned driving engine, a software development platform for the development of unmanned driving systems, was built. While providing mechanisms and tools for each functional module in the unmanned driving system, it also provides adaptation to both vehicle-mounted and simulation environments to address the challenges of the differences between road testing and simulation testing, the adaptation of each functional module in different operating environments, and uneven hardware resource allocation in the current development of unmanned driving systems.
[0053] The unmanned driving system controls the unmanned driving equipment through functional modules, including perception module, positioning module, prediction module, planning module and control module. However, the resource requirements of each functional module are extremely unbalanced. For example, in terms of data input scale, the perception module and positioning module are extremely dependent on the data collected by the radar sensor and the camera sensor, and the data usage of the perception module and the positioning module is much higher than that of other functional modules; for example, in terms of hardware resource consumption, the perception module and the prediction module will consume more computing resources of the graphics processor. It can be seen that the functional modules are not the same in terms of data input scale and resource consumption. Therefore, in order to improve the efficiency of computing resource utilization, the unmanned driving engine needs to support distributed deployment, that is, a set of unmanned driving systems are deployed on multiple devices or even devices across computer rooms.
[0054] Among them, the operation of each functional module in a simulation environment is an important means of developing unmanned driving technology. After unmanned driving enters the operational stage, simulation tasks also grow rapidly. According to the above analysis, since the requirements of each functional module for hardware computing power are different, that is, different simulation tasks have different requirements for hardware computing power, for example, perception simulation tasks and prediction simulation tasks must rely on graphics processors. Under the premise that the hardware resources or the ratio of hardware resources are fixed, in order to further improve resource utilization, different subtasks in the simulation task can be split to run on different devices, that is, each functional module can be split to run on different devices. The unmanned driving engine is responsible for completing the distributed communication between different devices for the same task.
[0055] In order to achieve distributed deployment, the functional modules are divided into computing modules for completing calculations and communication nodes for providing communication and other assistance to the computing modules. This allows the computing modules in the functional modules to only complete the calculation part without having to adapt to the operating environment they are in. The driverless engine provides abstraction and isolation of the operating environment for the computing part of the functional modules, and realizes high-real-time data transmission, data recording, and scheduling functions in a distributed environment.
[0056] In practical applications, each functional module needs to obtain the output results of the upstream module and transmit its own output results to the downstream module, which requires the communication nodes in the functional modules to assume the message transmission function.
[0057] Compared with setting a master node in ROS and using the master node to implement a communication method in which communication nodes corresponding to each functional module publish and subscribe to messages, this specification proposes a communication method that introduces a message bus component. Message producers do not need to pay attention to how message consumers process messages, thereby achieving decoupling between message producers and message consumers and improving the real-time performance of message transmission. In addition, the process in which the communication nodes are located includes message bus components, thereby avoiding the risk that communication nodes corresponding to each functional module need to publish and subscribe to messages through the master node. Once the master node fails to work, the slave node also fails to work, resulting in the inability to transmit messages between functional modules in the unmanned driving system.
[0058] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.
[0059] Figure 1 A system architecture diagram suitable for an unmanned driving communication method provided in an embodiment of this specification, the system architecture can be applied to unmanned driving equipment such as unmanned vehicles, unmanned aerial vehicles, and unmanned ships.
[0060] Normally, in order to realize distributed communication between various functional modules, communication nodes are configured for the computing modules of each functional module to provide message transmission and other support for the computing modules of each functional module, so that the computing modules in the functional modules only need to complete the calculation part without adapting to the operating environment in which they are located. Among them, the functional modules can run in the process, and at least one functional module can run in a process. For example, since the perception module and the prediction module consume more computing resources of the graphics processor, and other functional modules use less graphics processors, the perception module and the prediction module can be run in the same process, and the process can realize both perception and prediction functions.
[0061] The communication node is responsible for the transmission of the corresponding computing module message, and a computing module can be configured with at least one communication node. For example, when a computing module is configured with a communication node, the communication node is responsible for sending and receiving the corresponding computing module message; when a computing module is configured with two communication nodes, one of the communication nodes can be responsible for sending the corresponding computing module message, and the other communication node can be responsible for receiving the corresponding computing module message. The communication node and its corresponding computing module run in the same process. Since each functional module can run in a different process, the relationship between the communication nodes can be located in the same process, or in different processes of the same device, or in different devices.
[0062] In a system architecture suitable for an unmanned driving communication method provided in an embodiment of this specification, several processes can be created in a device for providing an operating environment for each functional module, and a message bus component can be started in each process. Since at least one functional module can be run in a process, a communication node corresponding to the functional module needs to be created. Each communication node communicates in real time with the message bus component in the process to which it belongs. The real-time communication described in the embodiment of the present invention refers to communication in which the communication delay can be controlled at the millisecond or microsecond level, and specifically can be communication in a vehicle-mounted system or a simulation system that meets the real-time communication requirements of each component of the unmanned equipment.
[0063] The communication node is used to send messages to the message bus component in the first process for the message producer in the unmanned driving device and / or to obtain messages from the message bus component in the first process for the message consumer in the unmanned driving device.
[0064] Specifically, the communication node undertakes the task of publishing messages and subscribing messages for the computing module in the corresponding functional module, that is, the computing module corresponding to the communication node can be only a message producer, or only a message consumer, or both a message producer and a message consumer. When the computing module in the functional module is only a message producer, the communication node corresponding to the computing module is only a publishing node. When the computing module in the functional module is only a message consumer, the communication node corresponding to the computing module is only a subscription node. When the computing module in the functional module is both a message producer and a message consumer, the communication node corresponding to the computing module acts as both a publishing node and a subscription node. The present invention does not make specific limitations on this. In the embodiments of this specification, the specific scheme is described by taking the communication node only publishing messages or only subscribing to messages as an example.
[0065] The message bus component is first used to determine the communication mode in which each communication node communicates through the message bus component according to a predetermined communication configuration file.
[0066] Normally, the construction of the communication topology in ROS is completed by the master node through the node registration and discovery service, which has a strong dependence on the network environment. If the network environment is unstable, the failure rate of the communication topology construction will be greatly increased. In order to solve the problem that the construction of the communication topology is highly dependent on the network environment, in an unmanned driving communication method provided in an embodiment of this specification, by predetermining the communication configuration file, the message bus component in each process can build the communication topology according to the communication configuration file, determine the communication method for each communication node to communicate through the message bus component, and avoid the problem of failure in building the communication topology caused by an unstable network environment.
[0067] Second, the message bus component receives messages sent by the communication nodes.
[0068] Then, according to the communication method, when the process where the user is located and the process where the communication node that subscribes to the message is located are different processes of the same device or processes in different devices, the message is sent to the message bus component in the process where the communication node that subscribes to the message is located; when the process where the user is located and the process where the communication node that subscribes to the message is located are the same process, the message is sent to the communication node that subscribes to the message in the process where the user is located.
[0069] For example, in Figure 1In the system architecture suitable for the unmanned driving communication method shown, two devices, device A and device B, are provided to provide operation requirements for each functional module, wherein the first process in device A includes communication node 1, communication node 2 and message bus component A1; the second process in device A includes communication node 3 and message bus component A2; the third process in device B includes communication node 4 and message bus component B. Communication node 1 in the first process of device A acts as a publishing node, publishing messages to message bus component A1 in its own process; when communication node 2 subscribes to the message published by communication node 1, message bus component A1 sends the received message to communication node 2; when communication node 3 subscribes to the message published by communication node 1, message bus component A1 sends the received message to message bus component A2, and then message bus component A2 sends the message to communication node 3; when communication node 4 subscribes to the message published by communication node 1, message bus component A1 sends the received message to message bus component B, and then message bus component B sends the message to communication node 4.
[0070] It can be seen that the transmission of messages between communication nodes needs to go through the message bus component. Communication node 1 only needs to send the message to message bus component A1, and does not need to pay attention to how other communication nodes subscribe to the message.
[0071] Based on the same idea, the embodiment of this specification provides an unmanned driving communication method, such as Figure 2 shown. Figure 2 A schematic diagram of an unmanned driving communication method provided by an embodiment of this specification, wherein the communication topology in which each communication node communicates through a message bus component is the same Figure 1 ,by Figure 1 The communication node 1 of the first process in device A is the node that publishes the message. The communication node that subscribes to the message is located in a different process. Figure 2 The message bus component X in can be Figure 1 The message bus component A2 in the second process may also be the message bus component B in the third process, and the communication node Y may be Figure 1 One of the communication nodes 2, 3, and 4 in the communication node. The embodiment of this specification provides an unmanned driving communication method, which specifically includes the following steps:
[0072] S100: The message bus component in the first process determines, according to a predetermined communication configuration file, a communication mode in which each communication node communicates through the message bus component.
[0073] In practical applications, the communication configuration file is used to construct a communication topology for each communication node to communicate through a message bus component. According to the constructed communication topology, the transmission of messages between the communication nodes can be realized. Among them, the message bus component started in each process can determine the communication mode for each communication node to communicate through the message bus component according to the communication configuration file.
[0074] S102: The communication node in the first process sends a message to a message bus component in the first process.
[0075] In the embodiments of this specification, each functional module is divided into a computing module for computing and a communication node that provides communication functions for the computing module. Therefore, the message sent by the communication node comes from the corresponding computing module. Specifically, the computing module in each functional module can produce messages or consume messages. Therefore, the computing module in each functional module is defined as a message producer or a message consumer. The computing module in the same functional module can be only a message producer or only a message consumer, or it can be a message producer and a message consumer at the same time.
[0076] The communication node in the first process obtains a message generated by a message producer corresponding to the communication node itself, and determines the topic to which the message belongs. The message is published to the corresponding topic; wherein a topic may include at least one message generated by a message producer. Then, the message in the topic is sent to the message bus component in the first process.
[0077] S104: The message bus component in the first process receives a message sent by a communication node in the first process.
[0078] Specifically, a buffer for temporarily storing messages may be provided in the message bus component, and the buffer may be used to temporarily store received messages until the messages are sent to a communication node subscribing to the messages or to a message bus in a process where the communication node subscribing to the messages is located.
[0079] S106: The message bus component in the first process determines the topic to which the message belongs, and determines the queue corresponding to the topic as the designated queue; wherein the same topic corresponds to the same queue; and inserts the message into the tail of the designated queue.
[0080] Specifically, after the message bus component within the first process receives a message sent by a communication node within the first process and determines the topic described in the message, it can insert the received message into the queue corresponding to the topic to ensure that the message is transmitted to the message bus component within the process where the communication node that subscribes to the message is located in the order of the queue or sent to the communication node that subscribes to the message within the first process.
[0081] S108: When the first process and the process where the communication node that subscribes to each message in the designated queue is located are different processes of the same device or processes in different devices, the message bus component in the first process sends each message in the designated queue to the message bus component in the process where the communication node that subscribes to each message in the designated queue is located according to the order of each message in the designated queue.
[0082] S110: The message bus component sends the message to the communication node in its own process.
[0083] Normally, when a communication node needs to subscribe to messages in a topic, the message bus component will receive a topic subscription request corresponding to the topic sent by the communication node. If the messages in the designated queue corresponding to the topic are not in the process where the message bus component is located, the message bus component will send a subscription request corresponding to the topic to the message bus component in the process where the topic is located based on the topic subscribed by the communication node, so that the message bus component in the process where the topic is located will send the messages in the designated queue corresponding to the topic to itself after receiving the messages in the designated queue corresponding to the topic.
[0084] When the message bus component receives a message from the specified queue corresponding to the subscribed topic, the message bus component sends the message to the communication node in its own process;
[0085] For example, Figure 2 The message bus component X in Figure 1 The message bus A2 in Figure 2 The communication node Y is Figure 1 Communication node 3 in. When communication node 3 subscribes to the message published by communication node 1, since communication node 1 and communication node 3 are not in the same process, after receiving the subscription request sent by communication node 3, message bus component A2 sends a subscription request to message bus component A1. In response to the subscription request sent by message bus component A2, message bus A1 sends the message subscribed by communication node 3 to message bus A2, and then message bus A2 sends the message to communication node 3.
[0086] S112: When the first process and the process where the communication node subscribes to each message in the designated queue is located are the same process, each message in the designated queue is sent to the communication node subscribed to each message in the designated queue in the first process according to the order of each message in the designated queue.
[0087] Normally, when a communication node needs to subscribe to messages in a designated queue corresponding to a topic, the message bus component will receive a topic subscription request corresponding to the topic sent by the communication node. If the designated queue corresponding to the topic is in its own process, after receiving the message in the designated queue corresponding to the subscribed topic, the message bus component will send the message to the communication node that subscribed to the message in its own process.
[0088] For example, Figure 2 The communication node Y is Figure 1 When communication node 2 subscribes to a message published by communication node 1, since communication node 1 and communication node 2 are in the same process, message bus component A1 sends the message to communication node 2 after receiving the subscription request sent by communication node 2.
[0089] S114: The communication node receives a message sent by the message bus component in its own process.
[0090] The communication node sends the received message to the corresponding message consumer so that the message consumer processes the message.
[0091] It should be noted that the communication node that subscribes to the message is regarded as the subscription node, and the communication node that publishes the message is regarded as the publishing node. It can be seen that the subscription node and the publishing node can be in the same process, in different processes of the same device, or in different devices. When the subscription node and the publishing node are in different processes of the same device or in different devices, steps S108 to S110 are executed, and when the subscription node and the publishing node are in the same process, step S112 is executed.
[0092] Since the subscription node in the same process as the publishing node, the subscription node in different processes of the same device as the publishing node, and the subscription node in different devices from the publishing node can subscribe to the messages published by the publishing node at the same time, the above steps S108 to S110 and S112 are executed in no particular order.
[0093] In an unmanned driving communication method provided in this specification, a message bus component is started and a communication node is created in the created first process. The message bus component in the first process inserts the received message into the designated queue corresponding to the topic to which the message belongs. According to the relationship between the first process and the process where the communication node subscribes to the message is located, it is determined whether to send the message to the message bus component in the process where the communication node subscribes to the message is located, or to send the message to the communication node subscribed to the message in the process where the message is located. By starting the message bus component and creating the communication node in the process, the problem that when the message bus component in one process cannot work, other processes cannot work is avoided, thereby improving the reliability of message transmission in the unmanned driving system; because the communication node sends and receives messages through the message bus component, the decoupling between the message producer and the message consumer is achieved, and the real-time nature of message transmission is guaranteed.
[0094] In the embodiments of this specification, Figure 2 The message bus component shown in step S100 determines the communication mode for each communication node to communicate through the message bus component according to a predetermined communication configuration file, which is specifically implemented by the following steps:
[0095] First, determine the communication profile and the relationship between the process where the user is located and the process where the communication node that subscribes to the message is located.
[0096] Then, according to the relationship between the process where the message bus component itself is located and the process where the communication node subscribing to the message is located, the communication mode in which the communication node communicates through the message bus component is determined.
[0097] Specifically, since the communication node that subscribes to the message and the communication node that publishes the message can be located in the same process, different processes in the same device, or different devices, the relationship between the process where the message bus component that receives the message is located and the process where the communication node that subscribes to the message is located has the following three types:
[0098] The first type: when the relationship is that the process where the own process is located and the process where the communication node that subscribes to the message is located are the same process, the communication method is to send the message to the communication node that subscribes to the message in the process where the own process is located through the in-process transmission component;
[0099] The second type: when the relationship is that the process where the process is located and the process where the communication node that subscribes to the message is located are different processes in the same device, the communication method is to send the message to the message bus component in the process where the communication node that subscribes to the message is located through the inter-process transmission component of the same device;
[0100] The third type: When the relationship is that the process where the process itself is located and the process where the communication node that subscribes to the message is located are processes in different devices, the communication method is to send the message to the message bus component in the process where the communication node that subscribes to the message is located through the inter-process transmission component of different devices.
[0101] It should be noted that the transmission component is located in the message bus component, and is used to transmit the message to the message bus component where the communication node subscribing to the message is located or the communication node subscribing to the message. Among them, the in-process transmission component can be a local message transmission component; the inter-process transmission component of the same device can be a shared memory component; the inter-process transmission component of different devices can be a Google Remote Procedure Call (gRPC) component, a high-speed serial computer expansion bus (Peripheral Component Interconnect express, PCIe) component, etc.
[0102] In the embodiments of this specification, Figure 2 The message bus component in the first process shown in step S106 determines the topic described by the received message, and inserts the received message into the tail of the queue corresponding to the topic. The specific steps are as follows:
[0103] First, the received message is temporarily stored in a message buffer, the topic to which the received message belongs is determined, and the queue corresponding to the topic is determined as the designated queue, wherein the same topic corresponds to the same queue.
[0104] Specifically, the hash value corresponding to each topic is calculated according to a predetermined hash algorithm; and the queue corresponding to each topic is determined according to the hash value corresponding to each topic. It can be seen that the same topic only corresponds to the same queue, and a queue can include messages in at least one topic.
[0105] Secondly, the message is inserted at the end of the specified queue.
[0106] In order to ensure that the first received message is processed first and the later received message is processed later, the messages should be placed in the queue in the order in which they are received. Therefore, each time a message is inserted, it is inserted at the end of the specified queue to ensure that the message at the front of the queue can be extracted first.
[0107] Then, it is necessary to determine the component corresponding to the designated queue according to the relationship between the first process and the process where the communication node subscribing to each message in the designated queue is located, which specifically includes the following two situations:
[0108] The first case: the first process and the process where the communication node subscribing to each message in the specified queue is located are different processes or different devices of the same device. In this case, it is necessary to determine the component corresponding to the specified queue in the message bus component within the first process. Among them, one queue corresponds to one component. Through the component, according to the order of each message in the specified queue, the messages are taken out from the head of the specified queue in order, and each message in the specified queue is sent to the message bus component within the process where the communication node subscribing to the message is located, so that the order of each message received by the message bus component within the process where the communication node subscribing to the message is located is the same as the order of each message in the specified queue.
[0109] The second situation: the first process is the same process as the process where the communication node subscribes to the messages in the specified queue is located. In this case, it is necessary to determine the component corresponding to the specified queue in the message bus component in the process where the first process is located. Among them, one queue corresponds to one component. Through the component, according to the order of each message in the specified queue, the messages are taken out from the head of the specified queue in order, and each message in the specified queue is sent to the communication node subscribed to the message in the process where the first process is located, so that the order of each message received by the communication node subscribed to the message is the same as the order of each message in the specified queue.
[0110] In another embodiment of the present specification, in order to realize offline analysis and locate online events and problems, it is necessary to save online messages. Specifically, in order to ensure the orderliness and integrity of messages, a centralized message preservation strategy is adopted. Since the device where the main process is located can be plugged into a data disk, the messages that need to be saved are uniformly sent to the message bus component in the main process, and in the message bus component in the main process, the messages that need to be saved are arranged in chronological order and temporarily stored in the memory. When the message needs to be dropped to the data disk, the drop function in the message bus component is executed to save the message that needs to be saved from the memory to the data disk. The centralized message preservation strategy can ensure the orderliness and integrity of messages, which is convenient for offline reproduction of online scenarios.
[0111] The above is an unmanned driving communication method provided by one or more embodiments of this specification. Based on the same idea, this specification also provides a corresponding unmanned driving communication device.
[0112] Figure 3 A schematic diagram of an unmanned driving communication device provided in this specification specifically includes:
[0113] A process creation module 200, used to create a first process;
[0114] A starting module 202, used to start a message bus component in the first process and create a communication node in the first process;
[0115] The communication mode determination module 204 is used to determine the communication mode for each communication node to communicate through the message bus component according to a predetermined communication configuration file; wherein the message bus component in the first process is used to communicate with the communication node in the first process;
[0116] A message receiving module 206, configured to receive a message sent by a communication node in the first process;
[0117] The designated queue determination module 208 is used to determine the topic to which the message belongs, and determine the queue corresponding to the topic as the designated queue; wherein the same topic corresponds to the same queue;
[0118] A message insertion module 210, configured to insert the message into the tail of the designated queue;
[0119] The message sending module 212 is used for, according to the communication method, when the first process and the process where the communication node subscribes to the messages in the designated queue are different processes of the same device or processes in different devices, sending each message in the designated queue to the message bus component in the process where the communication node subscribes to the messages in the designated queue is located according to the sorting of the messages in the designated queue; when the first process and the process where the communication node subscribes to the messages in the designated queue are the same process, sending each message in the designated queue to the communication node subscribed to the messages in the designated queue in the first process according to the sorting of the messages in the designated queue.
[0120] Optionally, the communication mode determination module 204 is specifically used to determine the relationship between the first process and the process where the communication node that subscribes to the message is located according to a predetermined communication configuration file; the relationship includes that the first process and the process where the communication node that subscribes to the message is located are in the same process or in different processes in the same device or in different devices; according to the relationship between the first process and the process where the communication node that subscribes to the message is located, determine the communication mode in which the communication node communicates through the message bus component; when the relationship is that the first process and the process where the communication node that subscribes to the message are located are the same process, the communication mode is to send the message to the communication node that subscribes to the message in the first process through the in-process transmission component; when the relationship is that the first process and the process where the communication node that subscribes to the message are located in different processes in the same device, the communication mode is to send the message to the message bus component in the process where the communication node that subscribes to the message is located through the inter-process transmission component of the same device; when the relationship is that the first process and the process where the communication node that subscribes to the message are located in different devices, the communication mode is to send the message to the message bus component in the process where the communication node that subscribes to the message is located through the inter-process transmission component of different devices.
[0121] Optionally, the message sent by the communication node within the first process is generated by a message producer in the unmanned driving device and published by the communication node within the first process to the topic corresponding to the message; the communication node within the first process is used to send messages to the message bus component within the first process for the message producer in the unmanned driving device and / or to obtain messages from the message bus component within the first process for the message consumer in the unmanned driving device.
[0122] Optionally, the message sending module 212 is specifically used to use the message bus component in the process where the communication node that subscribes to each message in the designated queue is located as the message bus component to be communicated; receive a topic subscription request corresponding to a topic sent by the message bus component to be communicated; and when each message in the designated queue corresponding to the topic subscribed by the message bus component to be communicated is received, send each message in the designated queue corresponding to the topic to the message bus component to be communicated.
[0123] Optionally, the message sending module 212 is specifically used to determine the component corresponding to the specified queue in the message bus component within the first process; wherein one queue corresponds to one component; and through the component corresponding to the specified queue, each message in the specified queue corresponding to the topic is sent to the message bus component to be communicated.
[0124] Optionally, the message sending module 212 is specifically used to receive a topic subscription request corresponding to a topic sent by a communication node within the first process; when each message in a specified queue corresponding to a topic subscribed by the communication node within the first process is received, each message in the specified queue corresponding to the topic is sent to the communication node within the first process.
[0125] Optionally, the message sending module 212 is specifically used to determine the component corresponding to the specified queue in the message bus component within the first process; wherein one queue corresponds to one component; and through the component corresponding to the specified queue, send each message in the specified queue corresponding to the topic to the communication node in the first process that subscribes to each message in the specified queue corresponding to the topic.
[0126] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 2 An unmanned driving communication method is provided.
[0127] This manual also provides Figure 4 The schematic structure diagram of the electronic device shown in FIG. Figure 4 As mentioned above, at the hardware level, the unmanned driving device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 2 Of course, in addition to the software implementation, this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0128] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0129] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0130] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0131] For the convenience of description, the above device is described by dividing it into various units according to its functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0132] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0133] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks 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 produce 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.
[0134] 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.
[0135] 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 A step that specifies a function in one or more boxes.
[0136] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0137] The memory may include non-permanent storage 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.
[0138] 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.
[0139] 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.
[0140] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0141] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0142] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0143] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.
Claims
1. An unmanned driving communication method, characterized in that: include: Create the first process; Starting a message bus component in the first process and creating a communication node in the first process; Determining, according to a predetermined communication configuration file, a communication mode in which each communication node communicates through a message bus component; wherein the message bus component in the first process is used to communicate with the communication node in the first process; receiving a message sent by a communication node within the first process; Determine the topic to which the message belongs, and determine the queue corresponding to the topic as the designated queue; wherein the same topic corresponds to the same queue; Insert the message into the tail of the specified queue; According to the communication method, when the first process and the process where the communication node subscribes to each message in the designated queue is located are different processes of the same device or processes in different devices, each message in the designated queue is sent to the message bus component in the process where the communication node subscribes to each message in the designated queue is located according to the sorting of each message in the designated queue; when the first process and the process where the communication node subscribes to each message in the designated queue is located are the same process, each message in the designated queue is sent to the communication node subscribed to each message in the designated queue in the first process according to the sorting of each message in the designated queue; Determining the communication mode for each communication node to communicate through the message bus component according to the predetermined communication configuration file specifically includes: Determine, according to a predetermined communication configuration file, a relationship between the first process and a process where a communication node for subscribing to a message is located; the relationship includes that the first process and the process where the communication node for subscribing to a message is located are in the same process or in different processes in the same device or in different devices; Determine, according to the relationship between the first process and the process where the communication node subscribing to the message is located, a communication mode in which the communication node communicates through the message bus component; When the relationship is that the first process and the process where the communication node subscribing to the message is located are the same process, the communication method is to send the message to the communication node subscribing to the message in the first process through the in-process transmission component; When the relationship is that the first process and the process where the communication node subscribing to the message is located are in different processes in the same device, the communication method is to send the message to the message bus component in the process where the communication node subscribing to the message is located through the inter-process transmission component of the same device; When the relationship is that the first process and the process where the communication node that subscribes to the message is located are processes in different devices, the communication method is to send the message to the message bus component in the process where the communication node that subscribes to the message is located through the inter-process transmission component of different devices.
2. The method according to claim 1, characterized in that The message sent by the communication node within the first process is generated by the message producer in the unmanned driving device and published by the communication node within the first process to the topic corresponding to the message; the communication node within the first process is used to send messages to the message bus component within the first process for the message producer in the unmanned driving device and / or to obtain messages from the message bus component within the first process for the message consumer in the unmanned driving device.
3. The method according to claim 1, characterized in that Sending each message in the designated queue to a message bus component in a process where a communication node subscribing to each message in the designated queue is located specifically includes: The message bus component in the process where the communication node subscribing to each message in the specified queue is located is used as the message bus component to be communicated; and a topic subscription request corresponding to the topic sent by the message bus component to be communicated is received; When each message in the designated queue corresponding to the topic subscribed by the to-be-communicated message bus component is received, each message in the designated queue corresponding to the topic is sent to the to-be-communicated message bus component.
4. The method according to claim 3, characterized in that Sending each message in the designated queue corresponding to the topic to the to-be-communicated message bus component specifically includes: Determine, in the message bus components within the first process, a component corresponding to the specified queue; wherein one queue corresponds to one component; Each message in the designated queue corresponding to the topic is sent to the to-be-communicated message bus component through the component corresponding to the designated queue.
5. The method according to claim 1, characterized in that Sending each message in the designated queue to a communication node in the first process that subscribes to each message in the designated queue specifically includes: receiving a topic subscription request corresponding to a topic sent by a communication node within the first process; When each message in the designated queue corresponding to the topic subscribed by the communication node in the first process is received, each message in the designated queue corresponding to the topic is sent to the communication node in the first process.
6. The method according to claim 5, characterized in that Sending each message in the designated queue corresponding to the topic to a communication node in the first process specifically includes: Determine, in the message bus components within the first process, a component corresponding to the specified queue; wherein one queue corresponds to one component; Each message in the designated queue corresponding to the topic is sent to a communication node in the first process that subscribes to each message in the designated queue corresponding to the topic through a component corresponding to the designated queue.
7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Load balancing method and system for information collection task of server
CN107357662A
Method and device for accelerating message writing of message queue, and medium
CN111104232A