Method, apparatus, electronic device and storage medium for controlling robot
By using the method of peripheral processor scanning and protocol encapsulation of control parameters, the problem of poor compatibility of robot peripherals is solved, and the robot's compatibility with multiple handheld control devices is achieved.
Patent Information
- Application Number
- CN202110253219.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-08
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2041-03-08
AI Technical Summary
The robot has poor compatibility with different types of peripherals, which makes the peripherals incompatible with a variety of handheld control devices.
The peripheral processor scans multiple peripheral interfaces, encapsulates control parameters according to the preset protocol, generates control data, and sends it to the robot's internal processor to control the robot.
The robot's compatibility with different types of handheld control devices has been improved, ensuring that the robot is compatible with multiple peripheral interfaces and achieving flexible control.
Smart Images

Figure CN115047790B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of robot control technology, and in particular to a method, device, electronic device and storage medium for controlling a robot. Background Art
[0002] With the development of science and technology, robots have also made significant progress. In order to better carry out human-computer interaction, robots are generally equipped with peripherals, through which users can control the behavior of the robots.
[0003] The peripherals used to control robots are collectively referred to as handheld control systems, or portable control systems (PCS), and are mainly divided into the following categories: touch buttons, lever buttons, joysticks, and dials. Currently, PCSs are generally designed according to the specific functions of the robots they control. For example, lever buttons are designed for a robot based on its specific functions. However, with the increasing number of robots on the market or the upgrading of robots, the types of peripherals used to control robots may also change. For example, if other peripherals are used to control the robot, they will no longer be compatible with peripherals such as lever buttons. In this case, lever buttons cannot be used on robots controlled by other peripherals, which leads to poor compatibility of the robot with different types of peripherals. Summary of the Invention
[0004] In order to overcome the problem of poor compatibility of robots with different types of peripherals existing in the related art, the present application provides a method, device, electronic device and storage medium for controlling a robot.
[0005] According to a first aspect of the present application, a method for controlling a robot is provided, which is applied to a peripheral processor, comprising:
[0006] Scanning at least two peripheral interfaces of the peripheral processor to obtain control parameters sent by each handheld control device through the corresponding peripheral interface, wherein the at least two peripheral interfaces include at least two interface types;
[0007] Encapsulating the scanned control parameters according to a preset protocol to obtain control data, wherein the control data includes a plurality of data fields, each of the data fields corresponding to one of the control parameters;
[0008] The control data is sent to an internal processor of the robot to control the robot.
[0009] In an optional embodiment, encapsulating the scanned control parameters according to a preset protocol to obtain control data includes:
[0010] For any control parameter, the peripheral interface that receives the control parameter is used as the target peripheral interface;
[0011] According to the mapping relationship between the data field identifier and the peripheral interface in the preset protocol, the data field identifier corresponding to the target peripheral interface is used as the target data field identifier;
[0012] Adding the control parameter to a data field in the control data corresponding to the target data field identifier;
[0013] After all the control parameters are added to their corresponding data fields, the control data is obtained.
[0014] In an optional embodiment, scanning at least two peripheral interfaces of the peripheral processor to obtain the control parameters sent by each handheld control device through the corresponding peripheral interface includes:
[0015] Scanning at least two peripheral interfaces of the peripheral processor to obtain a peripheral signal sent by each handheld control device through the corresponding peripheral interface;
[0016] For any of the peripheral signals, a control parameter is extracted from the peripheral signal.
[0017] In an optional embodiment, for any of the peripheral signals, extracting a control parameter from the peripheral signal includes:
[0018] For any of the peripheral signals, if the type of the peripheral signal is a digital signal type, determining the signal value of the peripheral signal as the control parameter;
[0019] If the type of the peripheral signal is an analog signal type, the peripheral signal is converted into a digital signal type, and a signal value of the peripheral signal after conversion into the digital signal type is determined as the control parameter.
[0020] In an optional embodiment, the control data further includes: a check field;
[0021] After adding all the control parameters to their corresponding data fields to obtain the control data, the method further includes:
[0022] Inputting all the control parameters in the control data into a preset check value algorithm to obtain a check parameter;
[0023] The check parameter is added to the check field.
[0024] According to a second aspect of the present application, a method for controlling a robot is provided, which is applied to an internal processor of the robot, the method comprising:
[0025] receiving control data sent by the peripheral processor;
[0026] Decapsulate the control data according to a preset protocol to obtain target control parameters corresponding to each data field;
[0027] generating a target control instruction based on the target control parameter;
[0028] The robot is controlled using the target control instruction.
[0029] In an optional implementation, generating a target control instruction based on the target control parameter includes:
[0030] Determining at least one target control object of the robot according to a mapping relationship between data fields and control objects;
[0031] Retrieving the initial control instruction of the target control object;
[0032] The target control parameter of the data field corresponding to the target control object is added to the initial control instruction to obtain the target control instruction.
[0033] In an optional embodiment, the control data further includes a check field;
[0034] Decapsulating the control data according to the preset protocol to obtain the target control parameter corresponding to each data field includes:
[0035] Decapsulating the control data according to a preset protocol to obtain an initial control parameter for each data field and a first check parameter for the check field;
[0036] Inputting all the initial control parameters into a preset calibration value algorithm to obtain a second calibration parameter;
[0037] If the first verification parameter and the second verification parameter meet a preset verification condition, for any data field, determining the initial control parameter of the data field as the target control parameter of the data field;
[0038] If the first verification parameter and the second verification parameter do not meet the preset verification condition, the control of the robot is terminated.
[0039] In an optional embodiment, after terminating the control of the robot if the first verification parameter and the second verification parameter do not satisfy the preset verification condition, the method further includes:
[0040] If the first verification parameter and the second verification parameter do not meet the preset verification conditions, a control data error reminder is issued.
[0041] According to a third aspect of the present application, there is provided a device for controlling a robot, the device comprising:
[0042] a scanning module, configured to scan at least two peripheral interfaces of the peripheral processor to obtain control parameters sent by each handheld control device through the corresponding peripheral interface, wherein the at least two peripheral interfaces include at least two interface types;
[0043] An encapsulation module is used to encapsulate the scanned control parameters according to a preset protocol to obtain control data, wherein the control data includes a plurality of data fields, each of which corresponds to one of the control parameters;
[0044] A sending module is used to send the control data to the internal processor of the robot to control the robot.
[0045] In an optional embodiment, the encapsulation module includes:
[0046] A first determining unit is configured to, for any control parameter, use the peripheral device interface that receives the control parameter as a target peripheral device interface;
[0047] a second determining unit, configured to use the data field identifier corresponding to the target peripheral interface as the target data field identifier according to a mapping relationship between the data field identifier and the peripheral interface in a preset protocol;
[0048] a first adding unit, configured to add the control parameter to a data field in the control data corresponding to the target data field identifier;
[0049] The acquisition unit is used to add all the control parameters to their corresponding data fields to obtain the control data.
[0050] In an optional embodiment, the scanning module includes:
[0051] a scanning unit, configured to scan at least two peripheral interfaces of the peripheral processor to obtain a peripheral signal sent by each handheld control device through the corresponding peripheral interface;
[0052] The extraction unit is used to extract the control parameter from any of the peripheral signals.
[0053] In an optional embodiment, the extraction unit includes:
[0054] a first determining subunit, configured to, for any of the peripheral signals, determine a signal value of the peripheral signal as the control parameter if the peripheral signal is a digital signal;
[0055] The second determining subunit is configured to convert the peripheral signal into a digital signal type if the peripheral signal is an analog signal type, and determine the signal value of the peripheral signal after conversion into the digital signal type as the control parameter.
[0056] In an optional embodiment, the control data further includes: a check field;
[0057] The device further comprises:
[0058] a processing module, configured to input all the control parameters in the control data into a preset check value algorithm to obtain check parameters;
[0059] An adding module is used to add the verification parameter to the verification field.
[0060] According to a fourth aspect of the present application, there is provided a device for controlling a robot, the device comprising:
[0061] A receiving module, configured to receive control data sent by the peripheral processor;
[0062] a decapsulation module, configured to decapsulate the control data according to a preset protocol to obtain target control parameters for each data field;
[0063] A generating module, configured to generate a target control instruction based on the target control parameter;
[0064] A control module is used to control the robot using the target control instruction.
[0065] The generation module includes:
[0066] a third determining unit, configured to determine at least one target control object of the robot according to a mapping relationship between data fields and control objects;
[0067] A calling unit, configured to call an initial control instruction of the target control object;
[0068] The second adding unit is configured to add the target control parameter of the corresponding data field of the target control object to the initial control instruction to obtain the target control instruction.
[0069] In an optional embodiment, the control data further includes a check field;
[0070] The decapsulation module includes:
[0071] a decapsulation unit, configured to decapsulate the control data according to a preset protocol to obtain an initial control parameter of each data field and a first check parameter of the check field;
[0072] a processing unit, configured to input all of the initial control parameters into a preset calibration value algorithm to obtain a second calibration parameter;
[0073] a first verification unit, configured to, for any data field, determine an initial control parameter of the data field as a target control parameter of the data field if the first verification parameter and the second verification parameter satisfy a preset verification condition;
[0074] The second verification unit is configured to terminate the control of the robot if the first verification parameter and the second verification parameter do not satisfy the preset verification condition.
[0075] In an optional embodiment, the device further comprises:
[0076] The reminder module is used to issue a control data error reminder if the first verification parameter and the second verification parameter do not meet the preset verification conditions.
[0077] According to a fifth aspect of the present application, there is provided an electronic device, comprising: at least one processor and a memory;
[0078] The processor is used to execute the program for controlling the robot stored in the memory to implement the method for controlling the robot described in the first aspect or the second aspect of the present application.
[0079] According to the sixth aspect of the present application, a storage medium is provided, which stores one or more programs. When the one or more programs are executed, the method for controlling a robot described in the first aspect or the second aspect of the present application is implemented.
[0080] The technical solution provided by the present application can include the following beneficial effects: first, the peripheral processor scans at least two peripheral interfaces set up by itself, obtains the control parameters sent by each handheld control device through the corresponding peripheral interface, wherein the interface types of the at least two peripheral interfaces include at least two, then encapsulates the scanned control parameters according to a preset protocol to obtain control data, the control data including multiple data fields, each data field corresponding to a control parameter, and finally sends the control data to the internal processor of the robot to control the robot. Since in the technical solution of the present application, the peripheral processor itself is provided with multiple peripheral interfaces, and each peripheral interface is used to connect to a handheld control device, different types of handheld control devices can send control parameters through their corresponding peripheral interfaces, and then, through the correspondence between the data fields and the control parameters specified in the preset protocol in the technical solution of the present application, the control parameters are encapsulated into control data, so that the internal processor of the robot can control the robot according to the control data, so that the robot can be compatible with multiple handheld control devices, thereby improving the compatibility of the robot with different types of handheld control devices.
[0081] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0083] Figure 1 This is a schematic diagram of the architecture of a system for controlling a robot provided by an embodiment of the present application;
[0084] Figure 2 is a flowchart of a method for controlling a robot provided by another embodiment of the present application;
[0085] Figure 3 This is a schematic diagram of a specific process for obtaining control parameters provided by an embodiment of the present application;
[0086] Figure 4 This is a flow chart of encapsulating control parameters according to a preset protocol, provided by an embodiment of the present application;
[0087] Figure 5 is a flowchart of a method for controlling a robot provided by another embodiment of the present application;
[0088] Figure 6 is a schematic diagram of a process for decapsulating control data provided by another embodiment of the present application;
[0089] Figure 7 is a schematic structural diagram of a device for controlling a robot provided in another embodiment of the present application;
[0090] Figure 8 is a schematic structural diagram of a device for controlling a robot provided in another embodiment of the present application;
[0091] Figure 9 This is a structural diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION
[0092] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0093] See also Figure 1 , Figure 1 This is a schematic diagram of the architecture of a system for controlling a robot provided by an embodiment of the present application.
[0094] like Figure 1 As shown, the present application is to control a robot, and a portable control system 101 (PCS) having a peripheral processor is provided. Various types of peripheral interfaces 102 are provided on the PCS for connecting to a handheld control device.
[0095] A handheld control device, such as a touch button, a lever button, a joystick, a dial, etc., sends control parameters to the peripheral processor through the peripheral interface. The peripheral processor encapsulates the control parameters and sends them to the internal processor 104 of the robot 103. The internal processor decapsulates the received data and obtains the corresponding control parameters to control the operation of the robot.
[0096] Among them, the peripheral processor only needs to have the ability to encapsulate control parameters according to a certain protocol and have multiple input ports. In order to ensure that the PCS can be hot-swapped with the robot, the peripheral processor can also support Universal Serial Bus-Human Interface Device (USB-HID). By connecting to the robot using USB-HID, hot-swappable can be achieved.
[0097] To this end, the STM32F103RCT6 processor is a good choice for peripheral processors. Besides the power, debug, and external crystal oscillator interfaces required for building a minimum system, this processor also features a USB-HID interface, 12 analog inputs, and 24 digital interfaces, essentially meeting the control requirements of the robot PCS.
[0098] In order to facilitate replacement or adjustment of handheld control devices, this embodiment also modularizes the peripheral interfaces. Taking the four types of handheld control devices, namely, touch buttons, lever buttons, joysticks, and dial wheels, as examples, the defined peripheral interfaces are shown in Table 1.
[0099]
[0100] Table 1
[0101] The interface components use standard 2.54mm self-locking connectors. To distinguish different handheld control devices, connectors with different pin counts are used. Besides the shared power connectors (VCC and GND), the touch buttons use a single pin (Input) to indicate their current state: 0 indicates not pressed, and 1 indicates pressed. The joystick buttons are essentially two touch buttons, divided into up (UP_Input) and down (Down_Input). The joystick input is a four-directional analog signal, using a 6-pin interface. The signals represent left (Left_Axis), up (Up_Axis), right (Right_Axis), and down (Down_Axis). The thumbwheel input is a two-directional analog signal, with the signals representing left (Left_Axis1) and right (Left_Axis1). It should be noted that in order to prevent confusion between the external interface of the dial wheel and the external interface of the lever button, a 5-pin connector can be selected for the external interface of the dial wheel, with the last pin left vacant (Ncc).
[0102] Using the above definition, the corresponding IO port of the peripheral processor is brought out and connected to the plug-in female port defined above, and the USB-HID interface is brought out. The handheld control device uses its own plug-in male port to connect to the corresponding plug-in female port to form a hot-swappable PCS.
[0103] Based on the above architecture, in order to realize the interaction between the peripheral processor and the internal processor, the control parameters of the handheld control device are transmitted to the internal processor to control the operation of the robot. This application also provides a method for controlling the robot, which is explained in the following as an embodiment.
[0104] See also Figure 2 , Figure 2 This is a flowchart of a method for controlling a robot provided in another embodiment of the present application.
[0105] like Figure 2 As shown, taking the execution on one side of the peripheral processor as an example, the method for controlling a robot provided in this embodiment may include:
[0106] Step S201: Scan at least two peripheral interfaces of a peripheral processor to obtain control parameters sent by each handheld control device through the corresponding peripheral interface, wherein the at least two peripheral interfaces include at least two interface types.
[0107] It should be noted that the handheld control device is connected to the peripheral processor through a peripheral interface. Generally, one peripheral interface is connected to one handheld control device. In order to support multiple handheld control devices, the interface types of at least two peripheral interfaces of the peripheral processor may include at least two types. For example, the peripheral processor is provided with 5 peripheral interfaces, of which there are 2 type A peripheral interfaces, 1 type B peripheral interface, and 2 type C peripheral interfaces.
[0108] Since the working principle of the processor is to scan the interface according to the crystal oscillator cycle to obtain the interface signal, the peripheral processor will actively scan the peripheral interface in this step to obtain the control parameters sent by the handheld control device through the corresponding peripheral interface.
[0109] Among them, the control parameters sent by each handheld control device may be different. For example, a touch button is a digital signal type, and its control parameter can only be 1 or 0. For a joystick, it is an analog signal type, and its control parameter may be a specific binary value after conversion.
[0110] It should be noted that when the peripheral processor scans, the initial signal it obtains should be an electrical signal, such as a high or low level digital signal or an analog signal in the form of a 4-20mA current. Therefore, the specific process of obtaining the control parameters in this step can be referred to. Figure 3 , Figure 3 This is a schematic diagram of a specific flow chart for obtaining control parameters provided by an embodiment of the present application.
[0111] like Figure 3 As shown, the specific process of obtaining the control parameters may include:
[0112] Step S301: Scan at least two peripheral interfaces of a peripheral processor to obtain a peripheral signal sent by each handheld control device through the corresponding peripheral interface.
[0113] The process of scanning the peripheral interface to obtain the peripheral signal in this step can be referred to the above embodiment and will not be described again here.
[0114] Step S302: For any peripheral signal, extract a control parameter from the peripheral signal.
[0115] Since the peripheral processor scans different peripheral interfaces, the peripheral signals obtained are also different. In order to standardize the process of extracting control parameters, the following methods can be used to extract control parameters from peripheral signals of different peripheral interfaces:
[0116] Step 1: If the target signal type is a digital signal type, the signal value of the peripheral signal is determined as the control parameter.
[0117] It should be noted that the digital signal type refers to a signal that uses high and low levels to transmit signal values. The high and low levels mentioned in this embodiment have the same meanings as the high and low levels in the field of digital electronic technology. Both use a level in a higher voltage range (taking TTL input as an example, 2V-5V) as a signal with a signal value of 1, and a level in a lower voltage range (taking TTL input as an example, 0V-0.8V) as a signal with a signal value of 0.
[0118] In addition, the basis for determining the target signal type can be through the pre-definition of the peripheral interface. Since the signal type of the peripheral signal that each handheld control device can send is fixed, for example, the signal type of the peripheral signal sent by the touch button is a digital signal type, then the peripheral interface used to connect the touch button can be pre-defined as an interface for receiving digital signals.
[0119] In a specific example, there are 4 peripheral interfaces, as shown in Table 2.
[0120] Peripheral interface Connected handheld control device Signal Type Interface A Touch button Digital signal type Interface B Lever button Digital signal type Interface C Joystick Analog signal type Interface D Trackwheel Analog signal type
[0121] Table 2
[0122] When the peripheral signal of interface A is scanned, it can be determined from the mapping relationship in Table 2 that the peripheral signal is a digital signal type. In this case, the signal value of the signal can be used as the control parameter.
[0123] Step 2: If the peripheral signal is an analog signal type, convert the peripheral signal into a digital signal type, and determine the signal value of the peripheral signal after conversion into a digital signal type as the control parameter.
[0124] It should be noted that the method for determining whether the type of the peripheral signal is an analog signal type in this step can refer to the method in the aforementioned step 1, and will not be repeated here.
[0125] In addition, the analog signal can be converted into a digital signal through an analog-to-digital converter inside the peripheral processor, and the signal value of the digital signal obtained after the conversion can be the control parameter.
[0126] Still taking the mapping relationship in the aforementioned Table 1 as an example, when the peripheral signal of interface C is scanned, it can be determined from the mapping relationship in the above Table 2 that the peripheral signal is a model signal type. At this time, the peripheral signal is converted into a digital signal by analog-to-digital conversion. The converted signal value can be the control parameter, such as "10010".
[0127] Step S202: encapsulate the scanned control parameters according to a preset protocol to obtain control data, where the control data includes multiple data fields, and each data field corresponds to a control parameter.
[0128] In this step, the preset protocol refers to the definition of each data field of the control data, where each data field is used to store the control parameters of a peripheral interface. Because different types of handheld control devices require different numbers of bytes for their control parameters, the preset protocol may define different numbers of bytes for different handheld control devices as their data fields.
[0129] In a specific example, assuming that the peripheral processor can support 12 touch buttons, 6 lever buttons, 2 joysticks, and 2 dials, since the touch button only inputs one control parameter, the data field corresponding to the touch button only requires one byte; the lever button will input two control parameters (dial up and dial down), so the data field corresponding to the lever button requires two bytes; the joystick inputs four control parameters (shake left, shake up, shake right, and shake down), and the data field corresponding to the joystick needs to have four bytes; the dial wheel inputs two control parameters (shake left and shake right), and the data field corresponding to the dial wheel needs to have two bytes.
[0130] Therefore, the preset protocol may define the control data as 40 bytes, and the definition of each byte may be as shown in Table 3.
[0131]
[0132]
[0133]
[0134] Table 3
[0135] For details on the process of encapsulating control parameters according to the preset protocol, please refer to Figure 4 , Figure 4 This is a flow chart of encapsulating control parameters according to a preset protocol, provided by an embodiment of the present application.
[0136] like Figure 4 As shown, the specific process of encapsulating control parameters according to the preset protocol provided in this embodiment may include:
[0137] Step S401: For any control parameter, the peripheral device interface that receives the control parameter is used as the target peripheral device interface.
[0138] It should be noted that, in this embodiment, the peripheral interface will include at least one pin, one of which will correspond to the input of a control parameter, and one control parameter will correspond to a byte. When encapsulating the control parameter, to find the byte corresponding to the control parameter, it is necessary to first determine the data field corresponding to the peripheral interface that receives the control parameter. Therefore, this embodiment can first explain the encapsulation of a control parameter. Then in this step, in order to facilitate subsequent explanations, the peripheral interface that receives the control parameter can be first used as the target peripheral interface.
[0139] Step S402: According to the mapping relationship between the data field identifier and the peripheral interface in the preset protocol, the data field identifier corresponding to the target peripheral interface is used as the target data field identifier.
[0140] In the preset protocol, there is a mapping relationship between peripheral interfaces and data fields, as shown in Table 3, where field 2 corresponds to the first touch button, field 14 corresponds to the first lever button, etc. The target peripheral interface then corresponds to a specific target data field, that is, the target data field corresponding to the target data field identifier.
[0141] Step S403: Add the control parameter to the data field in the control data corresponding to the target data field identifier.
[0142] In this step, when the control parameter is added to the data field corresponding to the target data field identifier, it is also necessary to add it according to the pin that receives the control parameter. For example, if the control parameter is input through pin 4 of the peripheral interface corresponding to the first lever button (as shown in Table 3), then the control parameter needs to be added to the 15th byte of the control data.
[0143] Step S404: After adding all control parameters to their corresponding data fields, control data is obtained.
[0144] After all the control parameters are added to the bytes of their corresponding data fields according to the above steps S401 to S403, the control data can be obtained.
[0145] In addition, in order to avoid data errors during transmission and the robot running according to incorrect control data, the control data can also include a check field (composed of a check high field and a check low field), as shown in Table 3. Therefore, after obtaining the control data, all control parameters in the control data can be input into a preset check value algorithm to obtain the check parameters, and then the check parameters are added to the check field.
[0146] In a specific example, each control parameter in byte 2 to byte 37 in Table 3 can be input into the CRC check algorithm to obtain a CRC16 result, which is added to bytes 38 and 39 so that the robot's internal processor can use the check parameters in bytes 38 and 39 to perform verification after receiving the control data.
[0147] Step S203: Send control data to the internal processor of the robot to control the robot.
[0148] In this embodiment, first, the peripheral processor scans at least two peripheral interfaces set up by itself, obtains the control parameters sent by each handheld control device through the corresponding peripheral interface, wherein the interface types of the at least two peripheral interfaces include at least two types, then encapsulates the scanned control parameters according to the preset protocol to obtain control data, the control data including multiple data fields, each data field corresponding to a control parameter, and finally sends the control data to the internal processor of the robot to control the robot. Since in the technical solution of the present application, the peripheral processor itself is provided with multiple peripheral interfaces, and each peripheral interface is used to connect to a handheld control device, different types of handheld control devices can send control parameters through their corresponding peripheral interfaces, and then, through the correspondence between the data fields and the control parameters specified in the preset protocol in the technical solution of the present application, the control parameters are encapsulated into control data, so that the internal processor of the robot can control the robot according to the control data. In this way, the robot can be compatible with multiple handheld control devices, thereby improving the compatibility of the robot with different types of handheld control devices.
[0149] Since this application improves the architecture of controlling the robot, and the external processor will encapsulate the control parameters according to the preset protocol, the process of the robot's internal processor using the control parameters to control the robot's operation will also change. Therefore, this application also provides a method for controlling the robot applied to the robot's internal processor, which is explained below in the form of an embodiment.
[0150] For details, please refer to Figure 5 , Figure 5 This is a flowchart of a method for controlling a robot provided in another embodiment of the present application.
[0151] like Figure 5 As shown, the method for controlling a robot provided in this embodiment is applied to an internal processor of the robot, such as a processor of a host computer of the robot, and the method may include:
[0152] Step S501: Receive control data sent by a peripheral processor.
[0153] It should be noted that the control data sent by the peripheral processor includes multiple control parameters. For details, please refer to the execution of the peripheral processor side, which will not be described here.
[0154] Step S502: Decapsulate the control data according to the preset protocol to obtain the target control parameters corresponding to each data field.
[0155] Since the preset protocol defines the control parameters sent by the handheld control device corresponding to each field in the control data, in this step, when decapsulating the control data, multiple control parameters can be obtained. In order to facilitate the distinction of the handheld control devices corresponding to different control parameters and to associate them with the control instructions of the robot, the control parameters can be associated with the control instructions and the handheld control devices through the names of the control parameters.
[0156] For example, in a control instruction that uses the control parameter for the first dial, the parameter is named bolun1_left. This name is associated with bit 26 in the control data, and the control instruction can simply reference the parameter name. After decapsulating the control data, the value of bit 26 is directly assigned to bolun1_left.
[0157] In addition, in order to avoid data errors during transmission and the robot running according to incorrect control data, the received control data can be verified. For details, please refer to Figure 6 , Figure 6 This is a flowchart of decapsulating control data provided by another embodiment of the present application.
[0158] like Figure 6 As shown, the process of decapsulating control data provided in this embodiment may include:
[0159] Step S601: Decapsulate control data according to a preset protocol to obtain initial control parameters of each data field and a first check parameter of a check field.
[0160] If verification is required, the control data needs to include a verification field. During decapsulation, the initial control parameters of each data field and the first verification parameters of the verification field are obtained based on the mapping relationship between the data field, byte and peripheral interface.
[0161] In a specific example, the decapsulated initial control parameters can be filled into a mapping table of data fields, bytes, and peripheral interfaces, as shown in Table 4. The decapsulated values can be filled into Table 4 accordingly.
[0162]
[0163]
[0164] Table 4
[0165] Step S602: Input all initial control parameters into a preset verification value algorithm to obtain a second verification parameter.
[0166] It should be noted that the process of calculating the second verification parameter can refer to the process of obtaining the verification parameter in the above steps, which will not be repeated here.
[0167] Step S603: If the first verification parameter and the second verification parameter meet the preset verification condition, for any data field, determine the initial control parameter of the data field as the target control parameter of the data field.
[0168] It should be noted that in this step, if the first verification parameter and the second verification parameter meet the preset verification conditions, it means that no error occurs in the control data during the sending process, and the control parameters in the control data can be used normally. At this time, the initial control parameters of the data field can be used as the target control parameters of the data field.
[0169] In a specific example, the preset verification condition may be, but is not limited to, that the parameter value of the first verification parameter is the same as the parameter value of the second verification parameter. The preset verification condition needs to be changed according to a preset verification value algorithm.
[0170] Step S604: If the first verification parameter and the second verification parameter do not meet the preset verification conditions, terminate the control of the robot.
[0171] In this step, if the first and second verification parameters do not meet the preset verification conditions, it indicates that an error occurred during the control data transmission process. If the control parameters in the control data are used to control the robot, serious errors may occur, or even damage the robot. Therefore, in this case, control of the robot can be terminated and the next control data can be received. In addition, if the first and second verification parameters do not meet the preset verification conditions, a control data error reminder can be issued to remind the user to check the cause of the control data error.
[0172] Step S503: Generate a target control instruction based on the target control parameter.
[0173] In this step, at least one target control object of the robot can be determined based on the mapping relationship between the data field and the control object, where the control object refers to the part of the robot that currently needs to be controlled, such as the head, arm, etc. After obtaining the target control parameter, the target data field corresponding to the target control parameter can be obtained, and then the target control object corresponding to the target data field can be determined based on the mapping relationship between the data field and the control object.
[0174] After obtaining the target control object, the initial control instruction of the target control object can be called. In order to control the target control object, the control instruction of the target control object needs to be used to control the target control object. The control instruction without filling in the target control parameters can be called the initial control instruction.
[0175] Finally, the target control parameter of the corresponding data field of the target control object is added to the initial control instruction to obtain the target control instruction.
[0176] Specifically, the initial control instruction may include a name corresponding to the target control parameter, and the parameter value of the target control parameter is assigned to the name, thereby obtaining the target control instruction with the control parameter added thereto.
[0177] Step S504: Control the robot using the target control instruction.
[0178] In this embodiment, since the received control data may contain control parameters sent by multiple handheld control devices, decapsulation according to a preset protocol can obtain the control parameters that have a mapping relationship with the handheld control device. This mapping relationship can then be used to generate target control instructions to control the robot. In this way, the robot can be compatible with multiple handheld control devices, improving the robot's compatibility with different types of handheld control devices.
[0179] See also Figure 7 , Figure 7 It is a structural schematic diagram of a device for controlling a robot provided in another embodiment of the present application.
[0180] like Figure 7 As shown, the device for controlling a robot provided in this embodiment may include:
[0181] A scanning module 701 is configured to scan at least two peripheral interfaces of a peripheral processor to obtain control parameters sent by each handheld control device through the corresponding peripheral interface, wherein the at least two peripheral interfaces include at least two interface types;
[0182] The encapsulation module 702 is configured to encapsulate the scanned control parameters according to a preset protocol to obtain control data, where the control data includes multiple data fields, each data field corresponding to a control parameter;
[0183] The sending module 703 is used to send control data to the internal processor of the robot to control the robot.
[0184] In an optional embodiment, the encapsulation module includes:
[0185] a first determining unit, configured to, for any control parameter, use the peripheral device interface that receives the control parameter as a target peripheral device interface;
[0186] A second determining unit is configured to use the data field identifier corresponding to the target peripheral interface as the target data field identifier according to a mapping relationship between the data field identifier and the peripheral interface in the preset protocol;
[0187] A first adding unit, configured to add the control parameter to a data field in the control data corresponding to the target data field identifier;
[0188] The acquisition unit is used to add all control parameters to their corresponding data fields to obtain control data.
[0189] In an optional embodiment, the scanning module includes:
[0190] A scanning unit, configured to scan at least two peripheral interfaces of the peripheral processor to obtain a peripheral signal sent by each handheld control device through the corresponding peripheral interface;
[0191] The extraction unit is used for extracting control parameters from any peripheral signal.
[0192] In an optional embodiment, the extraction unit includes:
[0193] A first determining subunit is configured to determine, for any peripheral signal, if the type of the peripheral signal is a digital signal type, a signal value of the peripheral signal as a control parameter;
[0194] The second determining subunit is configured to convert the peripheral signal into a digital signal type if the peripheral signal is an analog signal type, and determine a signal value of the peripheral signal after conversion into the digital signal type as a control parameter.
[0195] In an optional embodiment, the control data further includes: a check field;
[0196] The device also includes:
[0197] A processing module, configured to input all control parameters in the control data into a preset check value algorithm to obtain check parameters;
[0198] Add module to add validation parameters to validation fields.
[0199] See also Figure 8 , Figure 8 It is a structural schematic diagram of a device for controlling a robot provided in another embodiment of the present application.
[0200] like Figure 8 As shown, the device for controlling a robot provided in this embodiment may include:
[0201] Receiving module 801, used to receive control data sent by the peripheral processor;
[0202] The decapsulation module 802 is configured to decapsulate the control data according to a preset protocol to obtain target control parameters for each data field;
[0203] A generating module 803 is configured to generate a target control instruction based on the target control parameter;
[0204] The control module 804 is used to control the robot using target control instructions.
[0205] The generated modules include:
[0206] a third determining unit, configured to determine at least one target control object of the robot according to a mapping relationship between the data field and the control object;
[0207] A calling unit, used for calling the initial control instruction of the target control object;
[0208] The second adding unit is configured to add the target control parameter of the corresponding data field of the target control object to the initial control instruction to obtain the target control instruction.
[0209] In an optional embodiment, the control data further includes a check field;
[0210] The decapsulation module includes:
[0211] a decapsulation unit, configured to decapsulate the control data according to a preset protocol to obtain an initial control parameter of each data field and a first check parameter of the check field;
[0212] a processing unit, configured to input all initial control parameters into a preset calibration value algorithm to obtain a second calibration parameter;
[0213] a first verification unit, configured to, for any data field, determine an initial control parameter of the data field as a target control parameter of the data field if the first verification parameter and the second verification parameter meet a preset verification condition;
[0214] The second verification unit is configured to terminate the control of the robot if the first verification parameter and the second verification parameter do not meet a preset verification condition.
[0215] In an optional embodiment, the device further comprises:
[0216] The reminder module is used to issue a control data error reminder if the first verification parameter and the second verification parameter do not meet the preset verification conditions.
[0217] See also Figure 9 , Figure 9This is a structural diagram of an electronic device provided in another embodiment of the present application.
[0218] like Figure 9 As shown, the electronic device provided in this embodiment includes: at least one processor 901, a memory 902, at least one network interface 903 and other user interfaces 904. The various components in the electronic device 900 are coupled together via a bus system 905. It is understood that the bus system 905 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 905 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 9 Various buses are labeled as bus system 905.
[0219] The user interface 904 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touchpad, or a touch screen).
[0220] It is understood that the memory 902 in the embodiment of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 902 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0221] In some embodiments, the memory 902 stores the following elements, executable units, or data structures, or a subset thereof, or an extended set thereof: an operating system 9021 and a second application 9022 .
[0222] The operating system 9021 includes various system programs, such as a framework layer, a core library layer, and a driver layer, for implementing various basic services and handling hardware-based tasks. Second application programs 9022 include various second application programs, such as a media player and a browser, for implementing various application services. Programs implementing the methods of the embodiments of the present invention may be included in second application programs 9022.
[0223] In an embodiment of the present invention, by calling a program or instruction stored in the memory 902, specifically, a program or instruction stored in the second application 9022, the processor 901 is configured to execute the method steps provided in each method embodiment, for example, including:
[0224] Scanning at least two peripheral interfaces of the peripheral processor to obtain control parameters sent by each handheld control device through the corresponding peripheral interface, wherein the at least two peripheral interfaces include at least two interface types;
[0225] Encapsulating the scanned control parameters according to a preset protocol to obtain control data, the control data including a plurality of data fields, each data field corresponding to a control parameter;
[0226] Sends control data to the robot's internal processor to control the robot.
[0227] In an optional embodiment, the scanned control parameters are encapsulated according to a preset protocol to obtain control data, including:
[0228] For any control parameter, the peripheral interface that receives the control parameter is used as the target peripheral interface;
[0229] According to the mapping relationship between the data field identifier and the peripheral interface in the preset protocol, the data field identifier corresponding to the target peripheral interface is used as the target data field identifier;
[0230] Adding the control parameter to the data field in the control data corresponding to the target data field identifier;
[0231] After adding all control parameters to their corresponding data fields, control data is obtained.
[0232] In an optional embodiment, scanning at least two peripheral interfaces of the peripheral processor to obtain the control parameters sent by each handheld control device through the corresponding peripheral interface includes:
[0233] Scanning at least two peripheral interfaces of the peripheral processor to obtain a peripheral signal sent by each handheld control device through the corresponding peripheral interface;
[0234] For any peripheral signal, extract the control parameter from the peripheral signal.
[0235] In an optional embodiment, for any peripheral signal, extracting a control parameter from the peripheral signal includes:
[0236] For any peripheral signal, if the type of the peripheral signal is a digital signal type, the signal value of the peripheral signal is determined as the control parameter;
[0237] If the type of the peripheral signal is an analog signal type, the peripheral signal is converted into a digital signal type, and a signal value of the peripheral signal after being converted into the digital signal type is determined as a control parameter.
[0238] In an optional embodiment, the control data further includes: a check field;
[0239] After adding all control parameters to their corresponding data fields to obtain control data, the method further includes:
[0240] Input all control parameters in the control data into a preset check value algorithm to obtain check parameters;
[0241] Add validation parameters to the validation field.
[0242] or,
[0243] Receive control data sent by the peripheral processor;
[0244] Decapsulate the control data according to the preset protocol to obtain the target control parameters corresponding to each data field;
[0245] generating a target control instruction based on the target control parameter;
[0246] Use target control instructions to control the robot.
[0247] In an optional embodiment, generating a target control instruction based on the target control parameter includes:
[0248] Determine at least one target control object of the robot according to a mapping relationship between the data field and the control object;
[0249] Retrieve the initial control instructions of the target control object;
[0250] The target control parameter of the corresponding data field of the target control object is added to the initial control instruction to obtain the target control instruction.
[0251] In an optional embodiment, the control data further includes a check field;
[0252] Decapsulate the control data according to the preset protocol to obtain the target control parameters for each data field, including:
[0253] Decapsulating the control data according to a preset protocol to obtain an initial control parameter for each data field and a first check parameter for the check field;
[0254] Input all initial control parameters into a preset calibration value algorithm to obtain a second calibration parameter;
[0255] If the first verification parameter and the second verification parameter meet the preset verification condition, for any data field, determining the initial control parameter of the data field as the target control parameter of the data field;
[0256] If the first verification parameter and the second verification parameter do not meet the preset verification conditions, the control of the robot is terminated.
[0257] In an optional embodiment, if the first verification parameter and the second verification parameter do not meet the preset verification condition, after terminating the control of the robot, the method further includes:
[0258] If the first verification parameter and the second verification parameter do not meet the preset verification conditions, a control data error reminder is issued.
[0259] The methods disclosed in the above embodiments of the present invention can be applied to or implemented by processor 901. Processor 901 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in processor 901 or by software instructions. The above processor 901 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The methods, steps, and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in conjunction with the embodiments of the present invention can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software units in the decoding processor. The software units can be located in storage media well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory 902 , and the processor 901 reads the information in the memory 902 and completes the steps of the above method in combination with its hardware.
[0260] It is understood that the embodiments described herein may be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions of the present application, or a combination thereof.
[0261] For software implementation, the technology herein can be implemented by a unit that performs the functions herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0262] An embodiment of the present invention further provides a storage medium (computer-readable storage medium). The storage medium stores one or more programs. The storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive; and the memory may also include a combination of the aforementioned types of memory.
[0263] When one or more programs in the storage medium can be executed by one or more processors, the method of controlling the robot executed on the electronic device side can be implemented.
[0264] The processor is configured to execute a program for controlling the robot stored in the memory to implement the following steps of a method for controlling the robot executed on the electronic device side:
[0265] Scanning at least two peripheral interfaces of the peripheral processor to obtain control parameters sent by each handheld control device through the corresponding peripheral interface, wherein the at least two peripheral interfaces include at least two interface types;
[0266] Encapsulating the scanned control parameters according to a preset protocol to obtain control data, the control data including a plurality of data fields, each data field corresponding to a control parameter;
[0267] Sends control data to the robot's internal processor to control the robot.
[0268] In an optional embodiment, the scanned control parameters are encapsulated according to a preset protocol to obtain control data, including:
[0269] For any control parameter, the peripheral interface that receives the control parameter is used as the target peripheral interface;
[0270] According to the mapping relationship between the data field identifier and the peripheral interface in the preset protocol, the data field identifier corresponding to the target peripheral interface is used as the target data field identifier;
[0271] Adding the control parameter to the data field in the control data corresponding to the target data field identifier;
[0272] After adding all control parameters to their corresponding data fields, control data is obtained.
[0273] In an optional embodiment, scanning at least two peripheral interfaces of the peripheral processor to obtain the control parameters sent by each handheld control device through the corresponding peripheral interface includes:
[0274] Scanning at least two peripheral interfaces of the peripheral processor to obtain a peripheral signal sent by each handheld control device through the corresponding peripheral interface;
[0275] For any peripheral signal, extract the control parameter from the peripheral signal.
[0276] In an optional embodiment, for any peripheral signal, extracting a control parameter from the peripheral signal includes:
[0277] For any peripheral signal, if the type of the peripheral signal is a digital signal type, the signal value of the peripheral signal is determined as the control parameter;
[0278] If the type of the peripheral signal is an analog signal type, the peripheral signal is converted into a digital signal type, and a signal value of the peripheral signal after being converted into the digital signal type is determined as a control parameter.
[0279] In an optional embodiment, the control data further includes: a check field;
[0280] After adding all control parameters to their corresponding data fields to obtain control data, the method further includes:
[0281] Input all control parameters in the control data into a preset check value algorithm to obtain check parameters;
[0282] Add validation parameters to the validation field.
[0283] or,
[0284] Receive control data sent by the peripheral processor;
[0285] Decapsulate the control data according to the preset protocol to obtain the target control parameters corresponding to each data field;
[0286] generating a target control instruction based on the target control parameter;
[0287] Use target control instructions to control the robot.
[0288] In an optional embodiment, generating a target control instruction based on the target control parameter includes:
[0289] Determine at least one target control object of the robot according to a mapping relationship between the data field and the control object;
[0290] Retrieve the initial control instructions of the target control object;
[0291] The target control parameter of the corresponding data field of the target control object is added to the initial control instruction to obtain the target control instruction.
[0292] In an optional embodiment, the control data further includes a check field;
[0293] Decapsulate the control data according to the preset protocol to obtain the target control parameters for each data field, including:
[0294] Decapsulating the control data according to a preset protocol to obtain an initial control parameter for each data field and a first check parameter for the check field;
[0295] Input all initial control parameters into a preset calibration value algorithm to obtain a second calibration parameter;
[0296] If the first verification parameter and the second verification parameter meet the preset verification condition, for any data field, determining the initial control parameter of the data field as the target control parameter of the data field;
[0297] If the first verification parameter and the second verification parameter do not meet the preset verification conditions, the control of the robot is terminated.
[0298] In an optional embodiment, if the first verification parameter and the second verification parameter do not meet the preset verification condition, after terminating the control of the robot, the method further includes:
[0299] If the first verification parameter and the second verification parameter do not meet the preset verification conditions, a control data error reminder is issued.
[0300] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0301] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.
[0302] It should be noted that, in the description of this application, the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" refers to at least two.
[0303] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application belong.
[0304] It should be understood that various parts of the present application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0305] Those skilled in the art will appreciate that all or part of the steps in the method for implementing the above-mentioned embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.
[0306] In addition, the functional units in the various embodiments of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into a module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0307] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0308] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in conjunction with that embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0309] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for controlling a robot, characterized in that: Applied to a peripheral processor, the method includes: Scanning at least two peripheral interfaces of the peripheral processor to obtain control parameters sent by each handheld control device through the corresponding peripheral interface, wherein the at least two peripheral interfaces include at least two interface types; Encapsulating the scanned control parameters according to a preset protocol to obtain control data, wherein the control data includes a plurality of data fields, each of the data fields corresponding to one of the control parameters; sending the control data to an internal processor of the robot to control the robot; The control parameters scanned are encapsulated according to a preset protocol to obtain control data, including: For any control parameter, the peripheral interface that receives the control parameter is used as the target peripheral interface; According to the mapping relationship between the data field identifier and the peripheral interface in the preset protocol, the data field identifier corresponding to the target peripheral interface is used as the target data field identifier; Adding the control parameter to a data field in the control data corresponding to the target data field identifier; After all the control parameters are added to their corresponding data fields, the control data is obtained.
2. The method according to claim 1, characterized in that The scanning of at least two peripheral interfaces of the peripheral processor to obtain control parameters sent by each handheld control device through the corresponding peripheral interface includes: Scanning at least two peripheral interfaces of the peripheral processor to obtain a peripheral signal sent by each handheld control device through the corresponding peripheral interface; For any of the peripheral signals, a control parameter is extracted from the peripheral signal.
3. The method according to claim 2, characterized in that The step of extracting a control parameter from any of the peripheral signals includes: For any of the peripheral signals, if the type of the peripheral signal is a digital signal type, determining the signal value of the peripheral signal as the control parameter; If the type of the peripheral signal is an analog signal type, the peripheral signal is converted into a digital signal type, and a signal value of the peripheral signal after conversion into the digital signal type is determined as the control parameter.
4. The method according to claim 1, wherein The control data also includes: a check field; After adding all the control parameters to their corresponding data fields to obtain the control data, the method further includes: Inputting all the control parameters in the control data into a preset check value algorithm to obtain a check parameter; The check parameter is added to the check field.
5. A method for controlling a robot, characterized in that: Applied to an internal processor of a robot, the method comprises: Receive control data sent by a peripheral processor, wherein the control data is obtained by: scanning at least two peripheral interfaces of the peripheral processor to obtain control parameters sent by each handheld control device through the corresponding peripheral interface; for any control parameter, using the peripheral interface that receives the control parameter as a target peripheral interface; using the data field identifier corresponding to the target peripheral interface as a target data field identifier based on a mapping relationship between a data field identifier and a peripheral interface in a preset protocol; adding the control parameter to a data field in the control data corresponding to the target data field identifier; and adding all the control parameters to their respective corresponding data fields; Decapsulate the control data according to a preset protocol to obtain target control parameters corresponding to each data field; generating a target control instruction based on the target control parameter; The robot is controlled using the target control instruction.
6. The method according to claim 5, characterized in that Generating a target control instruction based on the target control parameter includes: Determining at least one target control object of the robot according to a mapping relationship between data fields and control objects; Retrieving the initial control instruction of the target control object; The target control parameter of the data field corresponding to the target control object is added to the initial control instruction to obtain the target control instruction.
7. The method according to claim 5 or 6, characterized in that The control data also includes a check field; Decapsulating the control data according to the preset protocol to obtain the target control parameter corresponding to each data field includes: Decapsulating the control data according to a preset protocol to obtain an initial control parameter for each data field and a first check parameter for the check field; Inputting all the initial control parameters into a preset calibration value algorithm to obtain a second calibration parameter; If the first verification parameter and the second verification parameter meet a preset verification condition, for any data field, determining the initial control parameter of the data field as the target control parameter of the data field; If the first verification parameter and the second verification parameter do not meet the preset verification condition, the control of the robot is terminated.
8. The method according to claim 7, characterized in that After terminating control of the robot if the first verification parameter and the second verification parameter do not satisfy the preset verification condition, the method further includes: If the first verification parameter and the second verification parameter do not meet the preset verification conditions, a control data error reminder is issued.
9. A device for controlling a robot, characterized in that: The device comprises: a scanning module, configured to scan at least two peripheral interfaces of the peripheral processor to obtain control parameters sent by each handheld control device through the corresponding peripheral interface, wherein the at least two peripheral interfaces include at least two interface types; An encapsulation module is configured to encapsulate the scanned control parameters according to a preset protocol to obtain control data, wherein the control data includes multiple data fields, each of which corresponds to one control parameter. The encapsulation module is configured to encapsulate the scanned control parameters according to the preset protocol to obtain control data, including: For any control parameter, the peripheral interface that receives the control parameter is used as the target peripheral interface; According to the mapping relationship between the data field identifier and the peripheral interface in the preset protocol, the data field identifier corresponding to the target peripheral interface is used as the target data field identifier; Adding the control parameter to a data field in the control data corresponding to the target data field identifier; After adding all the control parameters to their corresponding data fields, the control data is obtained; A sending module is used to send the control data to the internal processor of the robot to control the robot.
10. A device for controlling a robot, characterized in that: The device comprises: a receiving module, configured to receive control data sent by a peripheral processor, wherein the control data is obtained by: scanning at least two peripheral interfaces of the peripheral processor to obtain control parameters sent by each handheld control device through the corresponding peripheral interface; for any control parameter, using the peripheral interface that receives the control parameter as a target peripheral interface; using the data field identifier corresponding to the target peripheral interface as a target data field identifier based on a mapping relationship between a data field identifier and a peripheral interface in a preset protocol; adding the control parameter to a data field in the control data corresponding to the target data field identifier; and adding all the control parameters to their respective corresponding data fields; a decapsulation module, configured to decapsulate the control data according to a preset protocol to obtain target control parameters for each data field; A generating module, configured to generate a target control instruction based on the target control parameter; A control module is used to control the robot using the target control instruction.
11. An electronic device, characterized in that: include: at least one processor and memory; The processor is used to execute the program for controlling the robot stored in the memory to implement the method for controlling the robot according to any one of claims 1 to 8.
12. A storage medium, characterized in that: The storage medium stores one or more programs, and when the one or more programs are executed, the method for controlling a robot according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Interactive method of robot system, interaction processing apparatus and system
CN107770181A
Robot performance control method and robot
CN108053815A
Robot control method, robot and control terminal
CN110154030A
Embedded-system-based handheld controller for crawl type welding robot
CN202684923U