CN113535437A - Module data interaction method of robot, electronic equipment and storage medium - Google Patents

Module data interaction method of robot, electronic equipment and storage medium Download PDF

Info

Publication number
CN113535437A
CN113535437A CN202110885307.4A CN202110885307A CN113535437A CN 113535437 A CN113535437 A CN 113535437A CN 202110885307 A CN202110885307 A CN 202110885307A CN 113535437 A CN113535437 A CN 113535437A
Authority
CN
China
Prior art keywords
data
processed
module
read
shared memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110885307.4A
Other languages
Chinese (zh)
Other versions
CN113535437B (en
Inventor
李明洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Jaka Robotics Ltd
Original Assignee
Shanghai Jaka Robotics Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Jaka Robotics Ltd filed Critical Shanghai Jaka Robotics Ltd
Priority to CN202110885307.4A priority Critical patent/CN113535437B/en
Publication of CN113535437A publication Critical patent/CN113535437A/en
Application granted granted Critical
Publication of CN113535437B publication Critical patent/CN113535437B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a module data interaction method of a robot, electronic equipment and a storage medium. The robot includes a first module and a second module, the method including: receiving a data processing request through a first module; acquiring corresponding data to be processed and a read-write lock corresponding to the data to be processed according to the data processing request through a first module, and writing the data to be processed into a corresponding shared memory according to the read-write lock; and reading the data to be processed from the shared memory through the second module according to the read-write lock so as to realize data interaction among the modules. The read-write operation of the data to be processed is completed through the shared memory and the read-write lock, so that the data interaction among multiple modules of the robot is realized, the transmission delay in the data interaction process is reduced, and the real-time performance of the system is improved.

Description

Module data interaction method of robot, electronic equipment and storage medium
Technical Field
The application relates to the technical field of computer software, in particular to a module data interaction method of a robot, electronic equipment and a storage medium.
Background
Nowadays, robots are more and more widely applied in the whole society field, the robots need to complete data interaction with more sensors in the process of realizing functions, the real-time performance of the data interaction is related to the safety response speed of the system, and the real-time performance of the data interaction between modules is very important along with the more and more abundant system functions of the robots.
In order to solve the above problems, a module interaction method adopted by a robot at present is based on a data distribution service DDS framework adopted in a robot system ROS2, and the DDS adopts a socket technology in a data interaction mode, so that a communication process of a socket loopback (socket loopback) interface cannot be avoided, a large number of kernel protocol stacks are required to process in the communication process, a large amount of time is wasted, and the DDS has a great influence on a real-time interaction scene of multi-module data of the robot system.
Disclosure of Invention
An object of the embodiments of the present application is to provide a module data interaction method for a robot, an electronic device, and a storage medium, so as to reduce a real-time interactive transmission delay of data between modules.
In a first aspect, an embodiment of the present application provides a module data interaction method for a robot, where the robot includes a first module and a second module, the method includes: receiving, by the first module, a data processing request; acquiring corresponding data to be processed and a read-write lock corresponding to the data to be processed according to the data processing request through the first module, and writing the data to be processed into a corresponding shared memory according to the read-write lock; and reading the data to be processed from the shared memory through the second module according to the read-write lock so as to realize data interaction among the modules.
In the embodiment of the application, as the shared memory can realize convenient and fast data communication between processes, synchronous operation of data to be operated can be realized by using the read-write lock, the data to be processed is written into the shared memory and is matched with the read-write lock corresponding to the data to be operated, data interaction is realized, the real-time performance of a system can be improved, the time waste of a kernel processing stack in the interaction process is avoided, and the real-time interaction transmission delay of the data is reduced.
Further, the writing the data to be processed into the corresponding shared memory according to the read-write lock includes: writing the plurality of sub data blocks into corresponding shared memories through the first module according to the data block read-write locks corresponding to the plurality of sub data blocks; correspondingly, the reading, by the second module, the to-be-processed data from the shared memory according to the read-write lock includes: and respectively reading the plurality of sub data blocks from the shared memory through the second module according to the data block read-write locks corresponding to the plurality of sub data blocks.
In the embodiment of the application, the data to be processed is divided into a plurality of sub data blocks, each sub data block corresponds to one data block read-write lock, the reliability in the data interaction process is ensured by the way of dividing the data to be operated into blocks, the data interaction efficiency is increased, and the problem that the whole data to be operated needs to be re-operated due to errors in the writing and reading processes is avoided.
Further, the data type of the data to be processed is data reading and writing or process calling.
According to the embodiment of the application, the data types of the data to be processed are divided into data reading and writing and process calling, two different data types are processed respectively, and the data are processed in the form of data blocks in the writing and reading processes, so that the data interaction is conveniently and uniformly processed.
Further, if the data type of the data to be processed is a process call; the storing the data to be processed into a shared memory according to the read-write lock includes: acquiring a read-write lock corresponding to the data to be processed through the first module, and locking the data to be processed; respectively writing the data to be processed into a shared memory through the first module; releasing a read-write lock corresponding to the data to be processed through the first module; correspondingly, the reading, by the second module, the to-be-processed data from the shared memory according to the read-write lock includes: acquiring a read-write lock corresponding to the data to be processed through the second module, and locking the data to be processed; and reading the data to be processed from the shared memory through the second module, and executing a calling process by using the data to be processed.
In the embodiment of the application, when the data type of the data to be processed is process calling, the data to be processed is locked by the first module and then written into the shared memory, it is ensured that only the first module writes the data to be processed in the writing process, then the read-write lock is released, then the data to be processed is locked by the second module and is read from the shared memory, the calling process is executed by using the data to be processed, and the consistency of the data reading and writing process is ensured by operating the data to be processed through the read-write lock.
Further, the data to be processed includes a plurality of service data, each of the service data includes a type, a service status, a parameter, and a return value, and the executing a calling process using the data to be processed includes: respectively completing the calling process of the corresponding service according to the type and the parameter in each service data through the second module; changing the state and the return value of the corresponding service according to the calling result of each service through the second module; and releasing the read-write lock corresponding to the data to be processed through the second module.
In the embodiment of the application, the second module completes the calling process of the corresponding service according to the type and the parameter in each service data, changes the state and the return value of the corresponding service according to the calling result of each service, and finally releases the read-write lock to realize the calling process of a plurality of service data in the data to be processed.
Further, the method further comprises: dividing a shared memory area in advance to obtain a first shared memory and a second shared memory; the first shared memory is used for data reading and writing, and the second shared memory is used for process calling.
According to the embodiment of the application, the shared memory area is divided in advance to obtain the first shared memory and the second shared memory which are respectively used for data reading and writing or process calling, so that the operation in different shared memory areas according to the data type of the data to be processed is realized, and the efficient processing of the data to be processed is favorably realized.
Further, the method further comprises: the robot acquires the latest data of a remote end through a reliable datagram protocol (RUDP), and updates the local data of the robot according to the latest data to obtain the latest data.
In the embodiment of the application, the robot acquires the latest data of the remote end through the reliable datagram protocol RUDP and updates the latest data into the local data of the robot, and the latest data of the remote end is transmitted to the local end by using the RUDP protocol, so that the real-time performance and the reliability of remote data transmission are improved.
Further, the robot transmits local data to the remote end through a reliable datagram protocol RUDP so as to realize the updating of the data of the remote end.
In the embodiment of the application, the robot transmits the local data to the remote end through the reliable datagram protocol RUDP, so that the real-time display of the remote data is realized, and the real-time performance and the reliability of the remote data transmission are improved.
In a second aspect, an embodiment of the present application provides an electronic device, including: the system comprises a processor, a memory and a bus, wherein the processor and the memory complete mutual interaction through the bus;
the memory stores program instructions executable by the processor, the processor being capable of performing the method of the first aspect when invoked by the program instructions.
In a third aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium, including:
the non-transitory computer readable storage medium stores computer instructions that cause the computer to perform the method of the first aspect.
Additional features and advantages of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic flowchart of a method for interacting module data of a robot according to an embodiment of the present disclosure;
fig. 2 is a schematic process call flow diagram of a robot according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a module interaction component structure of a robot according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
Fig. 1 is a schematic flow chart of a method for module data interaction of a robot according to an embodiment of the present disclosure, and as shown in fig. 1, the method may be applied to module data interaction of various robots, where a robot is a machine capable of performing tasks such as many operations or movements through programming and automatic control, and may assist or even replace human beings to complete dangerous, heavy, and complex work, improve work efficiency and quality, and expand or extend the range of activities and abilities of human beings; the robot can be various industrial robots, service and humanoid robots. The robot is divided into a plurality of modules according to functions, and in the data interaction process, the module data interaction in the embodiment of the application can be understood as that the processes of the modules operate data to realize the data interaction among the modules. The robot includes a first module and a second module, the method including:
step 101: a data processing request is received by the first module.
In a specific implementation process, the first module is any functional module of the robot, and is capable of receiving a data processing request and performing a next operation according to the data processing request, where the data processing request may be an instruction transmitted by a remote end or a preset instruction in the robot, and the instruction may be update data, transmission data, and the like.
Step 102: and acquiring corresponding data to be processed and a read-write lock corresponding to the data to be processed according to the data processing request through the first module, and writing the data to be processed into a corresponding shared memory according to the read-write lock.
In a specific implementation process, the data to be processed is stored in a fixed position in the local disk, the fixed position represents a physical address of the data to be processed, and the operations of writing in and reading out the shared memory can be realized by mapping the physical address of the data to be processed and a virtual address of the shared memory. Because there may be a plurality of modules operating on the data to be processed at the same time, before the data to be processed is written in, a read-write lock corresponding to the data to be processed needs to be acquired, and the data to be processed can be written in and read from by acquiring the read-write lock of the data to be processed.
Taking a first module as a control module, taking data to be processed as data acquired by a sensor in real time as an example, the control module is used for writing the data acquired by the sensor into a local disk file, and using a shared memory to realize writing operation.
Step 103: and reading the data to be processed from the shared memory through the second module according to the read-write lock so as to realize data interaction among the modules.
In a specific implementation process, the second module is a functional module different from the first module in the robot, after the second module acquires a read-write lock of the data to be processed, the data to be processed is locked, because the second module executes a read operation, other modules can be allowed to read the data to be processed but not allowed to execute a write operation on the data to be processed at the same time according to a mechanism of the read-write lock, the second module reads the data to be operated from the corresponding shared memory, and after the read operation is completed, the read-write lock corresponding to the data to be operated is released. For example: the second module is a calculation module and is used for reading the sensor data written in by the first module to calculate the coordinate position of the robot, the second module acquires the sensor data written in the shared memory and the corresponding read-write lock, locks the data and ensures that other modules do not change the data, and the second module reads the data in the shared memory area for calculation and releases the read-write lock corresponding to the data after reading is completed.
On the basis of the above embodiment, the writing the data to be processed into the corresponding shared memory according to the read-write lock includes:
writing the plurality of sub data blocks into corresponding shared memories through the first module according to the data block read-write locks corresponding to the plurality of sub data blocks;
correspondingly, the reading, by the second module, the to-be-processed data from the shared memory according to the read-write lock includes:
and respectively reading the plurality of sub data blocks from the shared memory through the second module according to the data block read-write locks corresponding to the plurality of sub data blocks.
In a specific implementation manner, the data to be processed is divided into a plurality of sub data blocks to be stored, each sub data block corresponds to one data block read/write lock, the first module writes the plurality of sub data blocks into the corresponding shared memory according to the data block read/write lock corresponding to each sub data block, and correspondingly, the second module reads the data from the corresponding shared memory according to the data block read/write lock corresponding to each sub data block. And each divided subdata block is identified by an index number, and the first module and the second module write in and read the whole data to be processed according to the index number. It can be understood that each sub data block corresponds to a data block read-write lock, and only the module that obtains the corresponding data block read-write lock can operate the sub data block, and after the operation is completed, the corresponding data block read-write lock is released to allow the next module to obtain the read-write lock of the sub data block and operate the sub data block.
On the basis of the above embodiment, the data type of the data to be processed is data read-write or data process call.
In a specific implementation process, the data types of the data to be processed include two types, which may be data read-write types or data process call types, and in a one-time effective module interaction process of the robot, the data types of the data to be processed are data read-write or process call types, and only one data type exists in each data interaction. On the basis of dividing the data to be processed into a plurality of data blocks, the data to be processed of two different data types have different data structure forms so as to realize two different data interaction processes among a plurality of modules of the robot. The method specifically comprises the following steps:
the data type of the data to be processed is data read and write, and the data block structure is shown in table 1:
TABLE 1
Figure BDA0003193902830000081
As can be seen from the data structure content of the data to be processed in table 1, the data structure of the data to be processed may be divided into an information area and a data area, the size of the information area is a fixed K bytes, the data area is divided into a plurality of data blocks, and the size of each data block may be a multiple of the fixed K bytes, which is to facilitate the division of the data blocks, and the storage location of each data block in the local disk may be determined according to the byte addressing mode. The information area is used for recording the basic information of the read-write data, the information area comprises head data and n index blocks, the number of the index blocks is from 1 to n, the head data comprises a read-write lock and the number of the index blocks, the read-write lock of the head data is used for controlling the data of the information area, when a new data block is added to the read-write data, the data of the information area is updated, the read-write lock of the information area is obtained to lock the data of the information area, the effect of the read-write lock is consistent with that of the read-write lock, only one module is allowed to write the data each time, and the data read after each data update is kept consistent in the communication of the plurality of functional modules. Each index block is used for recording basic information of each data block, including an index number, a data area offset, a data area size and a reserved area. Each index block corresponds to a data block one by one, the index blocks are uniquely identified by numbers, the data area offset represents the offset byte number of the initial position of the index block and the initial position of the data area according to a byte addressing mode, the storage position of each data block in a local disk is conveniently and quickly judged, and the size of the data area records the byte size of each data block. Each index block is also provided with a reserved area for subsequently increasing the effective information of the index block. It is understood that K and n are positive integers.
The data area of the data to be processed comprises a plurality of data blocks, and the size of each data block is a multiple of the fixed byte K. For example: when the fixed byte size of the information area is set to 10KB, then the size of each data block may be set to 10KB, 20KB, 100KB, etc. The number of each data block is consistent with that of the index block, each data block comprises a read-write lock and data, the control range of the read-write lock is within a single data block, if the data in the single data block is written and read, the read-write lock corresponding to the single data block is acquired first, and the read-write lock is released after the data operation is completed. By designing an independent lock for each data block, the real-time performance of reading and writing of each data block can be kept, the reading and writing operation in each data block can be kept from being interfered, and the transmission delay caused by excessive competition of the reading and writing lock is avoided.
When the data type of the data to be processed is a procedure call, the data block structure is shown in table 2:
TABLE 2
Figure BDA0003193902830000091
Figure BDA0003193902830000101
As can be seen from the data structure of the procedure call in table 2, the data structure of the data to be processed can be divided into an information area and a service information data area, the size of the information area is fixed kbytes, the service information data area is divided into a plurality of service group information blocks, the size of each service group information block can be a multiple of the fixed kbytes, which is to facilitate the division of the service group information blocks, the storage position of each service group information block in the local disk can be judged according to the byte addressing mode, the information area is used for recording the basic information of the read-write data, the information area comprises header data and n service group index blocks, the number of the index blocks is from 1 to n, the header data comprises read-write locks and the number of active service groups, the read-write locks of the header data are used for controlling the data of the information area, and the number of the active service groups is calculated according to the state of each service group index block. Each service group index block is used for recording basic information of each service group information block and comprises a service group number, a service group information block offset, a service group data size and a service group state, each service group index block corresponds to a service data block one by one, the service group information block is uniquely identified by the service group number, the service group information block offset represents the offset byte number of the initial position of the service group information block and the initial position of a service group data area according to a byte addressing mode, the storage position of each service group information block in a local disk is conveniently and quickly judged, the service group data size records the byte size of each data block, the service group state comprises undefined, idle, processing and abnormal, and the active service group number of the information area is recorded as the total number of other service groups except the service group state which is undefined.
The service information data area of the procedure call includes a plurality of service data blocks, and the size of each service data block is a multiple of a fixed byte K, for example: when the fixed byte size of the information area is set to 10KB, the size of each service data block can be set to 10KB, 20KB, 100KB, etc., the number of each service data block is consistent with the number of the service set index block, each service data block comprises a read-write lock and m service data blocks, the control range of the read-write lock is within a single service data block, and the service data blocks are ordered according to the numbers from 1 to m. Each service data block includes a number, a type, a service status, a data occupation number, a parameter, and return value data, the number is used to identify each service data block, the type represents a calling procedure for each service data block, and each type represents a calling procedure for the parameter and the return value, for example: when the type of the service data block is 1, the representation adds all the parameters to obtain a return value. It is understood that each service may have multiple types for representing different calling procedures of multiple service data in procedure calling, and the embodiment of the present application does not specifically specify the calling procedure executed in each service data. The service states comprise idle, waiting for processing, in-process, abnormal and successful, and different modules can check the calling state of each service at any time by reading the state of each service of the data to be processed.
Since the data size occupied by the parameter and the return value in each service data is fixed to P bytes by default, when the data size of the parameter and the return value in a single service data block is larger than P bytes, the data structure of each service data block can be changed, each service data block can occupy a plurality of service data block sizes, and the data format of the service data blocks to be newly divided is shown in table 3.
TABLE 3
Figure BDA0003193902830000111
Figure BDA0003193902830000121
On the basis of the above embodiment, if the data type of the data to be processed is a procedure call;
the storing the data to be processed into a shared memory according to the read-write lock includes:
acquiring a read-write lock corresponding to the data to be processed through the first module, and locking the data to be processed;
respectively writing the data to be processed into a shared memory through the first module;
releasing a read-write lock corresponding to the data to be processed through the first module;
correspondingly, the reading, by the second module, the to-be-processed data from the shared memory according to the read-write lock includes:
acquiring a read-write lock corresponding to the data to be processed through the second module, and locking the data to be processed;
and reading the data to be processed from the shared memory through the second module, and executing a calling process by using the data to be processed.
In a specific implementation process, when the data type of the data to be processed is a procedure call, in combination with the above data structure form of the procedure call, since the data to be processed is divided into a plurality of service group information blocks for storage, both the writing and reading operations of the data to be processed operate on the plurality of service group information blocks. When writing data to be processed into a shared memory, a first module firstly obtains a read-write lock of each service group information block and locks each service group information block, then writes each service group information block into the shared memory, and finally releases the read-write lock of each service group information block respectively to complete the operation of writing a plurality of service group information blocks into the shared memory. When the second module reads the data to be processed from the shared memory, firstly, the read-write locks of a plurality of service group information blocks are respectively obtained and each service group information block is locked, then, the data of each service group information block is respectively read from the shared memory, and then, a corresponding calling process is executed according to the data in each service group information block. It can be understood that, since the data to be processed is partitioned in the system, each service group information block corresponds to one read/write lock, in the process of writing and reading the data to be processed by the first module and the second module, each time the first module writes a certain service group information block of the data to be processed into the shared memory according to the read/write lock, the second module can read the service group information block from the shared memory according to the read/write lock of the corresponding service group information block, and the second module reads the corresponding service group information block from the shared memory after the first module writes all the service group information blocks of the data to be processed into the shared memory without waiting until the first module writes all the service group information blocks of the data to be processed into the shared memory.
On the basis of the above embodiment, the to-be-processed data includes a plurality of service data, each of the service data includes a type, a service state, a parameter, and a return value, and the executing a calling process using the to-be-processed data includes:
respectively completing the calling process of the corresponding service according to the type and the parameter in each service data through the second module;
changing the service state and the return value according to the calling result of each service through the second module;
and releasing the read-write lock corresponding to the data to be processed through the second module.
In a specific implementation process, as shown in fig. 2, which is a schematic diagram of a process call flow of a robot provided in an embodiment of the present application, as shown in fig. 2, a call process in a plurality of service group information blocks is executed according to a data structure form of the process call, each service group information block includes a plurality of service data blocks, each service data block corresponds to a service process, and a service process can be defined by a type, a parameter, and return value data in each service data block, for example: and when the type 1 of the service data block is defined as addition, adding the values of all the parameters and returning the values to define a service process, sequentially executing the corresponding service process in each service data block, and changing the state and return value data in each service data block according to the result of the service process until all the service processes in all the service data blocks are completely executed. It can be understood that, in the process of changing the status and return value data in each service data block, the process of acquiring the read-write lock of each service data block and locking the service data block, and the process of releasing the read-write lock after the change operation is completed are also included.
On the basis of the above embodiment, the method further includes: dividing a shared memory area in advance to obtain a first shared memory and a second shared memory; the first shared memory is used for data reading and writing, and the second shared memory is used for process calling.
In a specific implementation process, a shared memory area is divided into a first shared memory and a second shared memory which are respectively used for data reading and writing and process calling, a physical address of data to be processed in a local disk is mapped with a virtual address of the corresponding shared memory according to a data type, data interaction of the data types of different data in the corresponding shared memory is achieved, the data reading and writing or the process calling directly operate the physical memory, and the implementation of code logic is simplified.
On the basis of the above embodiment, the method further includes: the robot acquires the latest data of a remote end through a reliable datagram protocol (RUDP), and updates the local data of the robot according to the latest data to obtain the latest data.
In a specific implementation process, the above data interaction process occurs among a plurality of modules of the robot, and when the reliable datagram protocol RUDP is a protocol commonly used in the field of internet streaming media, frequent disconnection and connection under weak network conditions can be avoided, and the RUDP is adopted to replace the original data transmission control protocol TCP. Under some harsh network conditions, the method can automatically balance cost, time delay and quality according to a service scene, effectively ensure normal communication quality and avoid window jitter in a TCP protocol. The remote data interaction scene is divided into two scenes of remote data to a local end and local data synchronization to a remote end, and in the remote data synchronization to the local end, the robot needs to read the latest data of the remote end for updating the data stored in the local disk, for example: the controller module of the robot reads data recorded in real time from the remote sensor, the server issues an update event after the remote sensor updates the data on the server, and the controller module acquires the latest data on the server according to the update data on the server and synchronizes the latest data to the local data.
On the basis of the above embodiment, the method further includes: the robot transmits local data to a remote end through a reliable datagram protocol RUDP so as to realize the updating of the data of the remote end.
In a specific implementation process, local data is transmitted to a remote end through an RUDP protocol, and the method corresponds to a specific remote data interaction scene: synchronizing local data to a remote end, comprising: the robot writes local data to the remote end for updating the server's data, such as: the remote display screen needs to display local data of the robot, the robot writes the local data into data of the server for updating the server data, after the data on the server are updated, the server issues an update event for judging whether the local data need to be updated when other modules of the robot read the data on the server subsequently, and the remote display screen reads the data of the server for displaying.
Fig. 3 is a schematic structural diagram of a module data interaction method provided in an embodiment of the present application, and as shown in fig. 3, the method includes: data read and write 301, procedure call 302, virtual data block 303, remote RUDP304, and local shared memory 305. The data to be processed of the robot module data can be divided into two data types: the data reading and writing and the process calling respectively realize different functions, the two data types can be represented by virtual data blocks in storage, the data structure forms of the virtual data blocks of each data type are different, the data structure forms of the two data types are introduced above, and the description is omitted here. In the module interaction scene of the robot, the method can be divided into two categories including local transmission and remote transmission, remote RUDP is used for replacing TCP to perform data transmission in the remote transmission, normal communication quality guarantee is guaranteed, and local shared memory is used for achieving high reliability and low delay of data interaction in the local transmission.
Fig. 4 is a schematic structural diagram of an entity of an electronic device provided in an embodiment of the present application, and as shown in fig. 4, the electronic device includes: a processor (processor)401, a memory (memory)402, and a bus 403; wherein,
the processor 401 and the memory 402 complete interaction with each other through the bus 403;
the processor 401 is configured to call the program instructions in the memory 402 to execute the methods provided by the above-mentioned method embodiments, for example, including: the first module receives a data processing request; the first module acquires corresponding data to be processed and a read-write lock corresponding to the data to be processed according to the data processing request, and writes the data to be processed into a corresponding shared memory according to the read-write lock; and the second module reads the data to be processed from the shared memory according to the read-write lock so as to realize data interaction among the modules.
The processor 401 may be an integrated circuit chip having signal processing capabilities. The Processor 401 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. Which may implement or perform the various methods, steps, and logic blocks disclosed in the embodiments of the present application. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The Memory 402 may include, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Read-Only Memory (EPROM), Electrically Erasable Read-Only Memory (EEPROM), and the like.
The present embodiment discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the method provided by the above-mentioned method embodiments, for example, comprising: the first module receives a data processing request; the first module acquires corresponding data to be processed and a read-write lock corresponding to the data to be processed according to the data processing request, and writes the data to be processed into a corresponding shared memory according to the read-write lock; and the second module reads the data to be processed from the shared memory according to the read-write lock so as to realize data interaction among the modules.
The present embodiments provide a non-transitory computer-readable storage medium storing computer instructions that cause the computer to perform the methods provided by the above method embodiments, for example, including: the first module receives a data processing request;
the first module acquires corresponding data to be processed and a read-write lock corresponding to the data to be processed according to the data processing request, and writes the data to be processed into a corresponding shared memory according to the read-write lock; and the second module reads the data to be processed from the shared memory according to the read-write lock so as to realize data interaction among the modules.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or mutual connection may be an indirect coupling or mutual connection of devices or units through some mutual interfaces, and may be in an electric, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A method of modular data interaction for a robot, the robot comprising a first module and a second module, the method comprising:
receiving, by the first module, a data processing request;
acquiring corresponding data to be processed and a read-write lock corresponding to the data to be processed according to the data processing request through the first module, and writing the data to be processed into a corresponding shared memory according to the read-write lock;
and reading the data to be processed from the shared memory through the second module according to the read-write lock so as to realize data interaction among the modules.
2. The method of claim 1, wherein the data to be processed includes a plurality of sub data blocks, each sub data block corresponds to a data block read-write lock, and writing the data to be processed into a corresponding shared memory according to the read-write lock comprises:
writing the plurality of sub data blocks into corresponding shared memories through the first module according to the data block read-write locks corresponding to the plurality of sub data blocks;
correspondingly, the reading, by the second module, the to-be-processed data from the shared memory according to the read-write lock includes:
and respectively reading the plurality of sub data blocks from the shared memory through the second module according to the data block read-write locks corresponding to the plurality of sub data blocks.
3. The method according to claim 1, wherein the data type of the data to be processed is data read-write or procedure call.
4. The method according to claim 3, wherein if the data type of the data to be processed is a procedure call;
the storing the data to be processed into a shared memory according to the read-write lock includes:
acquiring a read-write lock corresponding to the data to be processed through the first module, and locking the data to be processed;
respectively writing the data to be processed into a shared memory through the first module;
releasing a read-write lock corresponding to the data to be processed through the first module;
correspondingly, the reading, by the second module, the to-be-processed data from the shared memory according to the read-write lock includes:
acquiring a read-write lock corresponding to the data to be processed through the second module, and locking the data to be processed;
and reading the data to be processed from the shared memory through the second module, and executing a calling process by using the data to be processed.
5. The method of claim 4, wherein the data to be processed comprises a plurality of service data, each service data comprises a type, a service status, a parameter and a return value, and wherein executing a calling process using the data to be processed comprises:
respectively completing the calling process of the corresponding service according to the type and the parameter in each service data through the second module;
changing the service state and the return value according to the calling result of each service through the second module;
and releasing the read-write lock corresponding to the data to be processed through the second module.
6. The method according to any one of claims 1-5, further comprising:
dividing a shared memory area in advance to obtain a first shared memory and a second shared memory; the first shared memory is used for data reading and writing, and the second shared memory is used for process calling.
7. The method of claim 1, further comprising:
the robot acquires the latest data of a remote end through a reliable datagram protocol (RUDP), and updates the local data of the robot according to the latest data to obtain the latest data.
8. The method of claim 1 or 7, further comprising:
the robot transmits local data to a remote end through a reliable datagram protocol RUDP so as to realize the updating of the data of the remote end.
9. An electronic device, comprising: a processor, a memory, and a bus, wherein,
the processor and the memory complete mutual interaction through the bus;
the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform the method of any one of claims 1-8.
10. A non-transitory computer-readable storage medium storing computer instructions which, when executed by a computer, cause the computer to perform the method of any one of claims 1-8.
CN202110885307.4A 2021-08-03 2021-08-03 Module data interaction method of robot, electronic equipment and storage medium Active CN113535437B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110885307.4A CN113535437B (en) 2021-08-03 2021-08-03 Module data interaction method of robot, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110885307.4A CN113535437B (en) 2021-08-03 2021-08-03 Module data interaction method of robot, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113535437A true CN113535437A (en) 2021-10-22
CN113535437B CN113535437B (en) 2023-04-07

Family

ID=78090198

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110885307.4A Active CN113535437B (en) 2021-08-03 2021-08-03 Module data interaction method of robot, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113535437B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114647429A (en) * 2022-03-18 2022-06-21 重庆长安汽车股份有限公司 Terminal function updating method based on AI intelligent assistant scene action protocol
WO2024019475A1 (en) * 2022-07-19 2024-01-25 코가로보틱스 주식회사 Data processing device and method for robot control

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107632945A (en) * 2016-07-18 2018-01-26 大唐移动通信设备有限公司 The data read-write method and device of a kind of shared drive
CN107920064A (en) * 2017-11-02 2018-04-17 河北科技大学 A kind of multiple mobile robot's communication means based on RUDP
CN109766199A (en) * 2018-12-29 2019-05-17 歌尔股份有限公司 Node communication method and device in a kind of robot operating system
CN110287044A (en) * 2019-07-02 2019-09-27 广州虎牙科技有限公司 Without lock shared drive processing method, device, electronic equipment and readable storage medium storing program for executing
US20200050366A1 (en) * 2018-08-08 2020-02-13 Micron Technology, Inc. Buffer Management in Memory Systems for Read and Write Requests
CN111506436A (en) * 2020-03-25 2020-08-07 炬星科技(深圳)有限公司 Method for realizing memory sharing, electronic equipment and shared memory data management library
CN113127218A (en) * 2019-12-31 2021-07-16 深圳市优必选科技股份有限公司 Real-time communication method, device and system for robot, controller and robot

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107632945A (en) * 2016-07-18 2018-01-26 大唐移动通信设备有限公司 The data read-write method and device of a kind of shared drive
CN107920064A (en) * 2017-11-02 2018-04-17 河北科技大学 A kind of multiple mobile robot's communication means based on RUDP
US20200050366A1 (en) * 2018-08-08 2020-02-13 Micron Technology, Inc. Buffer Management in Memory Systems for Read and Write Requests
CN109766199A (en) * 2018-12-29 2019-05-17 歌尔股份有限公司 Node communication method and device in a kind of robot operating system
CN110287044A (en) * 2019-07-02 2019-09-27 广州虎牙科技有限公司 Without lock shared drive processing method, device, electronic equipment and readable storage medium storing program for executing
CN113127218A (en) * 2019-12-31 2021-07-16 深圳市优必选科技股份有限公司 Real-time communication method, device and system for robot, controller and robot
CN111506436A (en) * 2020-03-25 2020-08-07 炬星科技(深圳)有限公司 Method for realizing memory sharing, electronic equipment and shared memory data management library

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114647429A (en) * 2022-03-18 2022-06-21 重庆长安汽车股份有限公司 Terminal function updating method based on AI intelligent assistant scene action protocol
WO2024019475A1 (en) * 2022-07-19 2024-01-25 코가로보틱스 주식회사 Data processing device and method for robot control

Also Published As

Publication number Publication date
CN113535437B (en) 2023-04-07

Similar Documents

Publication Publication Date Title
CN113535437B (en) Module data interaction method of robot, electronic equipment and storage medium
CN104360967B (en) The control method of accumulator system, console controller and DMA
US4918589A (en) Method and apparatus for linking processors in a hierarchical control system
US20150012607A1 (en) Techniques to Replicate Data between Storage Servers
CN111683252B (en) Server and output system and method of video compression image
CN110244604A (en) Data transmission method, device, electronic equipment and storage medium
US10496608B2 (en) Synchronizing changes in a file system which are initiated by a storage device and a host device
CN113220229B (en) Online I/O undisturbed configuration method for distributed control system
CN110704355A (en) Method for receiving and processing 1553B bus data by using dual-port RAM
US11020853B2 (en) Robot, method for controlling motion of a robot and non-transitory readable medium
CN105356989A (en) MTP mode-based data synchronization method, system and device
JP4696199B2 (en) USB host controller with transfer descriptor memory
CN103530215B (en) A kind of self checking method of internal integrated circuit main frame, device and main frame
JP2016535483A (en) Network interface
CN105917322B (en) Method for exchanging control through a USB disk and related devices allowing the implementation thereof
US8886597B2 (en) Synchronizing changes in a file system which are initiated by a storage device and a host device
CN107766021B (en) Image processing method, image processing apparatus, display system, and storage medium
CN105786434B (en) A kind of control method and equipment remotely shown
CN115660941B (en) Image moving method and device, electronic equipment and computer readable storage medium
CN109800202B (en) PCIE (peripheral component interface express) -based data transmission system, method and device
CN110990169A (en) Structure and method for inter-process byte stream communication by using shared memory
CN116300780A (en) Component configuration method, device, electronic equipment and storage medium
CN105867866A (en) K virtual machine (KVM) chip and system and method for controlling KVM
CN105653477A (en) Double-port RAM-based method for communication of hard core and soft core in FPGA
CN105302662B (en) Multi-machine backup method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Building 6, 646 Jianchuan Road, Minhang District, Shanghai 201100

Applicant after: Jieka Robot Co.,Ltd.

Address before: Building 6, 646 Jianchuan Road, Minhang District, Shanghai 201100

Applicant before: SHANGHAI JAKA ROBOTICS Ltd.

GR01 Patent grant
GR01 Patent grant