Serial port communication system and method for upper computer and lower computer of mobile robot
Through direct memory access transmission and common format analysis, combined with ROS message bridge nodes, the problems of low efficiency, poor integrity and complex analysis in mobile robot communication are solved, and efficient and accurate data transmission and system integration are achieved to adapt to complex environments and multi-scenario needs.
Patent Information
- Application Number
- CN202510722755.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-05-30
AI Technical Summary
The communication methods of traditional mobile robots with low data transmission efficiency, difficult to guarantee data integrity, complex data analysis and error prone, and insufficient communication mode flexibility, especially in complex environments.
The data is analyzed using direct memory access transmission method and common format, combined with ROS message bridge nodes, data encapsulation, transmission and analysis are realized, efficient and accurate data transmission and analysis are supported, and the ROS system is seamlessly interfaced with the ROS system through bidirectional mapping to meet the real-time control and data interaction needs of mobile robots in complex environments.
It significantly improves data transmission efficiency, reduces system resource usage, ensures the accuracy and integrity of data transmission, simplifies data format processing, enhances system integration capabilities and multi-scenario adaptability, and supports data interaction requirements of different kinematic models.
Smart Images

Figure CN120602576A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of robot communication, and in particular relates to a mobile robot upper and lower computer serial port communication system and method. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] In mobile robot systems, communication between the upper and lower computers is crucial for ensuring the robot's normal operation. Traditional communication methods often suffer from low data transmission efficiency and difficulty ensuring data integrity, especially in complex environments.
[0004] The existing communication methods between upper and lower computers of mobile robots generally have the following problems: Low data transmission efficiency: Traditional methods rely on CPU interrupt processing, occupying a large amount of system resources and limiting transmission speed.
[0005] Data integrity is difficult to ensure: the lack of effective synchronization and verification mechanisms can easily lead to data misalignment, loss, or damage.
[0006] Data parsing is complex and error-prone: Traditional methods require complex type conversion and have low integration with the ROS system.
[0007] Insufficient flexibility in communication mode: It cannot flexibly support the computational requirements of the forward and inverse kinematics models of mobile robots. Summary of the Invention
[0008] To address the aforementioned issues, the present invention proposes a serial port communication system and method between a mobile robot's upper and lower computers. The system employs direct memory access (DMA) transmission, commons format data parsing, and seamless integration with the ROS system. This system enables efficient and accurate data transmission and parsing between the upper and lower computers, meeting the real-time control and data interaction requirements of mobile robots in complex environments.
[0009] According to some embodiments, the present invention adopts the following technical solutions: A mobile robot upper and lower computer serial port communication system includes an upper computer and a lower computer, one of which subscribes to messages and the other publishes messages. The upper computer and the lower computer both include a data encapsulation module, a data transmission module, and a data parsing module, wherein: The data encapsulation module is used to decompose the message data to be published into a byte array in a union format to form a message, and is embedded with a ROS message bridge node. The ROS message bridge node supports dynamic registration and automatically matches the message type with the serial port data frame format to map the serial port data into a ROS standard message; The data transmission module adopts a direct memory access transmission mode, allowing data to be directly transmitted between the memory and the peripheral device, and is used to transmit the data encapsulated by the data encapsulation module of the message publisher to the data parsing module of the message subscriber; The data parsing module uses the common format to analyze the received message and parse out the accurate data. It is embedded with a ROS message bridge node, which automatically matches the message type and serial port data frame format of the received ROS standard message, and maps the ROS message back to the serial port data to achieve two-way mapping of data.
[0010] As an optional implementation, the data packaging module decomposes the decimal data into a binary byte array using a union format.
[0011] As an optional implementation, the message includes a first data header, a second data header, a length bit, a data bit, a topic bit, a control bit, a check bit, a first data tail and a second data tail, wherein: the first data header and the second data header are specified information, the length bit is used to indicate the length of valid data in the data segment, the topic bit is used to identify the ROS topic to which the data belongs, the control bit has a reserved byte for extension, the check bit is a sum operation of the length bit to the control bit, and the first data tail and the second data tail are specified information; The data bits include a stop bit, a sign bit, and a value bit. The stop bit is used to indicate whether the control data is sent or received. The sign bit is used to indicate the positive or negative value of the data. The value bit includes two bytes of data, with the high eight bits in front and the low eight bits in the back.
[0012] As an optional implementation, the data transmission module is used to send the data generated by the data packaging module of the upper computer to the data parsing module of the lower computer, or to transmit the data generated by the data packaging module of the lower computer to the data parsing module of the upper computer, and introduce a ring buffer with a shared memory, and the parsed data can be directly written into the ring buffer.
[0013] As a further embodiment, the ROS message bridge node references data in a ring buffer of a shared memory through a pointer.
[0014] As an optional implementation, the host computer further includes a ROS bridge module for communicating with other communication devices.
[0015] The communication method based on the above system includes the following steps in the upper computer subscription and lower computer publishing mode: The lower computer reads the data of the angle and speed sensors; The data encapsulation module of the lower computer converts the transmitted data into a message using a common format and encapsulates each data frame of the message; and the ROS message bridge node embedded in the data encapsulation module maps the serial port data into ROS standard messages; The data transmission module of the lower computer sends the mapped ROS standard message to the upper computer; The data parsing module of the upper computer receives message information and ROS standard messages from the lower computer. The ROS message bridge node automatically matches the message type and serial port data frame format according to the topic bit of the message, and maps the ROS standard message back to the serial port data. It analyzes the message information of each frame, determines the integrity of the data from the data head to the data tail, extracts the data bits, and converts the message data into accurate sensor data.
[0016] As an optional implementation, the host computer may also use a ROS bridge module to perform forward kinematics calculations on the speed and angle to obtain the mileage, and publish the mileage through a ROS topic.
[0017] As an optional implementation, after the lower computer reads the data from the angle and speed sensors, it directly writes the data into the ring buffer of the shared memory.
[0018] Based on the communication method of the above system, in the mode where the upper computer publishes and the lower computer subscribes, the following steps are included: The host computer performs inverse kinematics and subscribes to the speed topic; The host computer uses the data encapsulation module to convert the speed topic message subscribed by ROS into message data through the common format and encapsulate each data frame; the ROS message bridge node embedded in the data encapsulation module maps the encapsulated serial port data into ROS standard messages; The data transmission module sends the mapped ROS standard message to the lower computer; The data parsing module of the lower computer embeds a ROS standard message bridge node, which receives ROS standard messages from the upper computer, automatically matches the message type with the serial port data frame format, and maps the ROS standard message back to the serial port data. The data parsing module analyzes the message information of each frame, determines the integrity of the data from the data header to the data tail, extracts the data bits, and converts the message data into accurate sensor data. The lower computer adjusts the speed according to the parsed data.
[0019] As an optional implementation, the data parsing module verifies data integrity before analyzing the message and then extracts the data bits.
[0020] Compared with the prior art, the present invention has the following beneficial effects: The present invention adopts DMA transmission mode to realize direct data transmission between memory and peripherals without CPU participation, significantly reducing system resource usage and significantly improving data transmission efficiency. For high-frequency sensor data and control instructions, a zero-copy mechanism of shared memory ring buffer based on boost::circular_buffer is introduced. Lower computer data is directly written into the buffer, and ROS nodes reference data through pointers, avoiding repeated memory copying between traditional byte streams and ROS messages, further improving the efficiency of real-time data interaction.
[0021] The present invention realizes data synchronization verification through the frame structure design of double data headers, check bits (sum check of length bits to control bits) and data tail; combined with the integrity judgment logic of the data analysis module, it effectively reduces the risk of data misalignment, loss or damage, and ensures the accuracy and integrity of transmitted data.
[0022] The present invention uses the union format for data packaging and parsing, directly realizing the type conversion between decimal data and binary byte streams, avoiding complex data format processing; embedding the ROS message bridge node, supporting two-way dynamic mapping between serial port data and ROS standard messages, automatically matching message types with serial port data frame formats, reducing the complexity and error rate of manual parsing.
[0023] The data encapsulation and parsing module of the present invention seamlessly interfaces with the ROS system, supports dynamic registration and bidirectional mapping of ROS standard messages, can directly convert sensor data into ROS topic messages or parse ROS messages into control instructions, is highly adaptable to the ROS ecosystem, and facilitates rapid integration with navigation, planning and other modules, thereby improving system collaboration efficiency and enhancing system integration capabilities.
[0024] The communication method of the present invention includes two communication modes: the upper computer subscribes to the lower computer's publication (forward kinematics model) and the lower computer subscribes to the upper computer's publication (inverse kinematics model). The ROS title is represented by the topic bit to achieve intelligent data distribution. Combined with the dynamic adaptability of the bridge node, it flexibly meets the data interaction needs of the mobile robot in the calculation of different kinematic models, enhancing the system's scalability and multi-scenario adaptability.
[0025] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0027] Figure 1A structural diagram of a communication system between a mobile robot and an upper and lower computer in one embodiment; Figure 2 A data communication protocol for communication between a mobile robot and its upper and lower computers in an embodiment; Figure 3 A flowchart of the communication between the upper and lower computers of a mobile robot in an embodiment of the present invention; Figure 4 This is a flow chart of the upper computer sending and lower computer receiving in the communication between the upper and lower computers of a mobile robot in one embodiment. DETAILED DESCRIPTION
[0028] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0029] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs.
[0030] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.
[0031] In the absence of conflict, the embodiments and features in the embodiments of this application can be combined with each other.
[0032] As mentioned in the background, traditional serial communication protocols for mobile robotics lack unified synchronization and verification mechanisms in their data frame structures. This makes data prone to misalignment, loss, or corruption during transmission, impacting the robot's control accuracy and stability. Traditional data transmission methods often rely on CPU interrupt processing, which consumes significant CPU resources when dealing with large amounts of data, resulting in reduced system real-time performance and an inability to meet the mobile robot's demand for high-speed data exchange. Furthermore, data parsing often requires complex type conversion and data reorganization, which can easily introduce parsing errors. Furthermore, the low level of integration with the ROS system makes it difficult to efficiently convert sensor data into ROS topic messages for processing. Traditional upper and lower computer communication models have limitations in supporting the calculation of forward and inverse kinematic models for mobile robots, and lack flexibility in adapting to diverse control scenarios, resulting in poor system scalability and adaptability.
[0033] To solve the above problems, the present invention provides a communication system between a host and a host computer based on a ROS mobile robot.
[0034] To make the solution of the present application more clear to those skilled in the art, the following glossary is first provided: ROS: Robot Operating System, a framework for writing robotics software that supports distributed processing, message passing, and hardware abstraction.
[0035] DMA transfer: Direct Memory Access allows data to be transferred directly between peripherals and memory without CPU intervention, thus improving transfer efficiency. Union format: A data structure that allows multiple variables of different types to share the same memory space. It is often used for data packaging and parsing to reduce memory usage.
[0036] Forward kinematics model: A mathematical model that calculates the position and posture of the end effector based on the robot's joint angles, used for pose estimation.
[0037] Inverse kinematics model: A mathematical model that solves joint angles based on the end effector's target position and posture, used for path planning and control.
[0038] A communication system between upper and lower computers based on ROS mobile robot, such as Figure 1 As shown, it includes a host computer and a slave computer, one of which subscribes to messages and the other publishes messages. The host computer and the slave computer both include a data encapsulation module, a data transmission module and a data parsing module, wherein: The data encapsulation module is used to decompose the message data to be published into a byte array in a union format to form a message, and is embedded with a ROS message bridge node. The ROS message bridge node supports dynamic registration and automatically matches the message type with the serial port data frame format to map the serial port data into a ROS standard message; The data transmission module adopts a direct memory access transmission mode, allowing data to be directly transmitted between the memory and the peripheral device, and is used to transmit the data encapsulated by the data encapsulation module of the message publisher to the data parsing module of the message subscriber; The data parsing module uses the common format to analyze the received message and parse out the accurate data. It is embedded with a ROS message bridge node, which automatically matches the message type and serial port data frame format of the received ROS standard message, and maps the ROS message back to the serial port data to achieve two-way mapping of data.
[0039] The message involved in this embodiment, or the serial communication protocol, includes a data header 1, a data header 2, a length bit, a data bit, a topic bit, a control bit, a check bit, a data tail 1 and a data tail 2, wherein the data bits include a stop bit, a sign bit and a value bit.
[0040] The message length of each frame of the communication message needs to determine the number of bytes according to the length bit. Now take the message with the length bit of 0x01 as an example to explain in detail. Figure 2 As shown, where: Data header 1: Byte 0, always 0x55; Data header 2: Byte 1, always 0xAA; Length bit: Byte2, the length of the valid data in the data segment; Data bits: Byte3~Byte6, which are the stop bit, sign bit, and value bit in the data segment; Topic bit: Byte 7, used to identify the ROS topic to which the data belongs (e.g. 0x01 corresponds to / odom, 0x02 corresponds to / cmd_vel). When the lower computer parses the data, it distributes the data to the corresponding processing module based on this field; Control bit: Byte8, default 0x00, one byte is reserved for user to expand functions; Check bit: Byte9, the sum of the length bit to the control bit, taking the lower eight bits; Data tail 1: Byte 10, always 0x0D; Data tail 2: Byte 11, always 0x0A.
[0041] For data bits: Stop bit: Byte3, controls whether data is sent or received; Sign bit: Byte4, the positive or negative value of the data; Numerical bits: Byte5, Byte6, are two-byte data, with the high eight bits in front and the low eight bits in the back.
[0042] The data packet module is used to decompose decimal data into binary byte arrays using a union format. A ROS message bridge node is embedded in the data packet module. This node, based on the roscpp Publisher / Subscriber interface, enables bidirectional mapping between serial port data and ROS standard messages (such as geometry_msgs / Twist and nav_msgs / Odometry). It also supports dynamic registration and automatically matches message types to serial port data frame formats.
[0043] The data transmission module is used to send data generated by the host computer's data packet module or the slave computer's data packet module to the slave computer's data parsing module or the host computer's data parsing module. The slave computer uses DMA transmission, allowing data to be transferred directly between memory and peripherals without CPU involvement, improving data transmission efficiency.
[0044] In this embodiment, a zero-copy transmission mechanism is adopted for high-frequency sensor data (such as angle and speed) and control instructions, and a shared memory ring buffer (implemented using boost::circular_buffer) is introduced. The sensor data parsed by the lower computer can be directly written into the buffer.
[0045] The data parsing module uses a union format to parse binary byte arrays into accurate data. It also embeds the aforementioned ROS message bridge node to enable bidirectional data mapping. The host computer's data parsing module interfaces with the ROS system, converting data into ROS topic messages for subscription and publishing.
[0046] ROS nodes reference data in the shared memory ring buffer through pointers, avoiding repeated memory copying between traditional byte streams and ROS messages.
[0047] This implementation embeds ROS message bridge nodes in both the data encapsulation module and the parsing module. Based on the roscpp Publisher / Subscriber interface, this implements bidirectional mapping between serial port data and ROS standard messages (such as geometry_msgs / Twist and nav_msgs / Odometry). The bridge node supports dynamic registration and automatically matches message types to serial port data frame formats.
[0048] Example 2 A communication method between an upper and lower computer based on a ROS mobile robot adopts the upper and lower computer system provided in the first embodiment, and is divided into two parts: the upper computer subscribes to the lower computer's publication and the lower computer subscribes to the upper computer's publication.
[0049] When determining the forward kinematic model of the position and posture of a mobile robot in space, it is necessary to use a mode in which the upper computer subscribes to the data published by the lower computer, such as Figure 3 As shown, the steps are as follows: Step 1: The lower computer reads the data from the angle and velocity sensors. For high-frequency angle and velocity sensor data, a shared memory circular buffer (implemented using boost::circular_buffer) is introduced. The sensor data parsed by the lower computer is directly written to the buffer, avoiding repeated memory copying between traditional byte streams and ROS messages.
[0050] Step 2: Use the data encapsulation module to convert the transmitted data into a binary byte stream using a common format, and encapsulate the data frame including the data header, topic bit, check bit, and data tail.
[0051] Step 3. Embed a ROS message bridge node in the data encapsulation module. Based on the roscpp Publisher interface, map the serial port data to ROS standard messages. The bridge node supports dynamic registration and can automatically match the message type with the serial port data frame format. Use the data transmission module to send the mapped ROS message to the host computer.
[0052] Step 4. Embed a ROS message bridge node in the data parsing module. Based on the Subscriber interface of roscpp, it receives ROS standard messages from the lower computer. The bridge node automatically matches the message type and serial port data frame format according to the topic bit and maps the ROS message back to the serial port data. The data parsing module analyzes the message information of each frame, determines the integrity of the data from the data header to the data tail, and then extracts the data bits to convert the binary byte stream data into accurate sensor data.
[0053] Step 5: The mobile robot uses the ROS interaction module to perform forward kinematics on the speed and angle, calculates the odometer, and then publishes it through the ROS topic.
[0054] Another embodiment is provided, which is the communication between the upper and lower computers in the forward kinematics model calculation: The following steps are involved: Lower computer data reading and packaging: The lower computer reads the angle and speed data through the sensor.
[0055] Use the data packaging module to encapsulate the read data according to the serial communication protocol, including adding a data header, length bit, data bit (including stop bit, sign bit, value bit), control bit, check bit and data tail.
[0056] Data transmission: The lower computer sends the encapsulated data frame to the upper computer through DMA transmission.
[0057] Host computer data analysis and ROS release: After the host computer receives the data, it embeds a ROS message bridge node in the data parsing module and maps the ROS message back to serial port data based on the roscpp Subscriber interface. The data parsing module is used to analyze the message, verify the data integrity, and extract the data bits.
[0058] The extracted data is converted into decimal form and the forward kinematics calculation is performed through the ROS interaction module to obtain the odometry information of the mobile robot.
[0059] Publish the odometer information through the ROS topic for other nodes to subscribe to.
[0060] When a mobile robot solves the inverse kinematics model of each wheel's velocity based on its position and posture, it is necessary to use a mode where the upper computer publishes and the lower computer subscribes, such as Figure 4 As shown, the steps are as follows: Step 1: The host computer performs inverse kinematics based on the ROS interaction module and subscribes to the velocity topic.
[0061] Step 2: The host computer uses the data encapsulation module to convert the ROS subscribed speed topic message into a binary byte stream in the union format, and then encapsulates the data frame including the data header, check digit, and data tail. A ROS message bridge node is embedded in the data encapsulation module. Based on the roscpp Publisher interface, the encapsulated serial port data is mapped into a ROS standard message. The bridge node supports dynamic registration and can automatically match the message type with the serial port data frame format.
[0062] Step 3: Use the data transmission module to send the mapped ROS message to the lower computer.
[0063] Step 4. Embed a ROS message bridge node in the data parsing module. Based on the Subscriber interface of roscpp, it receives ROS standard messages from the host computer. The bridge node automatically matches the message type with the serial port data frame format and maps the ROS message back to the serial port data. The lower computer data parsing module analyzes the message information of each frame, determines the integrity of the data from the data header to the data tail, and then extracts the data bits to convert the binary byte stream data into accurate sensor data.
[0064] Step 5: The lower computer adjusts the speed according to the parsed data.
[0065] In another embodiment, communication between upper and lower computers in solving an inverse kinematics model includes the following steps: Host computer ROS subscription and data packaging: The host computer subscribes to the speed topic through the ROS interaction module to obtain the target speed information.
[0066] The target speed information is encapsulated using the data encapsulation module according to the serial communication protocol, including the addition of a header, length bit, data bits (including stop bit, sign bit, and value bit), topic bit, control bit, parity bit, and a tail. A ROS message bridge node is embedded in the data encapsulation module, mapping the serial data into standard ROS messages based on the roscpp Publisher interface.
[0067] Data transmission: The upper computer sends the encapsulated data frame to the lower computer.
[0068] Lower computer data analysis and speed adjustment: After receiving the data, the lower computer embeds a ROS message bridge node in the data parsing module and maps the ROS message back to serial port data based on the roscpp Subscriber interface. The data parsing module is used to analyze the message, verify the data integrity, and extract the data bits.
[0069] The extracted data is converted into decimal form, and the speed of each wheel is adjusted according to the parsed data to realize the inverse kinematic control of the mobile robot.
[0070] As a typical example, the serial port data segment is represented by hexadecimal, and every two digits are a byte. Assume that the data sent has three digits, the first digit is the angle 103 degrees, the second digit is the speed of the first wheel -199 cm / s, and the third digit is the speed of the second wheel 186 cm / s. The topic bit is / cmd_vel, then the data segment is as follows: Figure 2 The following example shows 55AA0301010067010000C7010100BA0200F00D0A, which converts to hexadecimal as 0x55, 0xAA, 0x03, 0x01, 0x01, 0x00, 0x67, 0x01, 0x00, 0x00, 0xC7, 0x01, 0x01, 0x00, 0xBA, 0x02, 0x00, 0xF2, 0x0D, 0x0A. The check digit is the sum of the length bits to 0x03 and the control bit 0x02, which is 0x1F2. The lower eight bits are taken and 0xF2.
[0071] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of one or more computer-usable storage media (including but not limited to disk storage, CD - ROM , optical storage, etc.).
[0072] 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 flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing 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 flowcharts and / or block diagrams. 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.
[0073] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work 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 The function specified in one or more boxes.
[0074] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0075] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made by those skilled in the art that fall within the spirit and principles of the present invention and do not require creative effort are intended to be within the scope of protection of the present invention.
Claims
1. A mobile robot upper and lower computer serial port communication system, characterized by: It includes a host computer and a slave computer, one of which subscribes to messages and the other publishes messages. Both the host computer and the slave computer include a data encapsulation module, a data transmission module and a data parsing module, wherein: The data encapsulation module is used to decompose the message data to be published into a byte array in a union format to form a message, and is embedded with a ROS message bridge node. The ROS message bridge node supports dynamic registration and automatically matches the message type with the serial port data frame format to map the serial port data into a ROS standard message; The data transmission module adopts a direct memory access transmission mode, allowing data to be directly transmitted between the memory and the peripheral device, and is used to transmit the data encapsulated by the data encapsulation module of the message publisher to the data parsing module of the message subscriber; The data parsing module uses the common format to analyze the received message and parse out the accurate data. It is embedded with a ROS message bridge node, which automatically matches the message type and serial port data frame format of the received ROS standard message, and maps the ROS message back to the serial port data to achieve two-way mapping of data.
2. A mobile robot and upper and lower computer serial communication system as claimed in claim 1, characterized in that: The data packaging module decomposes the decimal data into a binary byte array using a union format.
3. A mobile robot upper and lower computer serial communication system as claimed in claim 1, characterized in that: The message includes a first data header, a second data header, a length bit, a data bit, a topic bit, a control bit, a check bit, a first data tail and a second data tail, wherein: the first data header and the second data header are specified information, the length bit is used to indicate the length of valid data in the data segment, the topic bit is used to identify the ROS topic to which the data belongs, the control bit has a reserved byte for extension, the check bit is a sum operation of the length bit to the control bit, and the first data tail and the second data tail are specified information; The data bits include a stop bit, a sign bit, and a value bit. The stop bit is used to indicate whether the control data is sent or received. The sign bit is used to indicate the positive or negative value of the data. The value bit includes two bytes of data, with the high eight bits in front and the low eight bits in the back.
4. A mobile robot and upper and lower computer serial communication system as claimed in claim 1, characterized in that: The data transmission module is used to transmit the data generated by the data packaging module of the upper computer to the data parsing module of the lower computer, or transmit the data generated by the data packaging module of the lower computer to the data parsing module of the upper computer, and introduce a ring buffer with a shared memory, and the parsed data can be directly written into the ring buffer.
5. A mobile robot upper and lower computer serial communication system as claimed in claim 1 or 4, characterized in that: The ROS message bridge node references the data in the shared memory ring buffer through a pointer.
6. A mobile robot and upper and lower computer serial communication system as claimed in claim 1, characterized in that: The host computer also includes a ROS bridge module for communicating with other communication devices.
7. A communication method based on the system of any one of claims 1 to 6, wherein in a mode where the upper computer subscribes to the lower computer and publishes, the method is characterized in that: The following steps are involved: The lower computer reads the data of the angle and speed sensors; The data encapsulation module of the lower computer converts the transmitted data into a message using a common format and encapsulates each data frame of the message; and the ROS message bridge node embedded in the data encapsulation module maps the serial port data into ROS standard messages; The data transmission module of the lower computer sends the mapped ROS standard message to the upper computer; The data parsing module of the upper computer receives message information and ROS standard messages from the lower computer. The ROS message bridge node automatically matches the message type and serial port data frame format according to the topic bit of the message, and maps the ROS standard message back to the serial port data. It analyzes the message information of each frame, determines the integrity of the data from the data head to the data tail, extracts the data bits, and converts the message data into accurate sensor data.
8. The method according to claim 7, wherein: include: The host computer uses the ROS bridge module to perform forward kinematic calculations on the speed and angle to obtain the mileage, which is then published through a ROS topic. Alternatively, the lower computer reads the data from the angle and speed sensors and directly writes them into the ring buffer of the shared memory.
9. A communication method based on the system of any one of claims 1 to 6, wherein in a mode where the upper computer publishes and the lower computer subscribes, the method is characterized in that: The following steps are involved: The host computer performs inverse kinematics and subscribes to the speed topic; The host computer uses the data packaging module to convert the speed topic message subscribed by ROS into message data through the common format and encapsulate each data frame; The ROS message bridge node embedded in the data encapsulation module maps the encapsulated serial port data into ROS standard messages; The data transmission module sends the mapped ROS standard message to the lower computer; The data parsing module of the lower computer is embedded with a ROS standard message bridge node, which receives ROS standard messages from the upper computer, automatically matches the message type with the serial port data frame format, and maps the ROS standard message back to the serial port data; The data parsing module analyzes the message information of each frame, determines the integrity of the data from the data head to the data tail, extracts the data bits, and converts the message data into accurate sensor data; The lower computer adjusts the speed according to the parsed data.
10. The method according to claim 7, 8 or 9, wherein: Before analyzing the message, the data parsing module first verifies the data integrity and then extracts the data bits.
Citation Information
Patent Citations
Bridging module for communication between room control terminal and upper computer and method thereof
CN103744365A
Serial port communication method, device, storage medium and computer equipment
CN112835838A
Bridging tool for connecting IROS and ROS and method for realizing communication
CN115941765A
Self-adaptive hybrid communication method and device of robot, medium and equipment
CN116954952A
HIL simulation method for underground mining whole process
CN119129241A