Message sending methods, devices and unmanned equipment
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-01
- Publication Date
- 2026-08-14
AI Technical Summary
[0003]现有相关技术中,无人机一般采用ZMQ和机器人操作系统(robot operatingsystem,ROS)/ROS2通信机制进行算法与服务之间的消息通信,一种实现方案为,在无人机中采用ZMQ通信机制作为主通信模式,算法采用ROS消息通信作为辅助调试;ZMQ和ROS消息通信方式进行消息发送和接收均需要依赖中心节点和网络协议栈,通信延迟高;而ROS2通信机制需要依赖第三方中间件,底层主题(topic)发布/订阅关系通过广播来建立,容易发生丢包,同时通信架构复杂,不利于在无人机系统进行部署集成;另外ZMQ和ROS/ROS2通信机制中,各个算法和系统应用需要依赖大量第三方系统库,使用成本较高
[0023]应当理解的是,本申请实施例的第二~四方面与本申请实施例的第一方面的技术方案一致,各方面及对应的可行实施方式所取得的有益效果相似,不再赘述。
Smart Images

Figure CN116932238B_ABST
Abstract
Description
[Technical Field]
[0001] This application relates to the field of unmanned aerial vehicle (UAV) technology, and more particularly to a message sending method, apparatus, and unmanned device. [Background Technology]
[0002] The drone delivery system is a highly complex system. Multiple complex algorithms run on the drone's main computing platform, such as precision landing, trajectory planning, visual-inertial odometry (VIO) positioning and navigation, and high-precision obstacle avoidance. Simultaneously, a series of system applications run, including time synchronization, over-the-air (OTA) upgrades, data acquisition, log management, and fault detection. Frequent low-level message communication is required between algorithms, between system applications, and between algorithms and system applications. The drone's low-level message communication mechanism is crucial to the efficient operation of the entire drone, and message communication must meet stringent requirements of high reliability and low latency.
[0003] In existing technologies, drones generally use ZMQ and Robot Operating System (ROS) / ROS2 communication mechanisms for message communication between algorithms and services. One implementation scheme is to use ZMQ as the main communication mode in the drone, and use ROS message communication as an auxiliary debugging method for the algorithm. Both ZMQ and ROS message communication methods rely on a central node and network protocol stack for message sending and receiving, resulting in high communication latency. The ROS2 communication mechanism relies on third-party middleware, and the underlying topic publish / subscribe relationship is established through broadcast, which is prone to packet loss. At the same time, the communication architecture is complex and not conducive to deployment and integration in drone systems. In addition, in the ZMQ and ROS / ROS2 communication mechanisms, various algorithms and system applications rely on a large number of third-party system libraries, resulting in high usage costs.
[0004] In addition, as UAV systems become increasingly complex, the number of algorithms and system application processes continues to grow, and information communication and exchange between different services in multi-chip systems (system on chip, SOC) is gradually becoming a trend, there is a need to provide a message communication mechanism in UAVs to ensure that the entire UAV computing platform can operate efficiently and securely. [Summary of the Invention]
[0005] This application provides a message sending method, apparatus, and unmanned device to achieve a unified underlying message communication framework for unmanned aerial vehicles, decentralized message communication, reduced communication latency, and improved communication reliability.
[0006] In a first aspect, embodiments of this application provide a message sending method applied to a multi-process system of an unmanned device. The multi-process system includes subscription nodes, publishing nodes, and a message core. The message core is implemented through shared memory and stores the relationship between publishing nodes and subscription nodes for each registered topic in the multi-process system. The method includes: a publishing node placing a published message into a circular buffer queue in the shared memory and updating the write index of the circular buffer queue; wherein the shared memory is created by the publishing node for publishing messages; the messages published by the publishing node belong to the same topic; the publishing node queries its subscription node semaphore queue and triggers a semaphore between the publishing node and a target subscription node subscribing to the topic to which the message belongs; wherein the publishing node obtains information about the target subscription node subscribing to the topic to which the message belongs from the message core; the target subscription node locates the shared memory address where the message is located from the circular buffer queue based on the accumulated semaphore value of the target subscription node, reads the message published by the publishing node, and updates the read index of the target subscription node in the circular buffer queue.
[0007] In the above message sending method, the publishing node places the published message into a circular buffer queue in shared memory, updates the write index of the circular buffer queue, then queries the semaphore queue of the publishing node's subscriber nodes, triggering the semaphore between the publishing node and the target subscriber node subscribing to the topic to which the message belongs. Finally, the target subscriber node locates the shared memory address of the message in the circular buffer queue based on the accumulated semaphore value of the target subscriber node, reads the message published by the publishing node, and updates the read index of the target subscriber node in the circular buffer queue. This enables direct message communication between the publishing node and the subscriber node without going through a central node, ensuring low latency characteristics of the message.
[0008] In one possible implementation, after reading the message published by the publishing node, the process further includes: the target subscription node notifying the upper-layer application to process the received message.
[0009] In one possible implementation, before the publishing node places the published message into the circular buffer queue of shared memory, the method further includes: the publishing node creating shared memory; the publishing node registering in the message core and registering the topic it publishes in the message core, obtaining information about target subscription nodes that have registered and subscribed to the topic in the multi-process system from the message core, creating a semaphore for asynchronous communication notification with the target subscription node, and adding the semaphore to the publishing node's subscription node semaphore queue; the publishing node obtaining the agent to which the target subscription node to subscribe to the topic belongs through the message core, and notifying the target subscription node to update the information of the publishing node publishing the topic message through the agent's asynchronous notification refresher; the target subscription node obtaining the shared memory information and semaphore for communicating with the publishing node from the information notified by the asynchronous notification refresher, starting an asynchronous message receiving thread, and waiting to receive messages.
[0010] In one possible implementation, before the target subscriber node locates the shared memory address of the message in the circular buffer queue based on the target subscriber node's accumulated semaphore value and reads the message published by the publisher node, the method further includes: the target subscriber node creating a topic message thread pool; wherein, the topic message thread pool is used to receive messages of the topics subscribed to by the target subscriber node; the target subscriber node registers in the message core, and registers the topics subscribed to by the target subscriber node in the message core, obtains information from the message core of the publisher nodes that have registered and published the topic in the multi-process system, and obtains information related to the publisher nodes from the information of the publisher nodes. The publishing node establishes a semaphore for communication with the target subscribing node, starts an asynchronous message receiving thread, waits to receive messages, and adds the asynchronous message receiving thread to the thread pool of the target subscribing node. The target subscribing node obtains the agent to which the publishing node that published the topic belongs through the message core, and notifies the publishing node to update the information of the target subscribing node that subscribes to the topic through the asynchronous notification refresher of the agent. The publishing node obtains the information of the target subscribing node from the information notified by the asynchronous notification refresher, creates a semaphore for communicating with the target subscribing node based on the information of the target subscribing node, and adds the semaphore for communicating with the target subscribing node to the publishing node's subscribing node semaphore queue.
[0011] In one possible implementation, the publishing node placing the published message into a circular buffer queue in shared memory includes: the publishing node retrieving the published message from the message queue corresponding to the topic and writing the message into the circular buffer queue in shared memory; wherein the message queue corresponding to the topic is created by the agent to which the publishing node belongs, and different topics correspond to different message queues.
[0012] In one possible implementation, the multi-process system is deployed on a chip-level system.
[0013] In one possible implementation, the multi-process system is deployed on at least two chip-level systems, each of which includes a platform bridge and a resource mapping tree. The at least two chip-level systems include a first chip-level system and a second chip-level system. After a message is published by a publishing node of the first chip-level system, the platform bridge of the first chip-level system reads the message, selects the underlying hardware link for transmitting the message through the resource mapping tree of the first chip-level system, and transmits the message to the second chip-level system through the underlying hardware link. The platform bridge of the second chip-level system receives the message, publishes the message, and triggers the subscription nodes in the second chip-level system that have subscribed to the topic to which the message belongs to receive the message.
[0014] Secondly, embodiments of this application provide a message sending device, installed in an unmanned device. The unmanned device includes a multi-process system, which includes subscription nodes, publishing nodes, and a message core. The message core is implemented through shared memory and stores the relationship between publishing nodes and subscription nodes for each registered topic in the multi-process system. The publishing node is used to place published messages into a circular buffer queue in the shared memory and update the write index of the circular buffer queue. The shared memory is created by the publishing node and used for publishing messages. The messages published by the publishing node belong to the same topic. The publishing node also queries the subscription node semaphore queue of the publishing node and triggers a semaphore between the publishing node and a target subscription node subscribing to the topic to which the message belongs. The publishing node obtains information about the target subscription node subscribing to the topic to which the message belongs from the message core. The target subscription node is used to locate the shared memory address where the message is located in the circular buffer queue based on the accumulated semaphore value of the target subscription node, read the message published by the publishing node, and update the read index of the target subscription node in the circular buffer queue.
[0015] In one possible implementation, the target subscription node is further configured to notify the upper-layer application to process the received message after reading the message published by the publishing node.
[0016] In one possible implementation, the publishing node is further configured to: create shared memory before placing the published message into a circular buffer queue of shared memory; register in the message core and register the topic published by the publishing node in the message core; obtain information from the message core about target subscription nodes that have registered and subscribed to the topic in the multi-process system; create a semaphore for asynchronous communication notification with the target subscription node and add the semaphore to the publishing node's subscription node semaphore queue; obtain the agent to which the target subscription node to subscribe to the topic belongs through the message core, and notify the target subscription node to update the information of the publishing node that published the topic message through the agent's asynchronous notification refresher; the target subscription node is further configured to obtain information about the shared memory and the semaphore for communicating with the publishing node from the information notified by the asynchronous notification refresher, start an asynchronous message receiving thread, and wait to receive messages.
[0017] In one possible implementation, the target subscription node is further configured to create a topic message thread pool before locating the shared memory address of the message from the circular buffer queue based on the target subscription node's semaphore accumulation value and reading the message published by the publishing node; wherein, the topic message thread pool is configured to receive messages of topics subscribed to by the target subscription node; register in the message core, and register the topics subscribed to by the target subscription node in the message core, obtain information from the message core about publishing nodes that have registered and published the topic in the multi-process system, and obtain information about communicating with the publishing node from the information of the publishing node. The publishing node initiates an asynchronous message receiving thread using a semaphore, waits to receive messages, and adds the asynchronous message receiving thread to the thread pool of the target subscription node. It also obtains the proxy to which the publishing node publishing the topic belongs through the message core, and notifies the publishing node to update the information of the target subscription node subscribing to the topic through the asynchronous notification refresher of the proxy. The publishing node further obtains the information of the target subscription node from the information notified by the asynchronous notification refresher, creates a semaphore for communicating with the target subscription node based on the information of the target subscription node, and adds the semaphore for communicating with the target subscription node to the publishing node's subscription node semaphore queue.
[0018] In one possible implementation, the publishing node is specifically used to retrieve published messages from the message queue corresponding to the topic and write the messages into a circular buffer queue in shared memory; wherein the message queue corresponding to the topic is created by the agent to which the publishing node belongs, and different topics correspond to different message queues.
[0019] In one possible implementation, the multi-process system is deployed on a chip-level system.
[0020] In one possible implementation, the multi-process system is deployed on at least two chip-level systems, each of which further includes a platform bridge and a resource mapping tree. The at least two chip-level systems include a first chip-level system and a second chip-level system. The platform bridge of the first chip-level system is used to read the message after its publishing node publishes it, select the underlying hardware link for transmitting the message through the resource mapping tree of the first chip-level system, and transmit the message to the second chip-level system through the underlying hardware link. The platform bridge of the second chip-level system is used to receive the message, publish the message, and trigger the subscription nodes in the second chip-level system that subscribe to the topic to which the message belongs to receive the message.
[0021] Thirdly, embodiments of this application provide an unmanned device, including: at least one processor; and at least one memory communicatively connected to the processor, wherein: the memory stores program instructions executable by the processor, and the processor can execute the method provided in the first aspect by calling the program instructions.
[0022] Fourthly, embodiments of this application provide a non-transitory computer-readable storage medium storing computer instructions that cause the computer to perform the method provided in the first aspect.
[0023] It should be understood that the second to fourth aspects of the embodiments of this application are consistent with the technical solutions of the first aspect of the embodiments of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be described again. [Attached Image Description]
[0024] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is an architecture diagram of a multi-process system provided in one embodiment of this application;
[0026] Figure 2 A flowchart illustrating a message sending method provided in one embodiment of this application;
[0027] Figure 3 A schematic diagram illustrating a message sending process provided in one embodiment of this application;
[0028] Figure 4 A flowchart of a message sending method provided in another embodiment of this application;
[0029] Figure 5 This is a schematic diagram illustrating the registration and / or refreshing of a publishing node according to one embodiment of this application;
[0030] Figure 6 A flowchart illustrating a message sending method provided in another embodiment of this application;
[0031] Figure 7 This is a schematic diagram illustrating the registration and / or refresh of a subscription node according to one embodiment of this application;
[0032] Figure 8 A flowchart illustrating a message sending method provided in another embodiment of this application;
[0033] Figure 9 A schematic diagram of a message buffering mechanism provided in one embodiment of this application;
[0034] Figure 10 This is an architecture diagram of a multi-process system in multiple SOCs provided in one embodiment of this application;
[0035] Figure 11 This is a schematic diagram of the structure of a message sending device provided in one embodiment of this application;
[0036] Figure 12 This is a schematic diagram of the structure of an unmanned device provided in one embodiment of this application.
Detailed Implementation Methods
[0037] To better understand the technical solution of this application, the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0038] It should be understood that the described embodiments are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0039] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0040] In existing technologies, drones generally use ZMQ and ROS / ROS2 communication mechanisms for message communication between algorithms and services. ZMQ, short for ZeroMQ, refers to a series of interfaces similar to sockets. ZMQ is a simple and easy-to-use transport layer that makes socket programming simpler, more concise, and more efficient. ZMQ is a message processing queue library that can scale elastically across multiple threads, kernels, and host machines.
[0041] Existing technologies that use ZMQ communication as the primary communication mode and ROS message communication as an auxiliary debugging method in UAVs have the following drawbacks:
[0042] 1. Based on the message communication mechanism of ZMQ and ROS, all messages between services need to go through a central node. This results in a high load on the central processing unit (CPU) of the central node. Once the central node fails, the communication function between all services in the entire system will be disrupted, and the reliability will be poor.
[0043] 2. Based on the message communication mechanism of ZMQ and ROS, message communication between services and algorithms needs to go through the central node and network protocol stack, resulting in high communication latency. At the same time, as the number of system services and algorithms increases, the load on the central node increases, which will further increase the communication latency.
[0044] 3. In scenarios where multiple services and algorithms are started simultaneously, ZMQ, ROS, and / or ROS2 cannot create relationships between topic subscriptions and / or publications in a timely manner, which can easily lead to packet loss.
[0045] 4. Message communication using ZMQ, ROS, and / or ROS2 requires a network protocol stack when communicating between multiple SOCs, which is not conducive to communication expansion between multiple SOCs. It also requires a third-party communication library, which is not conducive to system integration and deployment.
[0046] Based on the above problems, this application provides a message sending method that can achieve the following technical effects:
[0047] 1. A unified underlying message communication framework for drones is implemented, with decentralized message communication. If a service process has a problem, it will not affect other applications and algorithms in the system, resulting in high reliability.
[0048] 2. All service applications and algorithm applications in the system can communicate directly, with data copied only once, resulting in low communication latency, low packet loss rate, and high reliability;
[0049] 3. Each topic's publishing / subscription is done through a single thread, resulting in fast message reception and no interference between different topics;
[0050] 4. The subscription and publication relationships of message topics among various services and algorithms in the drone are updated and maintained through a unified registry and asynchronous notification / refresh method. This enables rapid updates of topic publication / subscription relationships throughout the system, and message subscription failures and packet loss will not occur even if services and algorithms start simultaneously.
[0051] 5. It can perform inter-service message communication between single SOC and dual SOC. The underlying communication link can be any hardware link, such as: Universal Asynchronous Receiver Transmitter (UART), Universal Serial Bus (USB) and / or Serial Peripheral Interface (SPI), etc.
[0052] 6. The message communication mechanism provided in this application does not rely on any third-party communication library and is very easy to integrate and deploy in the UAV system.
[0053] In summary, in the message sending method provided in this application embodiment, when publishing a message, the publishing node places the message in a memory area shared by the publishing node and the subscribing node. The publishing node notifies all subscribing nodes to read the message from the shared memory area through a shared semaphore, thereby enabling the publishing node and the subscribing node to exchange data directly without relying on complex protocols and third parties for forwarding.
[0054] This application embodiment creates a shared relational database to store the publishing nodes and subscribing nodes of topics in a multi-process system. The publishing node can obtain the subscribing nodes of the topics published by the publishing node in the multi-process system, and the subscribing node can obtain the publishing nodes of the topics subscribed to by the subscribing node in the multi-process system, thereby creating the data shared memory and shared semaphore required for data communication.
[0055] In addition, there are a large number of publisher nodes and subscriber nodes in a multi-process system. The publisher nodes and subscriber nodes start up in different orders. The embodiments of this application ensure that all subscriber nodes in the system can be correctly notified no matter when the publisher node starts up, even if the subscriber node starts up very late. It also ensures that the subscriber node can receive messages published by all publisher nodes publishing the same topic, even if the publisher node starts up very late.
[0056] Furthermore, during high-frequency message publishing, a message buffering mechanism is adopted. The shared area of the same topic actually contains multiple shared buffers to ensure that messages are not overwritten. At the same time, the publishing node maintains a write pointer, and each subscription node maintains its own read pointer to ensure the correctness of message reading by different subscription nodes at different times.
[0057] Figure 1 This is an architecture diagram of a multi-process system provided in one embodiment of this application. Figure 1 The multi-process system shown includes four agents: Agent1, Agent2, Agent3, and Agent4. Each algorithm application and system application in this system corresponds to one agent. Each agent includes subscriber nodes and publisher nodes. Each agent can publish messages on multiple topics to the multi-process system and subscribe to messages on multiple topics from the system. The message core (mmcore) acts as a relational database for maintaining topics. It stores all registered agents, publisher nodes, and subscriber nodes in the multi-process system, the topics published by publisher nodes, and the topics subscribed to by subscriber nodes. It maintains the relationships between publisher nodes and subscriber nodes for topics throughout the multi-process system. This relational database is implemented using shared memory and can be shared by all publisher and subscriber nodes in the multi-process system. The message core only stores the subscription and / or publish relationships for all topics in the multi-process system and does not exist as an independent central node process.
[0058] The following is based on Figure 1 The architecture shown illustrates the message sending method provided in the embodiments of this application. Figure 2 This is a flowchart of a message sending method provided in one embodiment of this application. The message sending method described above can be applied to a multi-process system of unmanned equipment. See also... Figure 1 The aforementioned multi-process system may include subscription nodes, publisher nodes, and a message core. The message core is implemented through shared memory and stores the relationship between publisher nodes and subscription nodes of each topic that has been registered in the multi-process system. Figure 3 This is a schematic diagram illustrating a message sending process according to an embodiment of this application. Figure 3 The message sending process described in this embodiment is illustrated.
[0059] Combination Figure 1 and Figure 3 The above message sending methods may include:
[0060] Step 201: The publishing node places the published message into a circular buffer queue in shared memory and updates the write index of the circular buffer queue.
[0061] The shared memory mentioned above is created by the publishing node and used to publish messages; the messages published by the publishing node belong to the same topic.
[0062] Step 202: The publishing node queries the semaphore queue of the publishing node and triggers the semaphore between the publishing node and the target subscription node that subscribes to the topic to which the above message belongs.
[0063] The publishing node obtains information about the target subscription nodes that subscribe to the topic to which the above message belongs from the message core, thereby knowing the semaphore between the publishing node and the target subscription nodes that subscribe to the topic to which the above message belongs.
[0064] Step 203: The target subscriber node locates the shared memory address of the message in the circular buffer queue based on the accumulated semaphore value of the target subscriber node, reads the message published by the publisher node, and updates the read index of the target subscriber node in the circular buffer queue.
[0065] Furthermore, after step 203, the following may also be included:
[0066] Step 204: The target subscription node notifies the upper-layer application of the received message for processing.
[0067] Figure 3 The diagram illustrates a scenario where one publisher node publishes a message and multiple subscriber nodes read the message. Alternatively, it illustrates a scenario where multiple publisher nodes publish messages and one subscriber node reads the message, or multiple publisher nodes publish messages and multiple subscriber nodes subscribe to the message. Figure 3 The process shown is similar and will not be repeated here.
[0068] In the above message sending method, the publishing node places the published message into a circular buffer queue in shared memory, updates the write index of the circular buffer queue, then queries the semaphore queue of the publishing node's subscriber nodes, triggering the semaphore between the publishing node and the target subscriber node subscribing to the topic to which the message belongs. Finally, the target subscriber node locates the shared memory address of the message in the circular buffer queue based on the accumulated semaphore value of the target subscriber node, reads the message published by the publishing node, and updates the read index of the target subscriber node in the circular buffer queue. This enables direct message communication between the publishing node and the subscriber node without going through a central node, ensuring low latency characteristics of the message.
[0069] In the embodiments of this application, Figure 1 Each agent in the system registers its information in the message core upon startup and starts an asynchronous notification refresher to receive and update information from publisher nodes and / or subscriber nodes.
[0070] Figure 4 A flowchart of a message sending method provided in another embodiment of this application. Figure 5 This is a schematic diagram illustrating the registration and / or refreshing of a publishing node according to one embodiment of this application, as shown below. Figure 4 and Figure 5 As shown, this application Figure 2 In the illustrated embodiment, before step 201, the following may also be included:
[0071] Step 401: Publish the node to create shared memory.
[0072] Specifically, when a system application needs to publish a topic message, a publishing node is created to publish the message on that topic, and the publishing node creates shared memory for publishing the message.
[0073] Step 402: The publishing node registers in the message core and registers the topics published by the publishing node in the message core. It obtains information about the target subscription nodes that have registered and subscribed to the topics in the multi-process system from the message core, creates a semaphore for asynchronous communication notification with the target subscription nodes, and adds the semaphore to the subscription node semaphore queue of the publishing node.
[0074] Step 403: The publishing node obtains the agent to which the target subscription node belongs by subscribing to the topic through the message core, and notifies the target subscription node to update the information of the publishing node that publishes the topic message through the asynchronous notification refresher of the agent.
[0075] Step 404: The target subscribing node obtains the shared memory information and semaphore used for communication with the publishing node from the information notified by the asynchronous notification refresher, starts the asynchronous message receiving thread, and waits to receive messages.
[0076] Figure 6 A flowchart of a message sending method provided in another embodiment of this application. Figure 7 This is a schematic diagram illustrating the registration and / or refresh of a subscription node according to one embodiment of this application, as shown below. Figure 6 and Figure 7 As shown, this application Figure 2 In the illustrated embodiment, before step 203, the following may also be included:
[0077] Step 601: The target subscription node creates a topic message thread pool.
[0078] The aforementioned topic message thread pool is used to receive messages from topics subscribed to by the target subscription node.
[0079] Step 602: The target subscription node registers in the message core and registers the topic it subscribes to in the message core. It obtains information about the publishing nodes that have registered and published the topic in the multi-process system from the message core, obtains the semaphore for communicating with the publishing node from the information of the publishing node, starts the asynchronous message receiving thread, waits to receive messages, and adds the asynchronous message receiving thread to the thread pool of the target subscription node.
[0080] Step 603: The target subscription node obtains the agent to which the publishing node that published the topic belongs through the aforementioned message core, and notifies the publishing node to update the information of the target subscription node that subscribed to the topic through the asynchronous notification refresher of the aforementioned agent.
[0081] Step 604: The publishing node obtains the information of the target subscription node from the information notified by the asynchronous notification refresher, creates a semaphore for communicating with the target subscription node based on the information of the target subscription node, and adds the semaphore for communicating with the target subscription node to the subscription node semaphore queue of the publishing node.
[0082] This application has been approved. Figures 4-7 The message topic registration and / or refresh mechanism provided in the illustrated embodiment ensures that, in a multi-process system where all services and algorithms start simultaneously, regardless of their order, the relationship between topic publication and subscription can be established quickly and correctly without packet loss. Furthermore, the message topic registration and / or refresh mechanism ensures that publishing and subscribing nodes in the multi-process system can obtain the shared memory and semaphore information required for direct communication.
[0083] Figure 8 A flowchart of a message sending method provided in another embodiment of this application. Figure 9 This is a schematic diagram of a message buffering mechanism provided in one embodiment of this application, as shown below. Figure 8 and Figure 9 As shown, this application Figure 2 In the illustrated embodiment, step 201 may include:
[0084] Step 801: The publishing node retrieves the published message from the message queue corresponding to the aforementioned topic, writes the message to a circular buffer queue in shared memory, and updates the write index of the circular buffer queue. Note that the message queue corresponding to the aforementioned topic is created by the broker to which the publishing node belongs, and different topics have different message queues.
[0085] See Figure 9In this embodiment, when a proxy publishes messages on multiple topics, the messages are placed in independent message queues to reduce the blocking and congestion of high-frequency messages. Different topics correspond to different message queues. When a publishing node publishes a message, it retrieves the message from the message queue corresponding to the topic being published by that publishing node, writes the message to a circular buffer queue in shared memory, and updates the write index of the circular buffer queue.
[0086] Different subscription nodes retrieve messages for the subscribed topics from the circular buffer queue of shared memory and update their respective read indexes, so that messages will not be lost or overwritten due to different access times.
[0087] In addition, in the specific implementation, the circular buffer queue of shared memory uses a lock-free design to improve access efficiency. This embodiment ensures the message transmission security of the entire message communication through a message buffering mechanism.
[0088] This application Figures 1-9 In the illustrated embodiment, Figure 1 The multi-process system shown is deployed on a single SOC. However, in a practical implementation, the same multi-process system can also be deployed on at least two SOCs, each of which includes a platform bridge and a resource mapping tree; these at least two SOCs include a first SOC and a second SOC.
[0089] After the publishing node of the first SOC publishes the message, the platform bridge of the first SOC reads the message, selects the underlying hardware link for transmitting the message through the resource mapping tree of the first SOC, and transmits the message to the second chip-level system through the underlying hardware link; after receiving the message, the platform bridge of the second chip-level system publishes the message, triggering the subscription nodes in the second SOC that subscribe to the topic to which the message belongs to receive the message.
[0090] Figure 10 For an architecture diagram of a multi-process system in a multi-SOC provided in one embodiment of this application, see [link to diagram]. Figure 10 In a multi-SOC system, the message communication mechanism between system applications and algorithm applications on a single SOC remains unchanged. Agents communicate directly with each other through shared memory and semaphores. The message core maintains the relationship between topic subscription and publication. For details, please refer to this application. Figures 1-9 The description of the illustrated embodiments will not be repeated here.
[0091] When multiple SOCs communicate via messages, a platform bridge and a resource mapping tree are added to each SOC to facilitate this communication.
[0092] 1) The platform bridge configuration requires this SOC to subscribe to message topics published by other SOCs;
[0093] 2) Configure the platform bridge to publish message topics that this SOC needs to publish to other SOCs;
[0094] 3) The platform bridge directly communicates with the system applications and algorithm applications of this SOC via message communication;
[0095] 4) When the platform bridge sends messages to other SoCs, it selects an underlying hardware link, such as UART, SPI and / or USB, through the resource mapping tree, without relying on the network.
[0096] like Figure 10 In compute_platform0, agent_service0 publishes messages on topic0, and compute_platform1's agent_service0 subscribes to messages on topic0. The process is as follows:
[0097] Step 1: On compute_platform0, agent_service0 creates a publisher node and registers it with the message core. On compute_platform0, the platform bridge creates a subscriber node and also registers it with the message core. The two establish a message subscription and publish relationship through the message core, obtaining shared memory and semaphores for direct communication.
[0098] Step 2: On compute_platform1, agent_service0 creates a subscription node and registers it with the message core; the platform bridge creates a publisher node and registers it with the message core. The two establish a message subscription and publish relationship through the message core, obtaining shared memory and semaphores for direct communication.
[0099] Step 3: When agent_service0 on compute_platform0 publishes a message with topic0, the semaphore held by the platform bridge on compute_platform0 is triggered, the message is read from the corresponding shared memory buffer, the message of topic0 is placed in the buffer channel corresponding to topic0, and a low-level hardware link for transmitting the message of topic0 is selected through the resource mapping tree, and the message with topic0 is sent to compute_platform0.
[0100] Step 4: When the platform bridge on compute_platform1 receives a message with topic 0 from the resource mapping tree of compute_platform1, it will publish the message to the shared memory buffer corresponding to topic 0 and trigger the semaphore of topic 0.
[0101] Step 5: The topic0 semaphore held by agent_service0 on compute_platform1 is triggered by the platform bridge. The receiving thread of agent_service0 retrieves the message with topic0 from the shared memory buffer corresponding to topic0 and notifies the upper layer application to process the message data.
[0102] The message sending method provided in this application embodiment is decentralized through a distributed drone communication mechanism. All services and algorithms are integrated and communicate data through a unified communication framework, resulting in low latency and high reliability. Through efficient and complete registration and / or asynchronous refresh and message buffering mechanisms, publish / subscribe relationships between services and algorithms can be established quickly, with low packet loss rate. It can also realize message communication between multiple SOCs, and the underlying communication link can be any hardware communication link.
[0103] The foregoing has described specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0104] Figure 11 This is a schematic diagram of a message sending device provided in one embodiment of this application. The message sending device is installed in an unmanned device, such as... Figure 11 As shown, the above-mentioned unmanned device includes a multi-process system 110, which may include a subscription node 1101, a publisher node 1102 and a message core 1103. The message core is implemented through shared memory and stores the relationship between the publisher node and the subscription node of each topic that has been registered in the multi-process system 110.
[0105] Publishing node 1102 is used to place published messages into a circular buffer queue in shared memory and update the write index of the circular buffer queue; wherein the shared memory is created by publishing node 1102 for publishing messages; the messages published by publishing node 1102 belong to the same topic; and to query the subscription node semaphore queue of publishing node 1102 and trigger the semaphore between publishing node 1102 and the target subscription node subscribing to the topic to which the above message belongs; wherein publishing node 1102 obtains information about the target subscription node 1101 subscribing to the topic to which the above message belongs from message core 1103;
[0106] The target subscriber node 1101 is used to locate the shared memory address of the message in the circular buffer queue based on the semaphore accumulation value of the target subscriber node 1101, read the message published by the publisher node 1102, and update the read index of the target subscriber node 1101 in the circular buffer queue.
[0107] Furthermore, the target subscription node 1101 is also used to notify the upper-layer application to process the received message after reading the message published by the publishing node 1102.
[0108] The publishing node 1102 is also used to create shared memory before placing the published message into the circular buffer queue of shared memory; and to register in the message core 1103, registering the topic published by the publishing node 1102 in the message core 1103, obtaining information from the message core 1103 about the target subscription node 1101 that has registered and subscribed to the topic in the multi-process system 110, creating a semaphore for asynchronous communication notification with the target subscription node 1101, and adding the semaphore to the subscription node semaphore queue of the publishing node 1102; and to obtain the agent to which the target subscription node 1101 that subscribes to the topic belongs through the message core 1103, and notify the target subscription node 1101 to update the information of the publishing node 1102 that published the topic message through the asynchronous notification refresher of the agent.
[0109] The target subscription node 1101 is also used to obtain information and semaphores for shared memory used to communicate with the publisher node 1102 from the information notified by the aforementioned asynchronous notification refresher, start an asynchronous message receiving thread, and wait to receive messages.
[0110] The target subscription node 1101 is also used to create a topic message thread pool before locating the shared memory address of the message from the circular buffer queue based on the semaphore accumulation value of the target subscription node 1101 and reading the message published by the publisher node 1102. This topic message thread pool is used to receive messages from the topics subscribed to by the target subscription node 1101; register in the message core 1103 and register the topics subscribed to by the target subscription node 1101 in the message core 1103; obtain information from the message core 1103 about publisher nodes 1102 that have registered and published the topics in the multi-process system 110; obtain the semaphore for communicating with publisher nodes 1102 from the information of publisher nodes 1102; start an asynchronous message receiving thread; wait to receive messages; and add the asynchronous message receiving thread to the thread pool of the target subscription node 1101; and obtain the agent to which the publisher node 1102 that published the topics belongs through the message core 1103, and notify the publisher node 1102 to update the information of the target subscription node 1101 that subscribed to the topics through the asynchronous notification refresher of the agent.
[0111] The publishing node 1102 is also used to obtain information about the target subscription node 1101 from the information notified by the asynchronous notification refresher, create a semaphore for communicating with the target subscription node 1101 based on the information of the target subscription node 1101, and add the semaphore for communicating with the target subscription node 1101 to the subscription node semaphore queue of the publishing node 1102.
[0112] In this embodiment, the publishing node 1102 is specifically used to retrieve the published message from the message queue corresponding to the above topic and write the message into a circular buffer queue in shared memory; wherein, the message queue corresponding to the above topic is created by the agent to which the publishing node 1102 belongs, and the message queues corresponding to different topics are different.
[0113] In one implementation, the multi-process system 110 can be deployed on a single SOC.
[0114] In another implementation, the multi-process system 110 can be deployed on at least two SOCs, each of the at least two SOCs including a platform bridge and a resource mapping tree; the aforementioned at least two chip-level systems include a first SOC and a second SOC;
[0115] The platform bridge of the first SOC is used to read the message after the publishing node of the first SOC publishes the message, select the underlying hardware link for transmitting the message through the resource mapping tree of the first SOC, and transmit the message to the second SOC through the underlying hardware link.
[0116] The platform bridge of the second SOC is used to receive the above message, publish the above message, and trigger the subscription nodes in the second SOC that subscribe to the topic to which the above message belongs to receive the above message.
[0117] Figure 11 The message sending apparatus provided in the illustrated embodiment can be used to execute this application. Figures 1-10 The implementation principle and technical effects of the method embodiment shown can be further referred to the relevant description in the method embodiment.
[0118] Figure 12 This is a schematic diagram of the structure of an unmanned device provided in one embodiment of this application, as shown below. Figure 12 As shown, the aforementioned unmanned device may include at least one processor; and at least one memory communicatively connected to the processor, wherein the memory stores program instructions executable by the processor, and the processor can execute this application by calling the program instructions. Figures 1-10 The illustrated embodiment provides a message sending method.
[0119] The aforementioned unmanned equipment can be a drone, and this embodiment does not limit the form of the aforementioned unmanned equipment.
[0120] Figure 12 A block diagram of an exemplary unmanned device suitable for implementing embodiments of this application is shown. Figure 12 The unmanned device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0121] like Figure 12 As shown, the unmanned device is presented in the form of a general-purpose computing device. The components of the unmanned device may include, but are not limited to: one or more processors 410, a communication interface 420, a memory 430, and a communication bus 440 connecting different components (including the memory 430, the communication interface 420, and the processor 410).
[0122] Communication bus 440 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, or a local bus using any of the various bus architectures. For example, communication bus 440 may include, but is not limited to, an industry standard architecture (ISA) bus, a micro channel architecture (MCA) bus, an enhanced ISA bus, a video electronics standards association (VESA) local bus, and a peripheral component interconnection (PCI) bus.
[0123] Unmanned devices typically include a variety of computer-readable media. These media can be any available media that can be accessed by the unmanned device, including volatile and non-volatile media, and movable and non-movable media.
[0124] Memory 430 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. Memory 430 may include at least one program product having a set (e.g., at least one) of program modules configured to execute this application. Figures 1-10 The functionality of the illustrated embodiment.
[0125] A program / utility having a set (at least one) of program modules can be stored in memory 430. Such program modules include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. The program modules typically execute the present application. Figures 1-10 The functions and / or methods described in the embodiments.
[0126] Processor 410 executes various functional applications and data processing by running programs stored in memory 430, such as implementing the present application. Figures 1-10 The illustrated embodiment provides a message sending method.
[0127] This application provides a non-transitory computer-readable storage medium that stores computer instructions, which cause the computer to execute this application. Figures 1-10 The illustrated embodiment provides a message sending method.
[0128] The aforementioned non-transitory computer-readable storage medium may be any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or flash memory, optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in connection with an instruction execution system, apparatus, or device.
[0129] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0130] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, radio frequency (RF), etc., or any suitable combination thereof.
[0131] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as "C" or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0132] The foregoing has described specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0133] In the description of this application, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this application, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in a suitable manner in any one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this application, as well as the features of different embodiments or examples.
[0134] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0135] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.
[0136] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0137] It should be noted that the terminals involved in the embodiments of this application may include, but are not limited to, personal computers (PCs), personal digital assistants (PDAs), wireless handheld devices, tablet computers, mobile phones, MP3 players, MP4 players, etc.
[0138] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0139] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.
[0140] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0141] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A message sending method, characterized in that, A multi-process system applied to unmanned equipment, the multi-process system including subscription nodes, publishing nodes, and a message core, the message core being implemented through shared memory, storing the relationships between publishing nodes and subscription nodes for each registered topic in the multi-process system, the method including: The publishing node places the published messages into a circular buffer queue in shared memory and updates the write index of the circular buffer queue; wherein, the shared memory is created by the publishing node for publishing messages; the messages published by the publishing node belong to the same topic; The publishing node queries its subscriber node semaphore queue and triggers a semaphore between the publishing node and the target subscriber node that subscribes to the topic to which the message belongs; wherein, the publishing node obtains information about the target subscriber node that subscribes to the topic to which the message belongs from the message core; The target subscriber node locates the shared memory address of the message in the circular buffer queue based on the accumulated semaphore value of the target subscriber node, reads the message published by the publisher node, and updates the read index of the target subscriber node in the circular buffer queue. Before the publishing node places the published message into the circular buffer queue in shared memory, the process also includes: The publishing node creates shared memory; The publishing node registers in the message core and registers the topics published by the publishing node in the message core. It obtains information about the target subscription nodes that have registered and subscribed to the topics in the multi-process system from the message core, creates a semaphore for asynchronous communication notification with the target subscription nodes, and adds the semaphore to the subscription node semaphore queue of the publishing node. The publishing node obtains the agent to which the target subscription node belongs by subscribing to the topic through the message core, and notifies the target subscription node to update the information of the publishing node publishing the topic through the asynchronous notification refresher of the agent; The target subscription node obtains the shared memory information and semaphore for communicating with the publishing node from the information notified by the asynchronous notification refresher, starts an asynchronous message receiving thread, and waits to receive messages.
2. The method according to claim 1, characterized in that, After reading the message published by the publishing node, the process also includes: The target subscription node will notify the upper-layer application of the received message for processing.
3. The method according to claim 1, characterized in that, Before the target subscribing node locates the shared memory address of the message in the circular buffer queue based on the target subscribing node's accumulated semaphore value, and reads the message published by the publishing node, the process further includes: The target subscription node creates a topic message thread pool; wherein, the topic message thread pool is used to receive messages from the topics subscribed to by the target subscription node; The target subscription node registers in the message core and registers the topics it subscribes to in the message core. It obtains information about the publishing nodes that have registered and published the topics in the multi-process system from the message core, obtains the semaphore for communicating with the publishing nodes from the information of the publishing nodes, starts an asynchronous message receiving thread, waits to receive messages, and adds the asynchronous message receiving thread to the thread pool of the target subscription node. The target subscription node obtains the agent to which the publishing node that publishes the topic belongs through the message core, and notifies the publishing node to update the information of the target subscription node that subscribes to the topic through the asynchronous notification refresher of the agent; The publishing node obtains the information of the target subscription node from the information notified by the asynchronous notification refresher, creates a semaphore for communicating with the target subscription node based on the information of the target subscription node, and adds the semaphore for communicating with the target subscription node to the subscription node semaphore queue of the publishing node.
4. The method according to claim 1, characterized in that, The publishing node places the published messages into a circular buffer queue in shared memory, including: The publishing node retrieves the published message from the message queue corresponding to the topic and writes the message into a circular buffer queue in shared memory; wherein, the message queue corresponding to the topic is created by the agent to which the publishing node belongs, and different topics correspond to different message queues.
5. The method according to any one of claims 1-4, characterized in that, The multi-process system is deployed on a chip-level system.
6. The method according to any one of claims 1-4, characterized in that, The multi-process system is deployed on at least two chip-level systems, and each of the at least two chip-level systems further includes a platform bridge and a resource mapping tree; the at least two chip-level systems include a first chip-level system and a second chip-level system. After the first chip-level system publishes a message at its publishing node, the platform bridge of the first chip-level system reads the message, selects the underlying hardware link for transmitting the message through the resource mapping tree of the first chip-level system, and transmits the message to the second chip-level system through the underlying hardware link. The platform bridge of the second chip-level system receives the message, publishes the message, and triggers the subscription nodes in the second chip-level system that have subscribed to the topic to which the message belongs to receive the message.
7. A message sending device, characterized in that, The system is set up in an unmanned device, which includes a multi-process system. The multi-process system includes subscription nodes, publishing nodes, and a message core. The message core is implemented through shared memory and stores the relationship between the publishing nodes and subscription nodes of each topic that have been registered in the multi-process system. The publishing node is used to place published messages into a circular buffer queue in shared memory and update the write index of the circular buffer queue; wherein the shared memory is created by the publishing node for publishing messages; the messages published by the publishing node belong to the same topic; and to query the subscription node semaphore queue of the publishing node and trigger the semaphore between the publishing node and the target subscription node subscribing to the topic to which the message belongs; wherein the publishing node obtains information about the target subscription node subscribing to the topic to which the message belongs from the message core; The target subscription node is configured to locate the shared memory address of the message in the circular buffer queue based on the accumulated semaphore value of the target subscription node, read the message published by the publishing node, and update the read index of the target subscription node in the circular buffer queue. The publishing node is further configured to: create shared memory before placing the published message into a circular buffer queue of shared memory; register in the message core and register the topic published by the publishing node in the message core; obtain information from the message core about target subscription nodes that have registered and subscribed to the topic in the multi-process system; create a semaphore for asynchronous communication notification with the target subscription node and add the semaphore to the publishing node's subscription node semaphore queue; obtain the agent to which the target subscription node to subscribe to the topic belongs through the message core, and notify the target subscription node to update the information of the publishing node that published the topic through the agent's asynchronous notification refresher; The target subscription node is also configured to obtain information and semaphores for shared memory used to communicate with the publishing node from the information notified by the asynchronous notification refresher, start an asynchronous message receiving thread, and wait to receive messages.
8. The apparatus according to claim 7, characterized in that, The target subscription node is also used to notify the upper-layer application to process the received message after reading the message published by the publishing node.
9. The apparatus according to claim 7, characterized in that, The target subscription node is further configured to create a topic message thread pool before locating the shared memory address of the message from the circular buffer queue based on the target subscription node's accumulated semaphore value and reading the message published by the publishing node; wherein, the topic message thread pool is configured to receive messages of the topics subscribed to by the target subscription node; register in the message core, and register the topics subscribed to by the target subscription node in the message core, obtain information from the message core about publishing nodes that have registered and published the topic in the multi-process system, obtain the semaphore for communicating with the publishing node from the information of the publishing node, start an asynchronous message receiving thread, wait to receive messages, and add the asynchronous message receiving thread to the thread pool of the target subscription node; and obtain the agent to which the publishing node that published the topic belongs through the message core, and notify the publishing node to update the information of the target subscription node subscribing to the topic through the asynchronous notification refresher of the agent; The publishing node is further configured to obtain information about the target subscription node from the information notified by the asynchronous notification refresher, create a semaphore for communicating with the target subscription node based on the information about the target subscription node, and add the semaphore for communicating with the target subscription node to the subscription node semaphore queue of the publishing node.
10. The apparatus according to claim 7, characterized in that, The publishing node is specifically used to retrieve the published message from the message queue corresponding to the topic and write the message into a circular buffer queue in shared memory; wherein, the message queue corresponding to the topic is created by the agent to which the publishing node belongs, and different topics correspond to different message queues.
11. The apparatus according to any one of claims 7-10, characterized in that, The multi-process system is deployed on a chip-level system.
12. The apparatus according to any one of claims 7-10, characterized in that, The multi-process system is deployed on at least two chip-level systems, and each of the at least two chip-level systems further includes a platform bridge and a resource mapping tree; the at least two chip-level systems include a first chip-level system and a second chip-level system. The platform bridge of the first chip-level system is used to read the message after the publishing node of the first chip-level system publishes the message, select the underlying hardware link for transmitting the message through the resource mapping tree of the first chip-level system, and transmit the message to the second chip-level system through the underlying hardware link. The platform bridge of the second chip-level system is used to receive the message, publish the message, and trigger the subscription nodes in the second chip-level system that subscribe to the topic to which the message belongs to receive the message.
13. An unmanned device, characterized in that, include: At least one processor; as well as At least one memory communicatively connected to the processor, wherein: The memory stores program instructions that can be executed by the processor, and the processor can execute the method as described in any one of claims 1 to 6 by calling the program instructions.
14. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores computer instructions that cause the computer to perform the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Systems and methods for inter-process communication within a robot
US10922154B1