Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
Referring to fig. 1, fig. 1 is a flowchart illustrating an implementation of an application development method for an intelligent robot according to an embodiment of the present invention. The implementation flow shown in fig. 1 includes steps S101 to S104, and the implementation principle of each step is specifically as follows:
s101: and starting a remote procedure call protocol (RPC) client pre-installed on the terminal equipment.
In the embodiment of the invention, RPC refers to a protocol of remote procedure call. And integrating the development client installed on the terminal equipment in advance according to the RPC framework program introduced by a developer or a manufacturer to obtain the RPC client. The development client provides an application program of a program development environment for the terminal device, and the program development environment comprises a code editor, a compiler, a debugger, a graphical user interface and the like.
Terminal devices include, but are not limited to, servers, desktop computers, laptops, smart phones, tablets, and Personal Digital Assistants (PDAs), among others.
In the embodiment of the present invention, the RPC framework program may be an existing open-source RPC framework program, such as a gRPC, Apache thread, and bRPC, or may be a set of RPC framework programs written by developers themselves or an RPC framework program written in combination with the open-source RPC framework, which is not limited herein.
When an RPC client function service starting instruction in the development client is detected, or when the development client is detected to be started, the RPC client is determined to be started.
S102: and establishing communication connection with the intelligent robot running with the RPC server side through the RPC client side.
In the embodiment of the invention, based on the same implementation principle as the RPC client, the RPC server is pre-installed in the intelligent robot, but the difference is that for the intelligent robot, the imported RPC framework program is used for providing the RPC server function, and for the development client on the developer terminal equipment, the imported RPC framework program is used for providing the RPC client function, so that partial function difference exists between the RPC framework programs of the intelligent robot and the development client, and the difference between the specific implementation codes is caused.
And when the RPC server side in the intelligent robot is detected to be started, starting the RPC server side function service.
In the embodiment of the invention, the network address and the port number input by a developer or a robot administrator in the RPC server are obtained, or the network address and the port number of the RPC server are determined based on an address automatic detection mode of the RPC server. And receiving the network address and the port number input by the developer in the RPC client.
According to the network address and the port number received by the RPC client, the RPC client sends a host search request in the Internet or the local area network to determine the network resource position of the RPC server corresponding to the network address, and requests to establish communication connection with the intelligent robot running the network resource position of the RPC server. And when the communication connection confirmation instruction is detected, establishing remote connection between the RPC client and the RPC server based on the service port corresponding to the port number.
Preferably, after the network resource address of the RPC server is determined, a communication connection request is sent, and after the legitimacy authentication is completed, the RPC server is connected. The legality authentication process includes but is not limited to account information authentication, terminal equipment serial number authentication, other authentication modes and the like.
S103: and acquiring associated data corresponding to the application program developed on the terminal equipment by the user.
In the development client, a developer develops the intelligent robot application program, that is, the development client can receive the application program source code input by the user. And compiling the source code by using the development client to obtain the application program to be developed.
In the embodiment of the invention, the RPC client needs to communicate with the RPC server based on the binary RPC protocol, so that each parameter value related to the application program is read, and each obtained parameter value is serialized into a binary form. The parameter values include, but are not limited to, method names, function names, and other types of variable parameters called by the application.
S104: and transmitting the associated data to the intelligent robot so that the intelligent robot calls an Application Programming Interface (API) function corresponding to the associated data in a preset Software Development Kit (SDK) library.
In the embodiment of the invention, an SDK library issued by a robot manufacturer and used for developing the function application of the robot is preset in the intelligent robot. The SDK library is preset in the intelligent robot by a manufacturer.
In particular, for an intelligent robot that has been shipped from a factory and does not have an SDK library stored therein, since the SDK library is provided separately by a manufacturer to a developer, the SDK library can be reintroduced into the intelligent robot by the developer.
When an RPC client on the terminal equipment initiates a remote procedure call to an RPC server in the intelligent robot, parameters of the method call in the RPC client need to pass through a bottom-layer network protocol so as to transmit serialized associated data to the RPC server.
And transmitting the relevant data corresponding to the serialized Application program to a connected intelligent robot through a network so that the intelligent robot carries out deserialization processing on the relevant data, and searching an Application Programming Interface (API) function corresponding to the relevant data in an address space of the intelligent robot after the relevant data can be converted into a preset format which can be read by the intelligent robot.
And the intelligent robot calls the API function obtained by local search. Since each API function is used for controlling the intelligent robot to perform a function, for example, controlling the intelligent robot to walk straight, turn, dance, etc., remote control of the intelligent robot through the terminal device of the developer is achieved.
In the embodiment of the invention, the communication connection between the RPC client and the intelligent robot running with the RPC server is established by starting the installed RPC client at the terminal equipment of the user, so that the user can directly remotely control the intelligent robot to execute the function operation corresponding to the application program after developing the application program, therefore, in the process of controlling the operation of the robot, the user does not need to burn the developed executable program into the intelligent robot, and the operation complexity of application development is reduced; in addition, the SDK library is preset in the intelligent robot, and a user only needs to develop the robot application on own terminal equipment, so that the limitation of the SDK operation environment and the programming language is avoided, the platform independence and the language independence of application development are realized, the development program on the terminal equipment and the control program on the robot are distributed and deployed, and the application development difficulty of the user on the intelligent robot is reduced.
As an embodiment of the present invention, fig. 2 shows a specific implementation flow of the application development method S104 of the intelligent robot provided in the embodiment of the present invention, which is detailed as follows:
s1041: and acquiring a function identification code corresponding to the calling parameter name based on a comparison table maintained in advance by the RPC client.
The RPC client pre-maintains a comparison table which is used for storing the corresponding relation between the calling function name and the function identification code. The function identification code represents a unique identification number of the calling function, and the program code of the calling function is associated with the function identification code corresponding to the calling function in the address space corresponding to the terminal equipment.
In the embodiment of the invention, each parameter value related to the application program developed by a developer comprises a function name of a function required to be called by the application program, namely a calling function name. And determining a function identification code corresponding to each function name required to be called by the application program in the comparison table maintained by the RPC client. The expression form of the function identifier includes, but is not limited to, a character string, an integer value, and the like.
S1042: and transmitting the associated data carrying the function identification code to the intelligent robot so that the intelligent robot calls the API function corresponding to the calling function name in a preset SDK library within the function calling duration after determining the calling function name corresponding to the function identification code according to the comparison table maintained by the RPC server.
When the RPC client executes remote process calling on the intelligent robot, the associated data of the application program is serialized to obtain a data stream represented in a binary form. And for each determined function identification code, attaching the function identification code to the data stream of the corresponding calling function name, and transmitting the data stream carrying the function identification code to the RPC server of the intelligent robot through the network.
In the embodiment of the invention, the RPC server of the intelligent robot maintains a comparison table, and the comparison table is also used for storing the corresponding relation between the calling function name and the function identification code. And for the same calling function name, the corresponding function identification codes in the comparison table maintained by the RPC client and the comparison table maintained by the RPC server are the same.
When the RPC server of the intelligent robot receives the data stream transmitted by the RPC client, the data stream is deserialized, and the function identification code contained in the data stream is extracted. And the intelligent robot searches the calling function name corresponding to the extracted function identification code in a comparison table maintained by the RPC server. According to the function identification code, the intelligent robot determines an address space for storing the function code, so as to obtain the API function code matched with the calling function name from the address space, and execute the API function code.
In the embodiment of the invention, the comparison table of the calling function name and the function identification code corresponding relation is respectively maintained at the RPC client and the RPC server, so that the problem that the API function code cannot be searched by the function pointer due to the fact that the RPC client and the RPC server are distributed in different terminal equipment or correspond to different address spaces when the RPC client executes remote process calling is avoided, and the communication stability of the RPC client and the RPC server is ensured, so that a user only needs to develop robot application on own terminal equipment without being limited by an SDK (software development kit) operating environment and a programming language, and the application development difficulty of the user on the intelligent robot is reduced.
As an embodiment of the present invention, fig. 3 shows another specific implementation flow of the application development method S104 of the intelligent robot provided in the embodiment of the present invention, which is detailed as follows:
s1043: and acquiring the calling function name and the function calling duration set by the user in the development process of the application program.
In the development process of an application program, a developer calls a series of functions in program codes, and most of the functions need to input parameter values, so that the output result of the functions can be changed due to different input parameters. For example, in the following function abc (), if a developer needs to call the function abc () in an application program, integer parameter values a and b need to be input so that a product of output values a and b can be obtained by operating the input parameter values a and b based on the function abc ().
In the embodiment of the invention, the incoming parameter value corresponding to the calling function name is obtained according to each calling function name associated with the application program. Wherein, for a calling function whose incoming parameter value includes a time period length, the incoming parameter value may also be a function call duration.
S1044: and converting the calling function name and the function calling duration into associated data in a preset format.
In order to transmit each calling function name and function calling duration associated with an application program to an RPC server of an intelligent robot in a binary data stream mode, in the embodiment of the invention, the calling function names and the function calling durations are serialized to output associated data in a preset format.
Preferably, the preset format may be protobuf, for example. Based on the language-independent characteristic of protobuf, the method ensures that no matter which language a user develops the application program, the method can also convert various parameter values related to the application program into an extensible serialization structure data format.
S1045: and transmitting the associated data to the intelligent robot so that the intelligent robot can continuously call the API function corresponding to the calling function name in a preset SDK library within the function calling duration after decoding the associated data.
And the RPC server analyzes the calling function name required by the application program and the parameter value corresponding to each calling function name in the received data stream. And the intelligent robot searches the API function corresponding to the calling function name in each API function stored in the SDK library, and takes the analyzed parameter value as the input parameter of the API function. Therefore, when the incoming parameters include the function call duration, the intelligent robot will continuously execute the searched API function within the function call duration.
In the embodiment of the invention, the calling function name and the function calling duration which are set by the user in the development process of the application program are obtained, and the associated data carrying the calling function name and the function calling duration are transmitted to the intelligent robot, so that the API function corresponding to the calling function name can be continuously called in the preset SDK library within the function calling duration appointed by the developer after the intelligent robot carries out deserialization decoding processing on the associated data, and therefore, the remote calling control on the local function stored by the intelligent robot is realized, the control precision is improved, and a more accurate control effect is achieved.
Referring to fig. 4, fig. 4 is a flowchart illustrating an implementation of an application development method for an intelligent robot according to another embodiment of the present invention. The implementation flow shown in fig. 4 includes steps S401 to S405, and the implementation principle of each step is specifically as follows:
s401: and starting a remote procedure call protocol (RPC) client pre-installed on the terminal equipment.
S402: and establishing communication connection with the intelligent robot running with the RPC server side through the RPC client side.
S403: and acquiring associated data corresponding to the application program developed on the terminal equipment by the user.
S404: and transmitting the associated data to the intelligent robot so that the intelligent robot calls an Application Programming Interface (API) function corresponding to the associated data in a preset Software Development Kit (SDK) library.
The implementation principle of the steps not mentioned in the embodiments of the present invention is the same as that of the steps mentioned in other embodiments, and therefore, the description thereof is omitted.
S405: and acquiring a function call result returned by the intelligent robot through the RPC server.
In the intelligent robot, when the RPC server executes any API function in the SDK library, whether the API function is successfully called is detected. If the API function is interrupted in the calling process or the API function calling error information is detected, sending function calling error prompt information to the RPC client; and if no error information still appears when the API function call is completed, sending a function call success prompt message to the RPC client.
And the RPC client displays the received prompt information of each type returned by the RPC server.
Preferably, if the API function is interrupted in the calling process, or the API function calling error information is detected, the intelligent robot uploads the API function calling error information to the cloud server, so that the SDK publisher detects an error code in the API function. The cloud server is a server of an SDK issuing manufacturer.
In the embodiment of the invention, based on the function call result detected when the intelligent robot calls different API functions, the prompt message for describing the function call result is returned to the RPC client of the developer, so that the developer can clearly know whether the intelligent robot is successfully controlled or not at present or can know the specific reason of the failure of the current control after remotely calling the intelligent robot to execute the corresponding function. For different failure reasons, developers need to perform troubleshooting from different directions, and therefore the troubleshooting efficiency of the developers in the process of controlling the intelligent robot is improved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Fig. 5 shows a block diagram of an application development apparatus of an intelligent robot according to an embodiment of the present invention, and for convenience of description, only the parts related to the embodiment of the present invention are shown.
Referring to fig. 5, the apparatus includes:
the starting unit 51 is configured to start a remote procedure call protocol (RPC) client pre-installed on the terminal device.
And the connection unit 52 is used for establishing communication connection with the intelligent robot running with the RPC server side through the RPC client side.
The first obtaining unit 53 is configured to obtain associated data corresponding to an application program developed by a user on the terminal device.
And a transmission unit 54, configured to transmit the associated data to the intelligent robot, so that the intelligent robot invokes an API function corresponding to the associated data in a preset software development kit SDK library.
Optionally, the transmission unit 54 includes:
and the first acquisition subunit is used for acquiring the calling function name and the function calling duration set by the user in the development process of the application program.
And the conversion unit is used for converting the calling function name and the function calling duration into associated data in a preset format.
And the calling unit is used for transmitting the associated data to the intelligent robot so that the intelligent robot can continuously call the API function corresponding to the calling function name in a preset SDK library within the function calling duration after decoding the associated data.
Optionally, the transmission unit 54 includes:
and the second acquisition subunit is used for acquiring the function identification code corresponding to the calling parameter name based on a comparison table maintained in advance by the RPC client.
And the transmission subunit is used for transmitting the associated data carrying the function identification code to the intelligent robot so that the intelligent robot calls the API function corresponding to the calling function name in a preset SDK library within the function calling duration after determining the calling function name corresponding to the function identification code according to the comparison table maintained by the RPC server.
Optionally, the connection unit 52 includes:
and the third acquisition subunit is used for acquiring the network address and the port number input by the user in the RPC client, and the network address and the port number respectively correspond to the RPC server.
And the connection request subunit is used for determining the network resource position of the RPC server based on the network address and the port number and requesting to establish communication connection with the intelligent robot running the RPC server.
Optionally, the application development apparatus of the intelligent robot further includes:
and a second obtaining unit 55, configured to obtain a function call result returned by the intelligent robot through the RPC server.
In the embodiment of the invention, the communication connection between the RPC client and the intelligent robot running with the RPC server is established by starting the installed RPC client at the terminal equipment of the user, so that the user can directly remotely control the intelligent robot to execute the function operation corresponding to the application program after developing the application program, therefore, in the process of controlling the operation of the robot, the user does not need to burn the developed executable program into the intelligent robot, and the operation complexity of application development is reduced; in addition, the SDK library is preset in the intelligent robot, and a user only needs to develop the robot application on own terminal equipment, so that the limitation of the SDK operation environment and the programming language is avoided, the platform independence and the language independence of application development are realized, the development program on the terminal equipment and the control program on the robot are distributed and deployed, and the application development difficulty of the user on the intelligent robot is reduced.
Fig. 6 is a schematic diagram of a terminal device according to an embodiment of the present invention. As shown in fig. 6, the terminal device 6 of this embodiment includes: a processor 60, a memory 61 and a computer program 62, such as an application development program for an intelligent robot, stored in said memory 61 and executable on said processor 60. The processor 60, when executing the computer program 62, implements the steps in the above-described application development method embodiments of the respective intelligent robots, such as the steps 101 to 104 shown in fig. 1. Alternatively, the processor 60, when executing the computer program 62, implements the functions of the modules/units in the above-mentioned device embodiments, such as the functions of the units 51 to 55 shown in fig. 5.
Illustratively, the computer program 62 may be partitioned into one or more modules/units that are stored in the memory 61 and executed by the processor 60 to implement the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 62 in the terminal device 6.
The terminal device 6 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a processor 60, a memory 61. Those skilled in the art will appreciate that fig. 6 is merely an example of a terminal device 6 and does not constitute a limitation of terminal device 6 and may include more or less components than those shown, or some components in combination, or different components, for example, the terminal device may also include input output devices, network access devices, buses, etc.
The Processor 60 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 61 may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6. The memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 6. Further, the memory 61 may also include both an internal storage unit and an external storage device of the terminal device 6. The memory 61 is used for storing the computer program and other programs and data required by the terminal device. The memory 61 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. . Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.