Movatterモバイル変換


[0]ホーム

URL:


CN112000446A - Data transmission method and robot - Google Patents

Data transmission method and robot
Download PDF

Info

Publication number
CN112000446A
CN112000446ACN202010670765.1ACN202010670765ACN112000446ACN 112000446 ACN112000446 ACN 112000446ACN 202010670765 ACN202010670765 ACN 202010670765ACN 112000446 ACN112000446 ACN 112000446A
Authority
CN
China
Prior art keywords
data
program
priority
interaction
interaction data
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.)
Pending
Application number
CN202010670765.1A
Other languages
Chinese (zh)
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.)
Shenzhen Ubtech Technology Co ltd
Original Assignee
Shenzhen Ubtech Technology Co 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 Shenzhen Ubtech Technology Co ltdfiledCriticalShenzhen Ubtech Technology Co ltd
Priority to CN202010670765.1ApriorityCriticalpatent/CN112000446A/en
Publication of CN112000446ApublicationCriticalpatent/CN112000446A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本申请适用于设备控制领域,提供了一种数据传输的方法及机器人,包括:获得由第一程序生成的交互数据;根据所述交互数据的数据类型,确定所述交互数据的数据优先级;基于所述数据优先级调用数据传输信道传输所述交互数据至第二程序;根据所述数据优先级确定所述交互数据在所述第二程序内的处理次序,并通过所述第二程序输出所述交互数据的交互应答信息。本申请减少了不同模块之间耦合度的同时,也能够通过创建数据传输信道实现模块之间的数据交互,满足了部分功能需要多个模块协同运作的要求,提高机器人多模块之间数据通信的实时性以及设备的安全性。

Figure 202010670765

The present application is applicable to the field of device control, and provides a data transmission method and robot, including: obtaining interaction data generated by a first program; determining a data priority of the interaction data according to the data type of the interaction data; Invoke a data transmission channel based on the data priority to transmit the interactive data to the second program; determine the processing order of the interactive data in the second program according to the data priority, and output the interactive data through the second program Interaction response information of the interaction data. While reducing the coupling degree between different modules, the present application can also realize data interaction between modules by creating data transmission channels, which satisfies the requirement that some functions require multiple modules to work together, and improves the efficiency of data communication between multiple modules of the robot. real-time and device security.

Figure 202010670765

Description

Translated fromChinese
一种数据传输的方法及机器人A method and robot for data transmission

技术领域technical field

本申请属于设备控制领域,尤其涉及一种数据传输的方法及机器人。The present application belongs to the field of equipment control, and in particular relates to a data transmission method and a robot.

背景技术Background technique

随着人工智能技术的不断发展,机器人的功能也越来越多,为了保证每个功能的独立性,机器人内部可以为不同的模块配置独立的程序以控制各个模块运行,从而能够避免不同模块之间相互影响。虽然不同模块的通过独立的程序控制可以减少模块之间降低耦合度,但机器人的部分功能要求多个模块协同处理的情况下,则上述情况则无法在不同模块之间传输数据,从而降低了机器人多模块之间数据通信的实时性以及设备的安全性。With the continuous development of artificial intelligence technology, robots have more and more functions. In order to ensure the independence of each function, the robot can configure independent programs for different modules to control the operation of each module, so as to avoid the need for different modules to operate. influence each other. Although the independent program control of different modules can reduce the coupling between modules, if some functions of the robot require multiple modules to work together, the above situation cannot transmit data between different modules, thus reducing the robot Real-time data communication between multiple modules and device security.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明实施例提供了一种数据传输的方法及设备,以解决现有的机器人控制的技术,为不同的模块配置独立的程序以控制各个模块运行,当部分功能要求多个模块协同处理的情况下,无法在不同模块之间传输数据,从而降低了机器人多模块之间数据通信的实时性以及设备的安全性的问题。In view of this, the embodiments of the present invention provide a method and device for data transmission, to solve the existing robot control technology, configure independent programs for different modules to control the operation of each module, when some functions require multiple modules In the case of cooperative processing, data cannot be transmitted between different modules, thereby reducing the real-time performance of data communication between multiple modules of the robot and the safety of equipment.

本申请实施例的第一方面提供了一种数据传输的方法,包括:A first aspect of the embodiments of the present application provides a method for data transmission, including:

获得由第一程序生成的交互数据;obtaining interaction data generated by the first program;

根据所述交互数据的数据类型,确定所述交互数据的数据优先级;determining the data priority of the interaction data according to the data type of the interaction data;

基于所述数据优先级调用数据传输信道传输所述交互数据至第二程序;Invoke a data transmission channel to transmit the interaction data to the second program based on the data priority;

根据所述数据优先级确定所述交互数据在所述第二程序内的处理次序,并通过所述第二程序输出所述交互数据的交互应答信息。The processing order of the interaction data in the second program is determined according to the data priority, and interaction response information of the interaction data is output through the second program.

本申请实施例的第二方面提供了一种数据传输的装置,包括:A second aspect of the embodiments of the present application provides a device for data transmission, including:

交互数据获取单元,用于获得由第一程序生成的交互数据;an interaction data acquisition unit, used for acquiring interaction data generated by the first program;

数据优先级确定单元,用于根据所述交互数据的数据类型,确定所述交互数据的数据优先级;a data priority determining unit, configured to determine the data priority of the interaction data according to the data type of the interaction data;

数据传输单元,用于基于所述数据优先级调用数据传输信道传输所述交互数据至第二程序;a data transmission unit for invoking a data transmission channel to transmit the interaction data to the second program based on the data priority;

数据应答单元,用于根据所述数据优先级确定所述交互数据在所述第二程序内的处理次序,并通过所述第二程序输出所述交互数据的交互应答信息。A data response unit, configured to determine the processing order of the interaction data in the second program according to the data priority, and output interaction response information of the interaction data through the second program.

本申请实施例的第三方面提供了一种机器人,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现第一方面的各个步骤。A third aspect of the embodiments of the present application provides a robot, including a memory, a processor, and a computer program stored in the memory and executable on the processor, which is implemented when the processor executes the computer program Steps of the first aspect.

本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现第一方面的各个步骤。A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, each step of the first aspect is implemented.

实施本申请实施例提供的一种数据传输的方法及机器人具有以下有益效果:Implementing a data transmission method and robot provided by the embodiments of the present application has the following beneficial effects:

本申请实施例通过为不同的模块配置对应的控制程序,在其中需要进行模块之间的数据传输时,可以通过第一程序生成对应的交互数据,并根据交互数据的数据类型为该交互数据配置对应的数据优先级,通过与数据优先级对应的数据传输信道发送交互数据给所需通信的第二程序,以使第二程序对该交互数据进行应答,实现了模块间的数据通信。与现有的机器人控制技术相比,减少了不同模块之间耦合度的同时,也能够通过创建数据传输信道实现模块之间的数据交互,满足了部分功能需要多个模块协同运作的要求,提高机器人多模块之间数据通信的实时性以及设备的安全性。In the embodiment of the present application, by configuring corresponding control programs for different modules, when data transmission between modules is required, corresponding interaction data may be generated through the first program, and the interaction data may be configured according to the data type of the interaction data. For the corresponding data priority, the interactive data is sent to the second program that needs to communicate through the data transmission channel corresponding to the data priority, so that the second program responds to the interactive data, realizing data communication between modules. Compared with the existing robot control technology, it reduces the coupling degree between different modules, and can also realize the data interaction between modules by creating a data transmission channel, which satisfies the requirement that some functions require multiple modules to work together, and improves the Real-time data communication between multiple modules of the robot and safety of equipment.

附图说明Description of drawings

为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only for the present application. In some embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1是本申请第一实施例提供的一种数据传输的方法的实现流程图;Fig. 1 is the realization flow chart of a kind of data transmission method provided by the first embodiment of the present application;

图2是本申请第二实施例提供的一种数据传输的方法S102和S103具体实现流程图;FIG. 2 is a specific implementation flowchart of a data transmission method S102 and S103 provided by the second embodiment of the present application;

图3是本申请一实施例提供的交互数据的入队示意图;3 is a schematic diagram of entering a queue of interactive data provided by an embodiment of the present application;

图4是本申请一实施例提供的程序间的交互流程图;FIG. 4 is a flowchart of interaction between programs provided by an embodiment of the present application;

图5是本申请第三实施例提供的一种数据传输的方法S102具体实现流程图;FIG. 5 is a specific implementation flowchart of a method S102 for data transmission provided by the third embodiment of the present application;

图6是本申请第四实施例提供的一种数据传输的方法S104具体实现流程图;FIG. 6 is a flowchart of a specific implementation of a method S104 for data transmission provided by the fourth embodiment of the present application;

图7是本申请第五实施例提供的一种数据传输的方法S101具体实现流程图;FIG. 7 is a specific implementation flowchart of a data transmission method S101 provided by the fifth embodiment of the present application;

图8是本申请一实施例提供的一种数据传输的设备的结构框图;8 is a structural block diagram of a data transmission device provided by an embodiment of the present application;

图9是本申请另一实施例提供的一种终端设备的示意图。FIG. 9 is a schematic diagram of a terminal device provided by another embodiment of the present application.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.

本申请实施例通过为不同的模块配置对应的控制程序,在其中需要进行模块之间的数据传输时,可以通过第一程序生成对应的交互数据,并根据交互数据的数据类型为该交互数据配置对应的数据优先级,通过与数据优先级对应的数据传输信道发送交互数据给所需通信的第二程序,以使第二程序对该交互数据进行应答,实现了模块间的数据通信,解决了现有的机器人控制的技术,为不同的模块配置独立的程序以控制各个模块运行,当部分功能要求多个模块协同处理的情况下,无法在不同模块之间传输数据,从而降低了机器人功能的多样性的问题。In the embodiment of the present application, by configuring corresponding control programs for different modules, when data transmission between modules is required, corresponding interaction data may be generated through the first program, and the interaction data may be configured according to the data type of the interaction data. The corresponding data priority, through the data transmission channel corresponding to the data priority, sends the interactive data to the second program that needs to communicate, so that the second program responds to the interactive data, realizes the data communication between the modules, and solves the problem. In the existing robot control technology, independent programs are configured for different modules to control the operation of each module. When some functions require multiple modules to be processed together, data cannot be transmitted between different modules, thus reducing the function of the robot. Diversity issues.

在本申请实施例中,流程的执行主体可以为智能机器人,还可以为一控制设备,该控制设备可以与机器人建立通信连接,以对机器人进行控制,本申请以机器人为例进行说明。图1示出了本申请第一实施例提供的数据传输的方法的实现流程图,详述如下:In the embodiment of the present application, the execution body of the process may be an intelligent robot, and may also be a control device. The control device may establish a communication connection with the robot to control the robot. This application uses a robot as an example for description. Fig. 1 shows the implementation flow chart of the method for data transmission provided by the first embodiment of the present application, which is described in detail as follows:

在S101中,获得由第一程序生成的交互数据。In S101, the interaction data generated by the first program is obtained.

在本实施例中,机器人可以内置有多个模块,上述模块包括但不限于:温度感应模块、距离感应模块、运动控制模块、图形图像识别模块以及语音识别模块等,不同的模块用于实现不同的功能。举例性地,上述温度感应模块包含有温度传感器,该温度感应模块可以通过采集温度传感器反馈的感应值,生成温度提示信息,并且在温度大于预设的温度阈值时,可以输出温度告警信息。举例性地,上述图形图像识别模块可以包含图像采集部件,例如摄像头,接收图像采集部件反馈的场景图像,并将场景图像导入到预设的图像识别模型内,输出图像识别结果。机器人为了减少不同模块之间的耦合度,可以为各个模块配置单独的程序,通过对应的并行进程运行该模块的程序,避免了因不同模块的运行逻辑冲突,从而增加机器人的异常发生概率。In this embodiment, the robot may have multiple modules built-in, and the above modules include but are not limited to: a temperature sensing module, a distance sensing module, a motion control module, a graphic image recognition module, and a voice recognition module, etc. Different modules are used to achieve different function. For example, the above temperature sensing module includes a temperature sensor, the temperature sensing module can generate temperature prompt information by collecting the sensing value fed back by the temperature sensor, and can output temperature alarm information when the temperature is greater than a preset temperature threshold. For example, the above-mentioned graphic image recognition module may include an image acquisition component, such as a camera, to receive a scene image fed back by the image acquisition component, import the scene image into a preset image recognition model, and output an image recognition result. In order to reduce the coupling degree between different modules, the robot can configure a separate program for each module, and run the program of the module through the corresponding parallel process, which avoids the conflict of the operation logic of different modules, thereby increasing the probability of abnormal occurrence of the robot.

在本实施例中,对于机器人的部分功能,需要多个模块之间协同工作完成,此时,则需要跨进程间的通信,即从一个程序将数据发送给另一程序以进行处理。举例性,用户需要通过语音对机器人进行控制时,则需要通过语音识别模块将用户的语音信号转换为文本信息,并生成与文本信息对应的控制指令,将控制指令发送给运动控制模块,以控制机器人执行对应的操作。为了应对上述情况,在需要实现跨进程之间的数据传输,则可以通过S101至S104的操作实现。In this embodiment, some functions of the robot require cooperative work among multiple modules. In this case, cross-process communication is required, that is, data is sent from one program to another program for processing. For example, when the user needs to control the robot through voice, the user's voice signal needs to be converted into text information through the voice recognition module, and the control command corresponding to the text information is generated, and the control command is sent to the motion control module to control the robot. The robot performs the corresponding operation. In order to deal with the above situation, if it is necessary to realize the data transmission between the processes, it can be realized through the operations of S101 to S104.

在本实施例中,机器人可以为不同模块配置对应的程序以控制该模块运行,并通过不同的进程运行上述不同的程序,以实现模块间的逻辑解耦。若其中一个模块需要向另一模块发送数据,此时,机器人会将发送数据的模块对应的程序识别为上述的第一程序,而将接收上述数据的模块对应的程序识别为下述的第二程序,即第一程序以及第二程序并非对应特定的程序,只是根据数据发送方向的不同,将数据发起侧的程序定义为第一程序,而将数据接收侧的程序定位第二程序,同一模块的程序在不同的发送过程中,可以识别为第一程序以及第二程序。In this embodiment, the robot can configure corresponding programs for different modules to control the operation of the modules, and run the above-mentioned different programs through different processes, so as to realize logical decoupling between modules. If one of the modules needs to send data to the other module, at this time, the robot will recognize the program corresponding to the module sending the data as the first program above, and the program corresponding to the module receiving the data as the second program described below. The program, that is, the first program and the second program do not correspond to specific programs, but according to the different data sending directions, the program on the data originating side is defined as the first program, and the program on the data receiving side is located in the second program, the same module. The program can be identified as the first program and the second program in different sending processes.

在本实施例中,第一程序在运行的过程中可以处理不同类型的数据,例如采集数据、对采集数据进行处理后的输出数据、需要发送的交互数据以及由其他程序发送的待应答数据。第一程序在控制模块运行的过程中,若需要向其他模块发送数据,则会生成交互类型的数据,即上述的交互数据,以通过数据传输信道发送给所需通信的第二程序。In this embodiment, the first program can process different types of data during running, such as collected data, output data after processing the collected data, interactive data to be sent, and data to be responded to sent by other programs. During the operation of the control module, if the first program needs to send data to other modules, it will generate interactive data, that is, the above-mentioned interactive data, and send it to the second program that needs to communicate through the data transmission channel.

在一种可能的实现方式中,机器人通过调用进程以运行各个模块对应的程序,即运行第一程序。进程可以创建多条不同的线程以执行程序对应的任务,例如执行数据采集任务、执行数据解析任务以及执行数据输出任务等。不同的线程根据数据输出的目标对象,可以划分为本地线程以及异地线程。其中,本地线程具体为数据输出的目标对象为该进程对应的程序,即通过本地程序进行处理,无需进行跨进程响应;而异地线程具体为数据输出的目标对象为另一模块对应的程序,即需要进行跨进程通信,以通过另一程序对该数据进行处理。在该情况下,机器人可以将异地线程输出的数据识别为交互数据,并在检测到异地线程运行时,通过S101至S104步骤对其数据的交互数据进行响应。In a possible implementation manner, the robot runs the program corresponding to each module by calling the process, that is, runs the first program. A process can create multiple different threads to perform tasks corresponding to the program, such as performing data collection tasks, performing data parsing tasks, and performing data output tasks. Different threads can be divided into local threads and remote threads according to the target object of data output. Among them, the target object of the data output of the local thread is the program corresponding to the process, that is, it is processed by the local program without cross-process response; and the target object of the data output of the remote thread is the program corresponding to another module, that is Cross-process communication is required to process this data by another program. In this case, the robot can identify the data output by the off-site thread as interactive data, and when detecting that the off-site thread is running, respond to the interactive data of its data through steps S101 to S104.

在S102中,根据所述交互数据的数据类型,确定所述交互数据的数据优先级。In S102, the data priority of the interaction data is determined according to the data type of the interaction data.

在本实施例中,机器人在获取得到第一程序生成的交互数据后,可以对该交互数据进行解析,确定该交互数据的数据类型,并确定与数据类型对应的数据优先级,该与数据类型对应的数据优先级作为交互数据的数据优先级。In this embodiment, after obtaining the interaction data generated by the first program, the robot can parse the interaction data, determine the data type of the interaction data, and determine the data priority corresponding to the data type, which corresponds to the data type. The corresponding data priority is used as the data priority of the interactive data.

在一种可能的实现方式中,机器人配置有数据类型与数据优先级之间的索引表,机器人可以通过查询上述索引表确定与本次获取的交互数据的数据类型相对应的数据优先级,将其作为交互数据的数据优先级。In a possible implementation manner, the robot is configured with an index table between data types and data priorities, and the robot can determine the data priority corresponding to the data type of the interactive data acquired this time by querying the above index table, and then Its data priority as interactive data.

在本实施例中,在跨进程间通信的过程中,需要占用两个进程之间的数据传输信道以进行数据交互,因此,为了提高任务响应的及时性,可以为不同的交互数据配置对应的数据类型,以通过数据类型确定该交互数据传输的紧急程度。该数据类型包括但不限于:致命(FATAL)类型、紧急(EMERG)类型、重要(IMPORT)类型、普通(NORMAL)类型以及提示(INFO)类型,上述五种数据类型的紧急程度依次递减,即致命类型的紧急程度最高,提示类型的紧急程度最低。机器人可以为不同的数据类型配置对应的数据优先级,该数据优先级的数值越小,则紧急程度越高,即对应的处理次序越靠前。例如,致命类型对应的数据优先级可以为-1,紧急类型的数据优先级可以为1,重要类型的数据优先级可以为10,普通类型的数据优先级可以为100,而提示类型的数据优先级可以为1000。In this embodiment, in the process of inter-process communication, the data transmission channel between the two processes needs to be occupied for data interaction. Therefore, in order to improve the timeliness of task response, different interaction data can be configured with corresponding Data type to determine the urgency of the interactive data transfer by the data type. The data types include but are not limited to: fatal (FATAL) type, emergency (EMERG) type, important (IMPORT) type, normal (NORMAL) type and prompt (INFO) type, the urgency of the above five data types decreases in turn, namely The fatal type has the highest urgency and the prompt type has the least urgency. The robot can configure corresponding data priorities for different data types. The smaller the value of the data priority, the higher the urgency, that is, the higher the corresponding processing order. For example, the data priority corresponding to the fatal type can be -1, the data priority of the urgent type can be 1, the data priority of the important type can be 10, the data priority of the common type can be 100, and the data priority of the prompt type can be Level can be 1000.

在本实施例中,不同模块之间的跨进程通信,根据交互内容的不同,响应的紧急程度也会存在差异。例如,对于异常报警类的信息,其数据量较少,且紧急程度较高,若发送延迟,则可能会导致机器人异常,延长了异常事件的持续时间,降低了异常事件的响应效率;而对于数据转码等实时性要求较低的任务,可以在机器人空闲的状态下进行处理。若机器人根据各个交互数据的创建时间依次发送,则有可能在传输数据量大且实时性要求低的交互数据的过程中,堵塞了实时性要求较高的交互数据的发送,从而影响了机器人控制的稳定性以及安全性。为了解决上述问题,机器人可以根据实时性要求为不同的交互数据配置对应的数据类型,从而可以根据数据类型确定与之对应的数据优先级,从而能够对实时性要求较高的交互数据优先发送。In this embodiment, in the cross-process communication between different modules, the urgency of the response will also be different according to the different interaction contents. For example, for abnormal alarm information, the amount of data is small and the degree of urgency is high. If the transmission is delayed, it may cause the robot to be abnormal, prolong the duration of abnormal events, and reduce the response efficiency of abnormal events. Tasks with low real-time requirements, such as data transcoding, can be processed when the robot is idle. If the robot sends the interactive data in sequence according to the creation time of each interactive data, it may block the sending of interactive data with high real-time requirements during the process of transmitting interactive data with a large amount of data and low real-time requirements, thus affecting the robot control. stability and security. In order to solve the above problems, the robot can configure corresponding data types for different interactive data according to real-time requirements, so that the corresponding data priority can be determined according to the data type, so that interactive data with higher real-time requirements can be sent preferentially.

在一种可能的实现方式中,交互数据可以携带有数据类型,在该情况下,终端设备可以根据交互数据的数据类型查询与之对应的数据优先级;可选地,机器人可以检测该交互数据的数据量,根据数据量以及与数据类型匹配的数据传输信道的传输速率,计算发送该交互数据的预计耗时,并获取机器人所需通信的目标模块当前的负载参量,根据预计耗时、负载参量以及与数据类型关联的基础优先级,计算该交互数据的数据优先级,具体可以表示为:In a possible implementation manner, the interaction data may carry a data type. In this case, the terminal device may query the corresponding data priority according to the data type of the interaction data; optionally, the robot may detect the interaction data According to the amount of data and the transmission rate of the data transmission channel matching the data type, calculate the estimated time-consuming to send the interactive data, and obtain the current load parameters of the target module that the robot needs to communicate with, according to the estimated time-consuming, load The parameters and the basic priority associated with the data type are used to calculate the data priority of the interactive data, which can be expressed as:

Figure BDA0002582187370000071
Figure BDA0002582187370000071

其中,prority为数据优先级;BasePrority为基础优先级;TimeCost为预计耗时,Load为负载参量,f(x)为数据优先级转换函数。Among them, prority is the data priority; BasePrority is the basic priority; TimeCost is the estimated time consumption, Load is the load parameter, and f(x) is the data priority conversion function.

在一种可能的实现方式中,交互数据若没有携带有数据类型,在该情况下,机器人可解析该交互数据内数据内容对应的数据关键词,基于该数据关键词与各个数据类型对应的标准关键词匹配,基于匹配结果确定该交互数据的数据类型。In a possible implementation manner, if the interactive data does not carry a data type, in this case, the robot can parse the data keyword corresponding to the data content in the interactive data, based on the standard corresponding to the data keyword and each data type. keyword matching, and the data type of the interaction data is determined based on the matching result.

在S103中,基于所述数据优先级调用数据传输信道传输所述交互数据至第二程序。In S103, a data transmission channel is invoked based on the data priority to transmit the interaction data to the second program.

在本实施例中,机器人可以根据交互数据的数据优先级确定该交互数据的发送时机,该发送时机可以为一发送次序也可以为一发送时间节点,当机器人检测到当前满足交互数据的发送时机时,可以通过第一程序与第二程序之间的数据传输信道,将交互数据从第一程序发送给第二程序。需要说明的是,该数据传输信道可以为一全双工的通信信道,即包含有上行信道以及下行信道,用于第一程序以及第二程序之间进行数据发送以及数据接收;该数据传输信道也可以为一半双工的通信信道,即同一时间只允许一个方向传输数据,第一程序在调用数据传输信道向第二程序发送交互数据时,需要等待该交互数据发送完毕后,第一程序才可以通过该数据传输信道接收来自第二程序的数据。In this embodiment, the robot can determine the sending timing of the interactive data according to the data priority of the interactive data. The sending timing can be a sending order or a sending time node. When the robot detects that the sending timing of the interactive data is currently satisfied At the time, the interactive data can be sent from the first program to the second program through the data transmission channel between the first program and the second program. It should be noted that the data transmission channel can be a full-duplex communication channel, that is, it includes an uplink channel and a downlink channel, and is used for data transmission and data reception between the first program and the second program; the data transmission channel It can also be a half-duplex communication channel, that is, only one direction is allowed to transmit data at the same time. When the first program calls the data transmission channel to send interactive data to the second program, it needs to wait for the interactive data to be sent before the first program. Data from the second program may be received through the data transmission channel.

在一种可能的实现方式中,该数据传输信道可以用于实现不同程序之间的交互数据的通信。例如,上述数据传输信道可以用于第一程序与第二程序之间通信、第二程序与第三程序之间通信以及第一程序与第三程序之间通信等。在该情况下,数据传输信道可以配置有对应的数据传输队列,根据各个程序的所需发送的交互数据的数据优先级,确定在该数据传输队列内的传输次序,调用数据传输信道依次发送给各个程序对应的交互数据。In a possible implementation manner, the data transmission channel can be used to realize the communication of interactive data between different programs. For example, the above-mentioned data transmission channel may be used for communication between the first program and the second program, communication between the second program and the third program, and communication between the first program and the third program, and so on. In this case, the data transmission channel can be configured with a corresponding data transmission queue, and according to the data priority of the interactive data to be sent by each program, the transmission order in the data transmission queue is determined, and the data transmission channel is called to send to the Interaction data corresponding to each program.

在一种可能的实现方式中,机器人可以为不同的数据类型配置对应的数据传输信道。其中,一种数据传输信道可以对应一个数据类型,也可以对应多个数据类型,即多个不同的数据类型可以共用同一数据传输信道。举例性地,机器人可以为致命类型的交互数据配置第一数据传输信道,为紧急类型、重要类型、普通类型以及提示类型配置第二数据传输信道,即第二数据传输信道用于传输上述出致命类型外的其他类型的交互数据。当然,机器人可以分别为不同的数据类型配置单独的数据传输信道,在此不做限定。In a possible implementation manner, the robot may configure corresponding data transmission channels for different data types. One data transmission channel may correspond to one data type, or may correspond to multiple data types, that is, multiple different data types may share the same data transmission channel. For example, the robot can configure the first data transmission channel for the interactive data of the fatal type, and configure the second data transmission channel for the emergency type, the important type, the ordinary type and the prompt type, that is, the second data transmission channel is used to transmit the fatal type. Types of interaction data other than types. Of course, the robot can configure separate data transmission channels for different data types, which is not limited here.

在S104中,根据所述数据优先级确定所述交互数据在所述第二程序内的处理次序,并通过所述第二程序输出所述交互数据的交互应答信息。In S104, a processing order of the interaction data in the second program is determined according to the data priority, and interaction response information of the interaction data is output through the second program.

在本实施例中,机器人通过数据传输信道将交互数据发送给第二程序后,第二程序可以根据该交互数据的数据优先级确定在第二程序内的处理次序。可选地,第二程序可以将各个交互数据添加到待处理队列,并基于各个交互数据的数据优先级,确定在待处理队列内的处理次序,第二程序从待处理队列内依次获取各个待处理的交互数据,生成交互数据对应的交互应答信息,从而能够根据数据的实时性要求进行处理,提高了数据处理的准确性。In this embodiment, after the robot sends the interaction data to the second program through the data transmission channel, the second program may determine the processing order in the second program according to the data priority of the interaction data. Optionally, the second program can add each interactive data to the queue to be processed, and determine the processing order in the queue to be processed based on the data priority of each interactive data, and the second program sequentially obtains each to be processed from the queue to be processed. The processed interactive data generates interactive response information corresponding to the interactive data, so that it can be processed according to the real-time requirements of the data, and the accuracy of data processing is improved.

在一种可能的实现方式中,第二程序可以将交互应答信息通过数据传输信道反馈给第一程序,即向第一程序发送交互应答信息。可选地,交互应答信息的数据优先级可以与交互数据的数据优先级相同,在该情况下,即第一程序需要对交互应答信息继续进程处理,机器人的功能可能需要两个程序的多次交互操作完成,因此为了保持处理逻辑的一致性,可以将交互数据的数据优先级作为交互应答信息的数据优先级。可选地,交互应答信息的数据优先级可以配置为预设的数值,例如数值最大值(即数据优先级最低),在该情况下,即第二程序只需通知第一程序已接收到交互数据,并对交互数据进行响应,向第一程序发送一个通知,由于通知的实时性较低,可以将该数据优先级配置为预设的数值,避免占用优先级较高的数据的传输资源。In a possible implementation manner, the second program may feed back the interactive response information to the first program through a data transmission channel, that is, send the interactive response information to the first program. Optionally, the data priority of the interactive response information can be the same as the data priority of the interactive data. In this case, that is, the first program needs to continue processing the interactive response information, and the function of the robot may require multiple times of the two programs. The interaction operation is completed, so in order to maintain the consistency of the processing logic, the data priority of the interaction data can be used as the data priority of the interaction response information. Optionally, the data priority of the interaction response information can be configured as a preset value, such as the maximum value (that is, the data priority is the lowest), in this case, the second program only needs to notify the first program that the interaction has been received. data, respond to the interaction data, and send a notification to the first program. Since the real-time nature of the notification is low, the data priority can be configured to a preset value to avoid occupying transmission resources for data with a higher priority.

以上可以看出,本申请实施例提供的一种数据传输的方法通过为不同的模块配置对应的控制程序,在其中需要进行模块之间的数据传输时,可以通过第一程序生成对应的交互数据,并根据交互数据的数据类型为该交互数据配置对应的数据优先级,通过与数据优先级对应的数据传输信道发送交互数据给所需通信的第二程序,以使第二程序对该交互数据进行应答,实现了模块间的数据通信。与现有的机器人控制技术相比,减少了不同模块之间耦合度的同时,也能够通过创建数据传输信道实现模块之间的数据交互,满足了部分功能需要多个模块协同运作的要求,提高机器人可实现功能的多样性。It can be seen from the above that the method for data transmission provided by the embodiments of the present application configures corresponding control programs for different modules. When data transmission between modules is required, corresponding interactive data can be generated through the first program. , and configure the corresponding data priority for the interactive data according to the data type of the interactive data, and send the interactive data to the second program that needs to communicate through the data transmission channel corresponding to the data priority, so that the second program can respond to the interactive data. Reply to realize data communication between modules. Compared with the existing robot control technology, it reduces the coupling degree between different modules, and can also realize the data interaction between modules by creating a data transmission channel, which satisfies the requirement that some functions require multiple modules to work together, and improves the Robots can achieve a variety of functions.

图2示出了本申请第二实施例提供的一种数据传输的方法S102以及S103的具体实现流程图。参见图2,相对于图1所述实施例,本实施例提供的一种数据传输的方法中S102包括:S201以及S202,S103包括:S203~S205,具体详述如下:FIG. 2 shows a specific implementation flowchart of a data transmission method S102 and S103 provided by the second embodiment of the present application. Referring to FIG. 2 , with respect to the embodiment shown in FIG. 1 , in a data transmission method provided in this embodiment, S102 includes: S201 and S202 , and S103 includes: S203 to S205 , and the details are as follows:

进一步地,所述根据所述交互数据的数据类型,确定所述交互数据的数据优先级,包括:Further, determining the data priority of the interaction data according to the data type of the interaction data includes:

在S201中,若所述交互数据的数据类型为非紧急类型,则基于预设的优先级索引表,确定所述交互数据的初始优先级。In S201, if the data type of the interaction data is a non-emergency type, an initial priority of the interaction data is determined based on a preset priority index table.

在本实施例中,交互数据的数据类型可以分为紧急类型以及非紧急类型两大类型。举例性地,对应于上述列举的五种类型的交互数据,可以将FATAL类型识别为紧急类型,而除FATAL类型外的其他类型,即EMERG类型、IMPORT类型、NORMAL类型以及INFO类型识别为非紧急类型。当然,机器人可以基于其他方式对紧急类型以及非紧急类型进行划分,在此不作限定。In this embodiment, the data types of the interaction data can be divided into two types: urgent type and non-urgent type. For example, corresponding to the five types of interaction data listed above, the FATAL type can be identified as an urgent type, and the other types except the FATAL type, that is, the EMERG type, the IMPORT type, the NORMAL type, and the INFO type are identified as non-urgent types. type. Of course, the robot may divide the emergency type and the non-emergency type based on other methods, which is not limited here.

在本实施例中,机器人可以配置有优先级索引表,该优先级索引表包含有各个数据类型对应的优先级。举例性地,EMERG类消息默认优先级为1,IMPORT类消息默认优先级为10,NORMAL类消息默认优先级为100,INFO类消息默认优先级为1000。上述五个数据类型均属于非紧急类型这一大类,但每个类型对应的初始优先级不同,机器人可以通过查询上述优先级索引表,确定交互数据类型对应的预设优先级,并将该预设优先级作为该交互数据的初始优先级。In this embodiment, the robot may be configured with a priority index table, where the priority index table contains priorities corresponding to various data types. For example, the default priority of an EMERG message is 1, the default priority of an IMPORT message is 10, the default priority of a NORMAL message is 100, and the default priority of an INFO message is 1000. The above five data types all belong to the category of non-emergency types, but the initial priority corresponding to each type is different. The robot can query the above priority index table to determine the preset priority corresponding to the interactive data type, and assign the The preset priority is used as the initial priority of the interaction data.

所述基于所述发送次序,调用数据传输信道依次发送所述第一传输队列内的各个所述交互数据至所述第二程序,包括:The step of invoking a data transmission channel to sequentially send each of the interactive data in the first transmission queue to the second program based on the sending order includes:

在S203中,根据所述初始优先级确定所述交互数据在第一传输队列内的发送次序。In S203, the sending order of the interaction data in the first transmission queue is determined according to the initial priority.

在本实施例中,所有非紧急类型的交互数据公用一个数据传输队列,即上述第一传输队列,根据各个非紧急类型的交互数据的初始优先级,确定该交互数据在第一传输队列内的队列次序,并基于队列次序添加到第一传输队列内。In this embodiment, all non-urgent type interactive data share a data transmission queue, that is, the above-mentioned first transmission queue. The queue order is added to the first transmit queue based on the queue order.

示例性地,图3示出了本申请一实施例提供的交互数据的入队示意图。参见图3所示,本次生成的交互数据A的初始优先级为2,队列内原本包含有3个待发送的交互数据,分别为交互数据1至3,对应的初始优先级分别为1,5,6。其中,优先级的数值越小,则对应的发送次序越高。机器人检测到交互数据A的初始优先级小于交互数据2以及交互数据3,且大于交互数据1,因此将交互数据A插入到交互数据1和交互数据2之间,得到添加了交互数据A后的第一传输列表。Exemplarily, FIG. 3 shows a schematic diagram of entering a queue of interaction data provided by an embodiment of the present application. Referring to Figure 3, the initial priority of the interactive data A generated this time is 2, and the queue originally contains three interactive data to be sent, which are interactive data 1 to 3, and the corresponding initial priorities are 1, respectively. 5,6. Wherein, the smaller the value of the priority is, the higher the corresponding sending order is. The robot detects that the initial priority of the interactive data A is less than the interactive data 2 and the interactive data 3, and greater than the interactive data 1, so the interactive data A is inserted between the interactive data 1 and the interactive data 2, and the interactive data A is added. First transfer list.

在S204中,基于所述发送次序,调用数据传输信道依次发送所述第一传输队列内的各个所述交互数据至所述第二程序。In S204, based on the sending order, a data transmission channel is invoked to sequentially send each of the interaction data in the first transmission queue to the second program.

在本实施例中,数据传输信道可以从第一传输队列中提取需要发送的交互数据。具体地,第一传输队列内各个交互数据可以根据初始优先级确定在第一传输队列内的发送次序,数据传输信道根据第一传输队列内各个交互数据的发送次序,依次取出各个交互数据发送至第二程序。In this embodiment, the data transmission channel may extract the interaction data to be sent from the first transmission queue. Specifically, each interaction data in the first transmission queue can be sent in the first transmission queue according to the initial priority, and the data transmission channel can sequentially take out each interaction data according to the transmission order of each interaction data in the first transmission queue and send it to Second program.

在本申请实施例中,将非紧急类型的交互数据添加到第一传输队列内,并根据交互数据的初始优先级确定发送次序,并调用数据传输信道依次发送第一传输队列内的各个交互数据,实现了根据数据的实时性发送交互数据的目的。In this embodiment of the present application, non-emergency type interaction data is added to the first transmission queue, the transmission order is determined according to the initial priority of the interaction data, and the data transmission channel is invoked to sequentially send each interaction data in the first transmission queue , to achieve the purpose of sending interactive data according to the real-time nature of the data.

进一步地,所述根据所述交互数据的数据类型,确定所述交互数据的数据优先级,还包括:Further, determining the data priority of the interaction data according to the data type of the interaction data further includes:

在S202中,若所述交互数据的数据类型为紧急类型,则将所述数据优先级设置为一类优先级,并将一类优先级的交互数据添加到第二传输队列。In S202, if the data type of the interaction data is an emergency type, the data priority is set to a first-class priority, and the interaction data of the first-class priority is added to the second transmission queue.

在本实施例中,机器人可以将预设的至少一个交互类型作为紧急类型,举例性地,可以将FATAL类型识别为紧急类型,或者将FATAL类型以及EMERG类型识别为紧急类型。对于紧急类型的交互数据,可以配置与非紧急类型不同的另一队列对该类型的交互数据进行存储,从而可以通过不同的数据传输队列用于传输不同类型的交互数据,其中,处理优先级较高的数据传输队列,具有占用处理优先级较低的数据传输队列的权限,从而能够使得发送操作与交互数据的实时需求相匹配。In this embodiment, the robot may take at least one preset interaction type as the emergency type, for example, the FATAL type may be identified as the emergency type, or the FATAL type and the EMERG type may be identified as the emergency type. For the urgent type of interaction data, another queue different from the non-urgent type can be configured to store the type of interaction data, so that different data transmission queues can be used to transmit different types of interaction data, wherein the processing priority is higher A high data transmission queue has the right to occupy a data transmission queue with a lower processing priority, so that the sending operation can match the real-time demand of interactive data.

在本实施例中,机器人可以为紧急类型的交互数据配置一类优先级,该一类优先级的取数区间为与初始优先级的取数区间不同。举例性地,对于非紧急类型的交互数据,其初始优先级的取数区间可以为正数,而对于紧急类型的交互数据,其配置的一类优先级的取数区间可以为负数,从而保证了紧急类型的交互数据的发送次序必然优先于非紧急类型的交互数据的发送次序,并且在后续调整交互数据的数据优先级的过程中,非紧急类型的交互数据必然不会变更为紧急类型的交互数据。举例性地,紧急类型的交互数据配置的一类优先级可以为-1,在后续因处理超时需要调整该紧急类型的一类优先级时,可以将该数值执行减1处理;而对于非紧急类型的交互数据配置的初始优先级可以为正数,如1或10等,在后续因处理超时需要调整该非紧急类型的初始优先级时,可以将该数值执行除法处理,例如变为原来的五分之一、二分之一等。在该情况下,由于紧急类型的交互数据与非紧急类型的交互数据的取数区间不同,因此,紧急类型的交互数据在调整一类优先级后,仍然位于第二传输队列;而非紧急雷的交互数据在调整初始优先级后,则会位于第一传输队列,而并不会跳转到第二传输队列,避免了队列之间的交互数据的交换。In this embodiment, the robot may configure a class of priorities for the urgent type of interaction data, and the fetch interval of this class of priorities is different from the fetch interval of the initial priority. For example, for non-emergency interactive data, the initial priority range can be a positive number, while for urgent interactive data, the configured priority range can be negative, so as to ensure The order of sending the urgent type of interaction data must take precedence over the sending order of the non-urgent type of interaction data, and in the subsequent process of adjusting the data priority of the interaction data, the non-urgent type of interaction data will not be changed to the urgent type. interactive data. For example, the first-class priority of the emergency type interactive data configuration may be -1, and when the first-class priority of the urgent type needs to be adjusted due to processing timeout, the value may be decremented by 1; The initial priority of the interactive data configuration of the type can be a positive number, such as 1 or 10. When the initial priority of the non-emergency type needs to be adjusted due to processing timeout, the value can be divided, for example, changed to the original value. One-fifth, one-half, etc. In this case, since the fetch interval of the emergency type interactive data is different from that of the non-emergency type interactive data, the emergency type interactive data is still in the second transmission queue after adjusting the priority of one type; After the initial priority is adjusted, the interactive data will be located in the first transmission queue, and will not jump to the second transmission queue, avoiding the exchange of interactive data between queues.

所述基于所述发送次序,调用数据传输信道依次发送所述第一传输队列内的各个所述交互数据至所述第二程序,包括:The step of invoking a data transmission channel to sequentially send each of the interactive data in the first transmission queue to the second program based on the sending order includes:

在S205中,若所述第二传输队列为非空,则调用数据传输信道发送所述第二传输队列内的各个所述一类优先级的交互数据至所述第二程序。In S205, if the second transmission queue is not empty, a data transmission channel is invoked to send the interaction data of each of the one type of priority in the second transmission queue to the second program.

在本实施例中,第二传输队列用于存储紧急类型的交互数据,而第一传输队列用于存储非紧急类型的交互数据,即第二传输队列的发送优先级会高于第一传输队列的发送优先级。在该情况下,第二传输队列具有抢占性,即第二传输队列内的交互数据会优先于第一传输队列的交互数据发送。因此,在通过数据传输信道发送交互数据时,会先判断该第二传输队列内是否包含待发送的交互数据,即判断该第二传输队列是否为空。若该第二传输队列为非空,即存在待发送的交互数据(由于交互数据发送完毕后,会从第一传输队列或第二传输队列中移除,因此,若上述任一类型的数据传输队列为非空,则存在待发送的交互数据),会调用数据传输信道发送该第二传输队列内各个一类优先级的交互数据。In this embodiment, the second transmission queue is used to store urgent type interactive data, and the first transmission queue is used to store non-urgent type interactive data, that is, the sending priority of the second transmission queue will be higher than that of the first transmission queue the sending priority. In this case, the second transmission queue is preemptive, that is, the interaction data in the second transmission queue is sent in priority over the interaction data in the first transmission queue. Therefore, when the interactive data is sent through the data transmission channel, it is first determined whether the second transmission queue contains the interactive data to be sent, that is, it is determined whether the second transmission queue is empty. If the second transmission queue is not empty, there is interactive data to be sent (because after the interactive data is sent, it will be removed from the first transmission queue or the second transmission queue, so if any of the above types of data transmission If the queue is not empty, there is interactive data to be sent), and the data transmission channel will be called to send interactive data of each type of priority in the second transmission queue.

在一种可能的实现方式中,数据传输信道在每完成一个交互数据的发送操作后,可以先检测该第二传输队列是否包含待发送的交互数据;若不包含,则执行S204的操作;反之,则执行S205的操作。In a possible implementation manner, the data transmission channel may first detect whether the second transmission queue contains the interactive data to be sent after completing the sending operation of each interactive data; if not, execute the operation of S204; otherwise , the operation of S205 is performed.

在一种可能的实现方式中,若第二传输队列添加有新的一类优先级的交互数据,可以向数据传输信道发送一个抢占指令,若数据传输信道当前发送的交互数据为非紧急类型的交互数据,则会停止非紧急类型的交互数据的发送流程,而马上响应第二传输队列的数据发送操作,并在第二传输队列内的所有交互数据发送完毕后,再重新发送上述停止发送的非紧急类型的交互数据。In a possible implementation manner, if a new type of priority interactive data is added to the second transmission queue, a preemption command may be sent to the data transmission channel. If the interactive data currently sent by the data transmission channel is of a non-emergency type interactive data, the sending process of non-emergency interactive data will be stopped, and the data sending operation of the second transmission queue will be immediately responded, and after all the interactive data in the second transmission queue has been sent, the above-mentioned stopped sending will be resent. Interaction data of non-urgent type.

进一步地,作为本申请的另一实施例,当一类优先级的交互数据存在多个的情况下,则S205具体可以为:基于所述第二传输队列内各个所述一类优先级的交互数据的创建时间,依次调用所述数据传输信道发送各个所述一类优先级的交互数据。Further, as another embodiment of the present application, when there are multiple interaction data of one type of priority, S205 may specifically be: interaction based on each of the one type of priority in the second transmission queue At the creation time of the data, the data transmission channel is sequentially invoked to send the interaction data of each of the priority classes.

在本实施例中,第一程序生成了多个一类优先级的交互数据时,即需要将多个一类优先级的交互数据发送给第二程序。在该情况下,机器人需要确定多个一类优先级的交互数据之间的发送次序。根据交互数据的创建时间的不同,确定在第二传输队列的次序,较早创建的交互数据在第二传输队列内的次序较前;较晚创建的交互数据在第二传输队列内的次序较后,即遵循前进先出的原则。In this embodiment, when the first program generates a plurality of interaction data of one type of priority, it is necessary to send the plurality of interaction data of one type of priority to the second program. In this case, the robot needs to determine the sending order among the interaction data of a plurality of one-class priorities. The order in the second transmission queue is determined according to the different creation time of the interactive data. The interactive data created earlier is in the first order in the second transmission queue; the interactive data created later is in the second transmission queue. After that, the principle of first-in, first-out is followed.

在一种可能的实现方式中,机器人根据一类优先级的交互数据的创建时间,在第二传输队列的初始队列次序,并为各个一类优先级的交互数据配置对应的计时器,用于统计该交互数据的发送等待时长。若该交互数据的发送等待时长大于该交互数据对应的最大等待时长,则调整该交互数据一类优先级的数值,并基于调整后的一类优先级的数值对该交互数据在第二传输队列中的初始队列次序进行调整。In a possible implementation manner, the robot configures a corresponding timer for the interactive data of each priority type in the initial queue order of the second transmission queue according to the creation time of the interactive data of one priority type, for Count the waiting time for sending the interactive data. If the sending waiting time of the interactive data is greater than the maximum waiting time corresponding to the interactive data, adjust the value of the first-class priority of the interactive data, and store the interactive data in the second transmission queue based on the adjusted value of the first-class priority. The initial queue order in is adjusted.

在本申请实施例中,通过获取各个一类优先级的交互数据的创建时间,确定其在第二传输队列的队列次序,并通过数据传输信道依次发送各个一类优先级的交互数据,从而在对应多紧急类型的交互数据时,也能够依次发送,提高了机器人控制的准确性。In the embodiment of the present application, the creation time of each type of priority interactive data is obtained, the queue order of the interactive data in the second transmission queue is determined, and the interactive data of each type of priority is sequentially sent through the data transmission channel, so that the When corresponding to multiple emergency types of interactive data, it can also be sent in sequence, which improves the accuracy of robot control.

所述S204具体为:若所述第二传输队列为空,则基于所述发送次序,调用数据传输信道依次发送所述第一传输队列内的各个所述交互数据至所述第二程序。The S204 is specifically: if the second transmission queue is empty, calling a data transmission channel to sequentially send each of the interactive data in the first transmission queue to the second program based on the sending order.

与上述发送操作对应地,第二程序在处理交互数据的过程中,也可以参见发送过程,为不同类型的交互数据配置对应的数据处理队列。具体地,处理流程包括:Corresponding to the above sending operation, in the process of processing the interactive data, the second program may also refer to the sending process to configure corresponding data processing queues for different types of interactive data. Specifically, the processing flow includes:

1.若所述交互数据的数据类型为非紧急类型,则基于预设的优先级索引表,确定所述交互数据的第一处理优先级,根据所述第一处理优先级确定所述交互数据在第一处理队列内的处理次序;1. If the data type of the interaction data is a non-emergency type, determine the first processing priority of the interaction data based on a preset priority index table, and determine the interaction data according to the first processing priority the processing order in the first processing queue;

2.若所述交互数据的数据类型为紧急类型,则确定所述交互数据为第二处理优先级,将第二处理优先级的交互数据添加到第二处理队列;2. If the data type of the interaction data is an emergency type, determine that the interaction data is the second processing priority, and add the interaction data of the second processing priority to the second processing queue;

3.若所述第二处理队列为非空,则调用第二程序处理所述第二传输队列内的各个第二处理优先级的交互数据;3. If the second processing queue is not empty, call the second program to process the interactive data of each second processing priority in the second transmission queue;

4.若所述第二处理队列为空,则基于所述处理次序,调用数据第二程序依次处理所述第一处理队列内的各个所述交互数据。4. If the second processing queue is empty, based on the processing order, the second data program is invoked to sequentially process each of the interaction data in the first processing queue.

示例性地,图4示出了本申请一实施例提供的程序间的交互流程图。参见图4所示,该第一程序包含有两个数据传输队列,分别为第一传输队列MQ以及第二传输队列FMQ,对应地,第二程序也配置有两个数据处理队列,分别为第一处理队列MQ’以及第二处理队列FMQ’。上述两个程序之间配置有数据传输信道,用于上述两个程序之间进行数据交互。即第一程序可以将非紧急类型的交互数据添加到MQ,将紧急类型的交互数据添加到FMQ。通过数据传输信道传输上述两个数据传输队列的交互数据,将MQ内的交互数据添加到MQ’,将FMQ内的交互数据添加到FMQ’。上述两个队列的发送过程均使用同一数据传输信道,在FMQ存在待发送的交互数据时,机器人会调用数据传输信道发送FMQ内的交互数据;若FMQ不存在待发送的交互数据,则机器人会调用数据传输信道发送MQ内的交互数据。Exemplarily, FIG. 4 shows a flowchart of interaction between programs provided by an embodiment of the present application. Referring to FIG. 4 , the first program includes two data transmission queues, namely the first transmission queue MQ and the second transmission queue FMQ. Correspondingly, the second program is also configured with two data processing queues, which are the first transmission queue MQ and the second transmission queue FMQ respectively. A processing queue MQ' and a second processing queue FMQ'. A data transmission channel is configured between the above two programs for data interaction between the above two programs. That is, the first program can add non-urgent type interaction data to MQ, and add urgent type interaction data to FMQ. The interaction data of the above two data transmission queues is transmitted through the data transmission channel, the interaction data in the MQ is added to MQ', and the interaction data in the FMQ is added to FMQ'. The sending process of the above two queues uses the same data transmission channel. When there is interactive data to be sent in FMQ, the robot will call the data transmission channel to send the interactive data in FMQ; if there is no interactive data to be sent in FMQ, the robot will Call the data transmission channel to send interactive data within MQ.

示例性地,表1示出了本申请一实施例提供的交互数据的结构示意图。参见表1所示,该交互数据包含有7个参数项,用于记录交互数据多项信息。上述参数项包括有:数据首部、数据类型、数据优先级、最大等待时长、发送队列添加时间、数据发送时间以及数据内容。其中,数据首部用于确定该数据是否为交互数据;最大等待时长用于确定在数据传输队列中最大等待时间,若超过此时间,交互数据还未处理,此交互数据将会提高数据优先级,重新能够在数据传输队列内的次序;发送队列添加时间用于确定交互数据添加到数据传输队列的时间;数据发送时间用于确定交互数据发送给第二程序的时间;数据内容用于记录该交互数据具体所需发送的内容。Exemplarily, Table 1 shows a schematic structural diagram of interaction data provided by an embodiment of the present application. As shown in Table 1, the interaction data includes 7 parameter items, which are used to record multiple pieces of information of the interaction data. The above parameter items include: data header, data type, data priority, maximum waiting time, sending queue adding time, data sending time and data content. Among them, the data header is used to determine whether the data is interactive data; the maximum waiting time is used to determine the maximum waiting time in the data transmission queue. If this time is exceeded, the interactive data has not been processed, and the interactive data will increase the data priority. Re-enable order in the data transmission queue; send queue addition time is used to determine the time when interactive data is added to the data transmission queue; data transmission time is used to determine the time when interactive data is sent to the second program; data content is used to record the interaction The specific content of the data to be sent.

Figure BDA0002582187370000141
Figure BDA0002582187370000141

表1Table 1

在本申请实施例中,为不同类型的交互数据配置不同的数据传输队列,对于紧急类型的交互数据采用抢占式的发送方式,从而能够提高实时性要求较高的交互数据发送操作的即时性。In the embodiment of the present application, different data transmission queues are configured for different types of interactive data, and a preemptive transmission method is adopted for the urgent type of interactive data, thereby improving the immediacy of the interactive data sending operation with high real-time requirements.

图5示出了本申请第三实施例提供的一种数据传输的方法S102现流程图。参见图5,相对于图1至图3任一所述实施例,本实施例提供的一种数据传输的方法S102包括:S501~S502,具体详述如下:FIG. 5 shows a current flow chart of a data transmission method S102 provided by the third embodiment of the present application. Referring to FIG. 5 , with respect to any of the embodiments described in FIG. 1 to FIG. 3 , a data transmission method S102 provided in this embodiment includes: S501 to S502 , which are described in detail as follows:

进一步地,所述根据所述交互数据的数据类型,确定所述交互数据的数据优先级,包括:Further, determining the data priority of the interaction data according to the data type of the interaction data includes:

在S501中,确定所述交互数据的发送等待时长。In S501, a waiting period for sending the interaction data is determined.

在本实施例中,若交互数据的数量较多,则需要根据各个交互数据的数据优先级,依次对交互数据进行发送。因此,在交互数据发送由第一程序发送给第二程序之前,处于等待发送的状态,机器人获取该交互数据的发送等待时长。In this embodiment, if the quantity of interactive data is large, the interactive data needs to be sent in sequence according to the data priority of each interactive data. Therefore, before the interactive data is sent by the first program to the second program, it is in a state of waiting for sending, and the robot obtains the sending waiting time of the interactive data.

在本实施例中,若发送等待时长小于或等于发送时长阈值,则会保持该交互数据的数据优先级;反之,若发送等待时长大于上述发送时长阈值,则执行S502的操作。In this embodiment, if the sending waiting time is less than or equal to the sending time threshold, the data priority of the interactive data will be maintained; otherwise, if the sending waiting time is greater than the above sending time threshold, the operation of S502 is performed.

在S502中,若所述发送等待时长大于所述交互数据对应的发送时长阈值,则调整所述数据优先级。In S502, if the sending waiting duration is greater than the sending duration threshold corresponding to the interactive data, the data priority is adjusted.

在本实施例中,当交易数据长时间未被发送,且该交易数据的发送等待时长会大于发送时长阈值,此时,机器人为了避免优先级较低的交互数据长时间被优先级较高的交互数据插队,影响优先级较低的交互数据的传输,会对长时间未发送的交互数据的数据优先级进行调整。调整的方式具体为减少数据优先级的参数值,以提高发送等待超时的交互数据的数据优先级。In this embodiment, when transaction data has not been sent for a long time, and the waiting time for sending the transaction data will be greater than the sending time threshold, at this time, in order to avoid interaction data with lower priority being sent by the robot with higher priority for a long time Interaction data is queued, which affects the transmission of interaction data with lower priority, and adjusts the data priority of interaction data that has not been sent for a long time. Specifically, the adjustment method is to reduce the parameter value of the data priority, so as to increase the data priority of sending interactive data waiting for a timeout.

举例性地,调整数据优先级的方式可以为:FATAL类消息默认优先级为-1,每次超时,优先级数值会减1;EMERG类消息默认优先级为1,每次超时,优先级数值会变为之前的1/5;IMPORT类消息默认优先级为10,每次超时,优先级数值会变为之前的1/4;NORMAL类消息默认优先级为100,每次超时,优先级数值会变为之前的1/3:INFO类消息默认优先级为1000,每次超时,优先级数值会变为之前的1/2。For example, the way to adjust the data priority can be: the default priority of FATAL type messages is -1, and the priority value will be reduced by 1 each time it times out; the default priority value of EMERG type messages is 1, and each time out, the priority value value It will become 1/5 of the previous value; the default priority of IMPORT type messages is 10, and each time out, the priority value will become 1/4 of the previous value; the default priority of NORMAL type messages is 100, and each time out, the priority value value It will become 1/3 of the previous: The default priority of INFO messages is 1000. Each time out, the priority value will become 1/2 of the previous value.

在本实施例中,在调整了数据优先级后,机器人可以对该交互数据的发送等待时长进行清零,重新进行计数。若该交互数据的发送等待时长再次大于发送等待时长,则会再次调整该交互数据的数据优先级,直到交互数据发送至第二程序。In this embodiment, after the data priority is adjusted, the robot can reset the waiting time for sending the interactive data to zero, and count again. If the waiting time for sending the interactive data is longer than the waiting time for sending again, the data priority of the interactive data is adjusted again until the interactive data is sent to the second program.

在本申请实施例中,通过配置发送等待时长,在交互数据长时间未发送的情况下,调整数据优先级,避免实时性要求较低的交互数据无法发送至第二程序的情况。In the embodiment of the present application, by configuring the sending waiting time, when the interactive data is not sent for a long time, the data priority is adjusted to avoid the situation that the interactive data with low real-time requirements cannot be sent to the second program.

图6示出了本申请第四实施例提供的一种数据传输的方法S104的具体实现流程图。参见图6,相对于图1至图3任一所述实施例,本实施例提供的一种数据传输的方法S104包括:S601~S602,具体详述如下:FIG. 6 shows a specific implementation flowchart of a data transmission method S104 provided by the fourth embodiment of the present application. Referring to FIG. 6 , with respect to any of the embodiments described in FIG. 1 to FIG. 3 , a data transmission method S104 provided in this embodiment includes: S601 to S602 , which are described in detail as follows:

进一步地,所述根据所述数据优先级确定所述交互数据在所述第二程序内的处理次序,并通过所述第二程序输出所述交互数据的交互应答信息,包括:Further, determining the processing order of the interaction data in the second program according to the data priority, and outputting interaction response information of the interaction data through the second program, includes:

在S601中,确定所述交互数据的处理等待时长。In S601, the processing waiting time of the interaction data is determined.

在本实施例中,若交互数据的数量较多,则第二程序需要根据各个交互数据的处理次序,依次对交互数据进行处理。因此,在第二程序处理交互数据之前,处于等待处理的状态,机器人获取该交互数据的处理等待时长。In this embodiment, if the quantity of interactive data is large, the second program needs to process the interactive data in sequence according to the processing order of each interactive data. Therefore, before the second program processes the interaction data, it is in a state of waiting for processing, and the robot obtains the processing waiting time of the interaction data.

在本实施例中,若处理等待时长小于或等于处理时长阈值,则会保持该交互数据的处理次序;反之,若处理等待时长大于上述处理时长阈值,则执行S602的操作。In this embodiment, if the processing waiting time is less than or equal to the processing time threshold, the processing order of the interactive data will be maintained; otherwise, if the processing waiting time is greater than the above-mentioned processing time threshold, the operation of S602 is performed.

在S602中,若所述处理等待时长大于所述交互数据对应的处理时长阈值,则调整所述处理次序。In S602, if the processing waiting duration is greater than the processing duration threshold corresponding to the interaction data, the processing order is adjusted.

在本实施例中,当交易数据长时间未被处理,且该交易数据的处理等待时长会大于处理时长阈值,此时,机器人为了避免优先级较低的交互数据长时间被优先级较高的交互数据插队,影响优先级较低的交互数据的响应,会对长时间未处理的交互数据的处理次序进行调整。调整的方式具体为减少待处理的交互数据的处理优先级的参数值,基于调整后的处理优先级确定各个交互数据的处理次序。In this embodiment, when the transaction data has not been processed for a long time, and the processing waiting time of the transaction data will be greater than the processing time threshold, at this time, in order to avoid the interaction data with lower priority being processed for a long time by the robot with higher priority Interaction data jumping in the queue affects the response of interaction data with lower priority, and adjusts the processing order of interaction data that has not been processed for a long time. The adjustment method is specifically to reduce the parameter value of the processing priority of the interaction data to be processed, and determine the processing order of each interaction data based on the adjusted processing priority.

举例性地,调整处理优先级的方式可以为:FATAL类消息默认优先级为-1,每次超时,优先级数值会减1;EMERG类消息默认优先级为1,每次超时,优先级数值会变为之前的1/5;IMPORT类消息默认优先级为10,每次超时,优先级数值会变为之前的1/4;NORMAL类消息默认优先级为100,每次超时,优先级数值会变为之前的1/3:INFO类消息默认优先级为1000,每次超时,优先级数值会变为之前的1/2。For example, the method of adjusting the processing priority may be: the default priority of FATAL type messages is -1, and the priority value will be reduced by 1 each time it times out; the default priority value of EMERG type messages is 1, and each time out, the priority value value It will become 1/5 of the previous value; the default priority of IMPORT type messages is 10, and each time out, the priority value will become 1/4 of the previous value; the default priority of NORMAL type messages is 100, and each time out, the priority value value It will become 1/3 of the previous: The default priority of INFO messages is 1000. Each time out, the priority value will become 1/2 of the previous value.

在本实施例中,在调整了处理次序后,机器人可以对该交互数据的处理等待时长进行清零,重新进行计数。若该交互数据的处理等待时长再次大于处理等待时长,则会再次调整该交互数据的处理次序,直到交互数据被第二程序处理。In this embodiment, after the processing sequence is adjusted, the robot can reset the waiting time for processing the interaction data and start counting again. If the processing waiting time of the interactive data is longer than the processing waiting time again, the processing order of the interactive data will be adjusted again until the interactive data is processed by the second program.

在本申请实施例中,通过配置处理等待时长,在交互数据长时间未被处理的情况下,调整处理次序,避免实时性要求较低的交互数据无法被第二程序处理的情况。In the embodiment of the present application, by configuring the processing waiting time, when the interactive data has not been processed for a long time, the processing order is adjusted to avoid the situation that the interactive data with low real-time requirements cannot be processed by the second program.

图7示出了本申请第五实施例提供的一种数据传输的方法S101的具体实现流程图。参见图7,相对于图1至图3任一所述实施例,本实施例提供的一种数据传输的方法的S101包括:S701~S703,具体详述如下:FIG. 7 shows a specific implementation flowchart of a data transmission method S101 provided by the fifth embodiment of the present application. Referring to FIG. 7 , with respect to any of the embodiments described in FIG. 1 to FIG. 3 , S101 of a data transmission method provided in this embodiment includes: S701 to S703 , which are described in detail as follows:

进一步地,所述获得由第一程序生成的交互数据,包括:Further, the obtaining the interaction data generated by the first program includes:

在S701中,确定所述第一程序的第一接口号以及所述第二程序的第二接口号。In S701, a first interface number of the first program and a second interface number of the second program are determined.

在本实施例中,机器人可以采用套接字socket的方式传输交互数据,基于此,机器人需要生成与socket方式匹配的交互数据,需要确定通信双端的接口号,因此,机器人会确定预先为第一程序以及第二程序配置的虚拟接口号,及上述的第一接口号以及第二接口号。In this embodiment, the robot can transmit interactive data in the form of socket sockets. Based on this, the robot needs to generate interactive data matching the socket mode, and needs to determine the interface numbers of both ends of the communication. Therefore, the robot will determine the first one in advance. The virtual interface number configured by the program and the second program, and the above-mentioned first interface number and second interface number.

在S702中,基于所述第一接口号以及所述第二接口号确定数据首部信息。In S702, data header information is determined based on the first interface number and the second interface number.

在本实施例中,机器人根据第一接口号与第二接口号进行封装,得到交互数据的数据首部信息,数据传输信道可以根据该数据首部进行寻址,确定所需通信的第二程序。In this embodiment, the robot encapsulates the first interface number and the second interface number to obtain the data header information of the interactive data, and the data transmission channel can be addressed according to the data header to determine the second program required for communication.

在S703中,将所述第一程序生成的交互内容以及所述数据首部信息进行封装,得到所述交互数据。In S703, the interactive content generated by the first program and the data header information are encapsulated to obtain the interactive data.

在本实施例中,机器人将交互内容以及数据首部进行封装,生成适用于socket方式的交互数据,通过基于socket搭建的数据传输信道将交互数据从第一程序发送至第二程序。In this embodiment, the robot encapsulates the interactive content and the data header to generate interactive data suitable for sockets, and sends the interactive data from the first program to the second program through a data transmission channel built on the socket.

在本申请实施例中,通过确定第一程序以及第二程序的接口号,从而生成适用于socket方式的交互数据,提高了数据传输过程的寻址效率。In the embodiment of the present application, by determining the interface numbers of the first program and the second program, interactive data suitable for the socket mode is generated, and the addressing efficiency of the data transmission process is improved.

应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

图8示出了本申请一实施例提供的一种数据传输的装置的结构框图,该数据传输的装置包括的各单元用于执行图1对应的实施例中的各步骤。具体请参阅图8与图1所对应的实施例中的相关描述。为了便于说明,仅示出了与本实施例相关的部分。FIG. 8 shows a structural block diagram of an apparatus for data transmission provided by an embodiment of the present application, where each unit included in the apparatus for data transmission is used to execute each step in the embodiment corresponding to FIG. 1 . For details, please refer to the relevant descriptions in the embodiments corresponding to FIG. 8 and FIG. 1 . For convenience of explanation, only the parts related to this embodiment are shown.

参见图8,所述数据传输的装置包括:Referring to Figure 8, the data transmission device includes:

交互数据获取单元81,用于获得由第一程序生成的交互数据;An interactiondata acquisition unit 81, configured to acquire interaction data generated by the first program;

数据优先级确定单元82,用于根据所述交互数据的数据类型,确定所述交互数据的数据优先级;A datapriority determination unit 82, configured to determine the data priority of the interaction data according to the data type of the interaction data;

数据传输单元83,用于基于所述数据优先级调用数据传输信道传输所述交互数据至第二程序;adata transmission unit 83, configured to invoke a data transmission channel based on the data priority to transmit the interaction data to the second program;

数据应答单元84,用于根据所述数据优先级确定所述交互数据在所述第二程序内的处理次序,并通过所述第二程序输出所述交互数据的交互应答信息。Thedata response unit 84 is configured to determine the processing order of the interaction data in the second program according to the data priority, and output interaction response information of the interaction data through the second program.

可选地,所述数据优先级确定单元82具体用于:Optionally, the datapriority determination unit 82 is specifically configured to:

若所述交互数据的数据类型为非紧急类型,则基于预设的优先级索引表,确定所述交互数据的初始优先级;If the data type of the interaction data is a non-emergency type, determining the initial priority of the interaction data based on a preset priority index table;

所述数据传输单元83,包括:Thedata transmission unit 83 includes:

发送次序确定单元,用于根据所述初始优先级确定所述交互数据在第一传输队列内的发送次序;a sending order determining unit, configured to determine the sending order of the interaction data in the first transmission queue according to the initial priority;

第一数据发送单元,用于基于所述发送次序,调用数据传输信道依次发送所述第一传输队列内的各个所述交互数据至所述第二程序。A first data sending unit, configured to call a data transmission channel to sequentially send each of the interactive data in the first transmission queue to the second program based on the sending order.

可选地,所述数据优先级确定单元82还用于:Optionally, the datapriority determination unit 82 is further configured to:

若所述交互数据的数据类型为紧急类型,则将所述数据优先级设置为一类优先级,并将一类优先级的交互数据添加到第二传输队列;If the data type of the interaction data is an emergency type, the data priority is set to a priority of a class, and the interaction data of a priority of a class is added to the second transmission queue;

所述数据传输单元83,还包括Thedata transmission unit 83 also includes

第二数据发送单元,用于若所述第二传输队列为非空,则调用数据传输信道发送所述第二传输队列内的各个所述一类优先级的交互数据至所述第二程序;a second data sending unit, configured to call a data transmission channel to send the interaction data of each of the first types of priorities in the second transmission queue to the second program if the second transmission queue is not empty;

所述第一数据发送单元,具体用于若所述第二传输队列为空,则基于所述发送次序,调用数据传输信道依次发送所述第一传输队列内的各个所述交互数据至所述第二程序。The first data sending unit is specifically configured to, if the second transmission queue is empty, call a data transmission channel to sequentially send each of the interactive data in the first transmission queue to the Second program.

可选地,所述第二数据发送单元具体用于:Optionally, the second data sending unit is specifically used for:

基于所述第二传输队列内各个所述一类优先级的交互数据的创建时间,依次调用所述数据传输信道发送各个所述一类优先级的交互数据。Based on the creation time of the interactive data of each of the one-class priorities in the second transmission queue, the data transmission channel is sequentially invoked to send the interactive data of each of the one-class priorities.

可选地,所述数据优先级确定单元82包括:Optionally, the datapriority determination unit 82 includes:

发送等待时长确定单元,用于确定所述交互数据的发送等待时长;a sending waiting time determination unit, used to determine the sending waiting time of the interactive data;

数据优先级调整单元,用于若所述发送等待时长大于所述交互数据对应的发送时长阈值,则调整所述数据优先级。A data priority adjustment unit, configured to adjust the data priority if the transmission waiting duration is greater than the transmission duration threshold corresponding to the interactive data.

可选地,所述数据应答单元84包括:Optionally, thedata response unit 84 includes:

处理等待时长确定单元,用于确定所述交互数据的处理等待时长;a processing waiting duration determination unit, used for determining the processing waiting duration of the interaction data;

处理次序调整单元,用于若所述处理等待时长大于所述交互数据对应的处理时长阈值,则调整所述处理次序。A processing order adjustment unit, configured to adjust the processing order if the processing waiting duration is greater than the processing duration threshold corresponding to the interaction data.

可选地,所述交互数据获取单元81还包括:Optionally, the interactiondata acquisition unit 81 further includes:

接口号确定单元,用于确定所述第一程序的第一接口号以及所述第二程序的第二接口号;an interface number determination unit, configured to determine the first interface number of the first program and the second interface number of the second program;

首部信息生成单元,用于基于所述第一接口号以及所述第二接口号确定数据首部信息;a header information generating unit, configured to determine data header information based on the first interface number and the second interface number;

交易数据封装单元,用于将所述第一程序生成的交互内容以及所述数据首部信息进行封装,得到所述交互数据。A transaction data encapsulation unit, configured to encapsulate the interactive content generated by the first program and the data header information to obtain the interactive data.

因此,本申请实施例提供的数据传输的设备同样可以减少了不同模块之间耦合度的同时,也能够通过创建数据传输信道实现模块之间的数据交互,满足了部分功能需要多个模块协同运作的要求,提高机器人可实现功能的多样性。Therefore, the data transmission device provided in the embodiment of the present application can also reduce the coupling degree between different modules, and also realize data interaction between modules by creating a data transmission channel, which satisfies some functions that require multiple modules to work together. requirements to improve the diversity of functions that the robot can achieve.

图9是本申请另一实施例提供的一种机器人的示意图。如图9所示,该实施例的机器人9包括:处理器90、存储器91以及存储在所述存储器91中并可在所述处理器90上运行的计算机程序92,例如数据传输的程序。所述处理器90执行所述计算机程序92时实现上述各个数据传输的方法实施例中的步骤,例如图1所示的S101至S104。或者,所述处理器90执行所述计算机程序92时实现上述各装置实施例中各单元的功能,例如图8所示模块81至84功能。FIG. 9 is a schematic diagram of a robot provided by another embodiment of the present application. As shown in FIG. 9 , the robot 9 of this embodiment includes aprocessor 90 , amemory 91 , and acomputer program 92 stored in thememory 91 and executable on theprocessor 90 , such as a data transmission program. When theprocessor 90 executes thecomputer program 92 , the steps in each of the foregoing method embodiments for data transmission are implemented, for example, S101 to S104 shown in FIG. 1 . Alternatively, when theprocessor 90 executes thecomputer program 92, the functions of the units in the above-mentioned apparatus embodiments, such as the functions of themodules 81 to 84 shown in FIG. 8, are implemented.

示例性的,所述计算机程序92可以被分割成一个或多个单元,所述一个或者多个单元被存储在所述存储器91中,并由所述处理器90执行,以完成本申请。所述一个或多个单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序92在所述机器人9中的执行过程。例如,所述计算机程序92可以被分割成交互数据获取单元、数据优先级确定单元、数据传输单元以及数据应答单元,各单元具体功能如上所述。Exemplarily, thecomputer program 92 may be divided into one or more units, and the one or more units are stored in thememory 91 and executed by theprocessor 90 to complete the present application. The one or more units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of thecomputer program 92 in the robot 9 . For example, thecomputer program 92 can be divided into an interactive data acquisition unit, a data priority determination unit, a data transmission unit and a data response unit, and the specific functions of each unit are as described above.

所述机器人9可以是桌上型计算机、笔记本、掌上电脑、智能机器人及云端服务器等计算设备。所述机器人可包括,但不仅限于,处理器90、存储器91。本领域技术人员可以理解,图9仅仅是机器人9的示例,并不构成对机器人9的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述机器人还可以包括输入输出设备、网络接入设备、总线等。The robot 9 may be a computing device such as a desktop computer, a notebook, a palmtop computer, an intelligent robot, and a cloud server. The robot may include, but is not limited to, aprocessor 90 and amemory 91 . Those skilled in the art can understand that FIG. 9 is only an example of the robot 9, and does not constitute a limitation to the robot 9. It may include more or less components than the one shown in the figure, or combine some components, or different components, such as The robot may also include input and output devices, network access devices, buses, and the like.

所称处理器90可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-calledprocessor 90 may be a central processing unit (Central Processing Unit, CPU), and may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.

所述存储器91可以是所述机器人9的内部存储单元,例如机器人9的硬盘或内存。所述存储器91也可以是所述机器人9的外部存储设备,例如所述机器人9上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器91还可以既包括所述机器人9的内部存储单元也包括外部存储设备。所述存储器91用于存储所述计算机程序以及所述机器人所需的其他程序和数据。所述存储器91还可以用于暂时地存储已经输出或者将要输出的数据。Thememory 91 may be an internal storage unit of the robot 9 , such as a hard disk or a memory of the robot 9 . Thememory 91 may also be an external storage device of the robot 9, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card equipped on the robot 9, Flash card (Flash Card) and so on. Further, thememory 91 may also include both an internal storage unit of the robot 9 and an external storage device. Thememory 91 is used to store the computer program and other programs and data required by the robot. Thememory 91 can also be used to temporarily store data that has been output or will be output.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.

以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the above-mentioned embodiments, those of ordinary skill in the art should understand that: it is still possible to implement the above-mentioned implementations. The technical solutions described in the examples are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions in the embodiments of the application, and should be included in the within the scope of protection of this application.

Claims (10)

Translated fromChinese
1.一种数据传输的方法,其特征在于,包括:1. a method for data transmission, characterized in that, comprising:获得由第一程序生成的交互数据;obtaining interaction data generated by the first program;根据所述交互数据的数据类型,确定所述交互数据的数据优先级;determining the data priority of the interaction data according to the data type of the interaction data;基于所述数据优先级调用数据传输信道传输所述交互数据至第二程序;Invoke a data transmission channel to transmit the interaction data to the second program based on the data priority;根据所述数据优先级确定所述交互数据在所述第二程序内的处理次序,并通过所述第二程序输出所述交互数据的交互应答信息。The processing order of the interaction data in the second program is determined according to the data priority, and interaction response information of the interaction data is output through the second program.2.根据权利要求1所述的方法,其特征在于,所述根据所述交互数据的数据类型,确定所述交互数据的数据优先级,包括:2. The method according to claim 1, wherein the determining the data priority of the interaction data according to the data type of the interaction data comprises:若所述交互数据的数据类型为非紧急类型,则基于预设的优先级索引表,确定所述交互数据的初始优先级,并将所述交互数据添加到第一传输队列;If the data type of the interaction data is a non-emergency type, determining the initial priority of the interaction data based on a preset priority index table, and adding the interaction data to the first transmission queue;所述基于所述数据优先级调用数据传输信道传输所述交互数据至第二程序,包括:The invoking a data transmission channel based on the data priority to transmit the interaction data to the second program includes:根据所述初始优先级确定所述交互数据在第一传输队列内的发送次序;determining the sending order of the interaction data in the first transmission queue according to the initial priority;基于所述发送次序,调用数据传输信道依次发送所述第一传输队列内的各个所述交互数据至所述第二程序。Based on the sending order, a data transmission channel is invoked to sequentially send each of the interaction data in the first transmission queue to the second program.3.根据权利要求2所述的方法,其特征在于,所述根据所述交互数据的数据类型,确定所述交互数据的数据优先级,包括:3. The method according to claim 2, wherein the determining the data priority of the interaction data according to the data type of the interaction data comprises:若所述交互数据的数据类型为紧急类型,则将所述数据优先级设置为一类优先级,并将一类优先级的交互数据添加到第二传输队列;If the data type of the interaction data is an emergency type, the data priority is set to a priority of a class, and the interaction data of a priority of a class is added to the second transmission queue;所述基于所述数据优先级调用数据传输信道传输所述交互数据至第二程序,包括:The invoking a data transmission channel based on the data priority to transmit the interaction data to the second program includes:若所述第二传输队列为非空,则调用数据传输信道发送所述第二传输队列内的各个所述一类优先级的交互数据至所述第二程序;If the second transmission queue is not empty, invoking a data transmission channel to send the interaction data of each of the first types of priorities in the second transmission queue to the second program;若所述第二传输队列为空,则基于所述发送次序,调用数据传输信道依次发送所述第一传输队列内的各个所述交互数据至所述第二程序。If the second transmission queue is empty, based on the sending order, a data transmission channel is invoked to sequentially send each of the interactive data in the first transmission queue to the second program.4.根据权利要求3所述的方法,其特征在于,所述若所述第二传输队列为非空,则调用数据传输信道发送所述第二传输队列内的各个所述一类优先级的交互数据至所述第二程序,包括:4. The method according to claim 3, wherein if the second transmission queue is non-empty, calling a data transmission channel to send each type of priority in the second transmission queue. Interaction data to the second program, including:基于所述第二传输队列内各个所述一类优先级的交互数据的创建时间,依次调用所述数据传输信道发送各个所述一类优先级的交互数据。Based on the creation time of the interactive data of each of the one-class priorities in the second transmission queue, the data transmission channel is sequentially invoked to send the interactive data of each of the one-class priorities.5.根据权利要求1-4任一项所述的方法,其特征在于,所述根据所述交互数据的数据类型,确定所述交互数据的数据优先级,包括:5. The method according to any one of claims 1-4, wherein the determining the data priority of the interaction data according to the data type of the interaction data comprises:确定所述交互数据的发送等待时长;determining the waiting time for sending the interaction data;若所述发送等待时长大于所述交互数据对应的发送时长阈值,则调整所述数据优先级。If the sending waiting duration is greater than the sending duration threshold corresponding to the interactive data, the data priority is adjusted.6.根据权利要求1-4任一项所述的方法,其特征在于,所述根据所述数据优先级确定所述交互数据在所述第二程序内的处理次序,并通过所述第二程序输出所述交互数据的交互应答信息,包括:6. The method according to any one of claims 1-4, wherein the processing order of the interaction data in the second program is determined according to the data priority, and the second program is processed through the second The program outputs interactive response information of the interactive data, including:确定所述交互数据的处理等待时长;determining the processing waiting time of the interaction data;若所述处理等待时长大于所述交互数据对应的处理时长阈值,则调整所述处理次序。If the processing waiting duration is greater than the processing duration threshold corresponding to the interaction data, the processing order is adjusted.7.根据权利要求1-4任一项所述的方法,其特征在于,所述获得由第一程序生成的交互数据,包括:7. The method according to any one of claims 1-4, wherein the obtaining the interaction data generated by the first program comprises:确定所述第一程序的第一接口号以及所述第二程序的第二接口号;determining the first interface number of the first program and the second interface number of the second program;基于所述第一接口号以及所述第二接口号确定数据首部信息;determining data header information based on the first interface number and the second interface number;将所述第一程序生成的交互内容以及所述数据首部信息进行封装,得到所述交互数据。The interaction content and the data header information generated by the first program are encapsulated to obtain the interaction data.8.一种数据传输的装置,其特征在于,包括:8. A device for data transmission, comprising:交互数据获取单元,用于获得由第一程序生成的交互数据;an interaction data acquisition unit, used for acquiring interaction data generated by the first program;数据优先级确定单元,用于根据所述交互数据的数据类型,确定所述交互数据的数据优先级;a data priority determining unit, configured to determine the data priority of the interaction data according to the data type of the interaction data;数据传输单元,用于基于所述数据优先级调用数据传输信道传输所述交互数据至第二程序;a data transmission unit for invoking a data transmission channel to transmit the interaction data to the second program based on the data priority;数据应答单元,用于根据所述数据优先级确定所述交互数据在所述第二程序内的处理次序,并通过所述第二程序输出所述交互数据的交互应答信息。A data response unit, configured to determine the processing order of the interaction data in the second program according to the data priority, and output interaction response information of the interaction data through the second program.9.一种机器人,其特征在于,所述机器人包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时如权利要求1至7任一项所述方法的步骤。9. A robot, characterized in that the robot comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program as claimed in the right The steps of any one of claims 1 to 7 of the method.10.一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述方法的步骤。10. A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented .
CN202010670765.1A2020-07-132020-07-13Data transmission method and robotPendingCN112000446A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202010670765.1ACN112000446A (en)2020-07-132020-07-13Data transmission method and robot

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202010670765.1ACN112000446A (en)2020-07-132020-07-13Data transmission method and robot

Publications (1)

Publication NumberPublication Date
CN112000446Atrue CN112000446A (en)2020-11-27

Family

ID=73467595

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202010670765.1APendingCN112000446A (en)2020-07-132020-07-13Data transmission method and robot

Country Status (1)

CountryLink
CN (1)CN112000446A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN112260881A (en)*2020-12-212021-01-22长沙树根互联技术有限公司Data transmission method and device, electronic equipment and readable storage medium
CN114428693A (en)*2022-03-312022-05-03季华实验室Method and device for adjusting message priority, electronic equipment and storage medium
CN115348325A (en)*2022-08-242022-11-15中国电子科技集团公司第十五研究所 A multi-channel real-time transmission priority control method and system

Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN103986666A (en)*2013-02-072014-08-13华为技术有限公司 A data processing method, device and system
CN107832126A (en)*2017-10-202018-03-23平安科技(深圳)有限公司The method of adjustment and its terminal of a kind of thread
CN108124002A (en)*2017-12-012018-06-05北京明朝万达科技股份有限公司A kind of data transmission method for uplink and device
CN108124284A (en)*2017-12-062018-06-05青岛真时科技有限公司A kind of Bluetooth data transfer method and apparatus
CN109088829A (en)*2018-09-202018-12-25南方科技大学Data scheduling method, device, storage medium and equipment
CN109286578A (en)*2018-09-272019-01-29上海联寓智能科技有限公司Message treatment method, device, gateway and storage medium
CN110532259A (en)*2019-07-222019-12-03中国平安人寿保险股份有限公司Base table querying method, device, computer equipment and storage medium
CN110753098A (en)*2019-10-122020-02-04北京达佳互联信息技术有限公司Download request execution method and device, server and storage medium
CN111181873A (en)*2019-12-312020-05-19新奥数能科技有限公司Data transmission method, data transmission device, storage medium and electronic equipment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN103986666A (en)*2013-02-072014-08-13华为技术有限公司 A data processing method, device and system
CN107832126A (en)*2017-10-202018-03-23平安科技(深圳)有限公司The method of adjustment and its terminal of a kind of thread
CN108124002A (en)*2017-12-012018-06-05北京明朝万达科技股份有限公司A kind of data transmission method for uplink and device
CN108124284A (en)*2017-12-062018-06-05青岛真时科技有限公司A kind of Bluetooth data transfer method and apparatus
CN109088829A (en)*2018-09-202018-12-25南方科技大学Data scheduling method, device, storage medium and equipment
CN109286578A (en)*2018-09-272019-01-29上海联寓智能科技有限公司Message treatment method, device, gateway and storage medium
CN110532259A (en)*2019-07-222019-12-03中国平安人寿保险股份有限公司Base table querying method, device, computer equipment and storage medium
CN110753098A (en)*2019-10-122020-02-04北京达佳互联信息技术有限公司Download request execution method and device, server and storage medium
CN111181873A (en)*2019-12-312020-05-19新奥数能科技有限公司Data transmission method, data transmission device, storage medium and electronic equipment

Cited By (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN112260881A (en)*2020-12-212021-01-22长沙树根互联技术有限公司Data transmission method and device, electronic equipment and readable storage medium
CN112260881B (en)*2020-12-212021-04-02长沙树根互联技术有限公司Data transmission method and device, electronic equipment and readable storage medium
CN114428693A (en)*2022-03-312022-05-03季华实验室Method and device for adjusting message priority, electronic equipment and storage medium
CN115348325A (en)*2022-08-242022-11-15中国电子科技集团公司第十五研究所 A multi-channel real-time transmission priority control method and system
CN115348325B (en)*2022-08-242024-01-23中国电子科技集团公司第十五研究所Multichannel real-time transmission priority management and control method and system

Similar Documents

PublicationPublication DateTitle
US11489791B2 (en)Virtual switch scaling for networking applications
CN112000446A (en)Data transmission method and robot
CN105024942B (en)A kind of dynamic flow monitoring method
EP2506147A2 (en)Epoll optimisations
EP3644182B1 (en)Container isolation method and device for netlink resource
CN110750341A (en) Task scheduling method, device, system, terminal device and storage medium
CN113986811B (en)High-performance kernel mode network data packet acceleration method
CN112099975A (en) A message processing method and system, and storage medium
WO2024088268A1 (en)Rdma event management methods, and device and storage medium
CN115361451B (en) A network communication parallel processing method and system
WO2024037629A1 (en)Data integration method and apparatus for blockchain, and computer device and storage medium
CN102184157A (en)Information display device based on dual processor cooperation
KR100619720B1 (en) Multiprocessor Communication Device and Method
CN109800035B (en)Algorithm integrated service framework system
CN110166485B (en)Protocol scheduling and using method and device
WO2022188807A1 (en)Data transmission system and related device
CN110442436A (en)Process management method and relevant apparatus based on container
CN119690694A (en) Asynchronous-to-synchronous method, device, equipment, storage medium and product
US12418485B2 (en)Traffic shaping offload on a network interface controller
CN112559404A (en)Data scheduling device and method and accelerated processing chip
CN114071078B (en)Video data processing method, electronic device and storage medium
CN118069302A (en)Data processing method and device, electronic equipment and storage medium
CN116501682A (en) An information processing method, a first processor, an electronic device and a storage medium
WO2022217595A1 (en)Processing apparatus, processing method and related device
CN111049761B (en)Data processing method of wireless water controller communication module

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
RJ01Rejection of invention patent application after publication

Application publication date:20201127

RJ01Rejection of invention patent application after publication

[8]ページ先頭

©2009-2025 Movatter.jp