CN115502980A - Method, device, equipment and medium for controlling a mechanical arm - Google Patents

Method, device, equipment and medium for controlling a mechanical arm Download PDF

Info

Publication number
CN115502980A
CN115502980A CN202211308971.3A CN202211308971A CN115502980A CN 115502980 A CN115502980 A CN 115502980A CN 202211308971 A CN202211308971 A CN 202211308971A CN 115502980 A CN115502980 A CN 115502980A
Authority
CN
China
Prior art keywords
target
program
interface
instantiation
plug
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202211308971.3A
Other languages
Chinese (zh)
Other versions
CN115502980B (en
Inventor
魏洪兴
崔元洋
郭凤贺
赵永利
唐亚伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Aubo Beijing Intelligent Technology Co ltd
Original Assignee
Aubo Beijing Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Aubo Beijing Intelligent Technology Co ltd filed Critical Aubo Beijing Intelligent Technology Co ltd
Priority to CN202211308971.3A priority Critical patent/CN115502980B/en
Publication of CN115502980A publication Critical patent/CN115502980A/en
Application granted granted Critical
Publication of CN115502980B publication Critical patent/CN115502980B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J9/00Programme-controlled manipulators
    • B25J9/16Programme controls
    • B25J9/1602Programme controls characterised by the control system, structure, architecture
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J13/00Controls for manipulators
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J9/00Programme-controlled manipulators
    • B25J9/16Programme controls
    • B25J9/1602Programme controls characterised by the control system, structure, architecture
    • B25J9/161Hardware, e.g. neural networks, fuzzy logic, interfaces, processor
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J9/00Programme-controlled manipulators
    • B25J9/16Programme controls
    • B25J9/1656Programme controls characterised by programming, planning systems for manipulators

Landscapes

  • Engineering & Computer Science (AREA)
  • Robotics (AREA)
  • Mechanical Engineering (AREA)
  • Automation & Control Theory (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Stored Programmes (AREA)

Abstract

本申请提供了一种机械臂控制方法、装置、设备和介质,涉及机械臂控制领域,方法包括:获取机械臂控制程序包含的至少一个功能类对应的目标插件接口;在暴露目标插件接口后,获取符合用户的机械臂控制需求的目标自定义程序和/或目标库文件;基于目标自定义程序和/或目标库文件,得到目标自定义程序对应的实例化指针;基于目标自定义程序对应的实例化指针运行自定义程序,以对目标机械臂进行控制。本申请将机械臂控制程序包含的至少一个功能类实现为目标插件接口,使得用户可以基于目标插件接口开发符合机械臂控制需求的目标自定义程序,实现对目标机械臂的控制,避免了机械臂控制程序冗余的问题,控制过程无需用户发指令,降低了控制时延。

Figure 202211308971

The present application provides a method, device, device, and medium for manipulator control, which relate to the field of manipulator control. The method includes: obtaining a target plug-in interface corresponding to at least one functional class included in the manipulator control program; after exposing the target plug-in interface, Obtain the target custom program and/or target library file that meets the user's robotic arm control requirements; obtain the instantiation pointer corresponding to the target custom program based on the target custom program and/or target library file; The instantiated pointer runs a custom program to control the target robotic arm. This application implements at least one functional class contained in the robot arm control program as a target plug-in interface, so that users can develop a target custom program that meets the requirements of the robot arm control based on the target plug-in interface, and realizes the control of the target robot arm, avoiding the need for The problem of control program redundancy, the control process does not require users to send instructions, reducing the control delay.

Figure 202211308971

Description

一种机械臂控制方法、装置、设备和介质Method, device, equipment and medium for controlling a mechanical arm

技术领域technical field

本申请涉及机械臂控制技术领域,特别是涉及一种机械臂控制方法、装置、设备和介质。The present application relates to the technical field of manipulator control, and in particular to a manipulator control method, device, equipment and medium.

背景技术Background technique

用户操作机械臂的过程包括:用户操作客户端,客户端通过已开发的sdk接口与机械臂控制程序通讯,实现对机械臂的控制。The process of the user operating the robotic arm includes: the user operates the client, and the client communicates with the robotic arm control program through the developed sdk interface to realize the control of the robotic arm.

但是,在用户使用机械臂的场景中可能存在一些需求,例如增加两个轴,和机械臂组成八轴联动的需求,目前的机械臂控制程序未提供针对这些需求的sdk接口,因此只能通过在机械臂控制程序的源码中额外添加程序,以新开发适用于新需求的sdk接口,来满足用户需求。但是,用户的需求千变万化,对机械臂控制程序过多的开发导致机械臂控制程序越来越冗余。此外,通过sdk接口实现客户端与机械臂控制程序交互,对于一些高性能需求来说延迟较高,例如,用户需要实时操作机械臂,但是sdk接口方式使得用户发出指令到机械臂响应指令之间存在较高的延迟,用户体验较差。However, there may be some requirements in the scenario where the user uses the robotic arm, such as adding two axes and forming an eight-axis linkage with the robotic arm. The current robotic arm control program does not provide an sdk interface for these requirements, so it can only be obtained through Additional programs are added to the source code of the manipulator control program to newly develop an sdk interface suitable for new requirements to meet user needs. However, the needs of users are ever-changing, and the excessive development of the control program of the manipulator makes the control program of the manipulator more and more redundant. In addition, the interaction between the client and the robotic arm control program is realized through the sdk interface. For some high-performance requirements, the delay is high. For example, the user needs to operate the robotic arm in real time, but the sdk interface allows the user to issue commands and the robotic arm responds to commands. There is high latency and poor user experience.

发明内容Contents of the invention

有鉴于此,本申请提供了一种机械臂控制方法、装置、设备和介质,用于解决现有技术存在的修改机械臂控制程序的源码导致的程序冗余的问题和sdk接口方式发指令导致延时高的问题,其技术方案如下:In view of this, the present application provides a method, device, device and medium for manipulator control, which are used to solve the problem of program redundancy caused by modifying the source code of the manipulator control program in the prior art and the problems caused by sending instructions through the sdk interface. For the problem of high delay, the technical solution is as follows:

一种机械臂控制方法,包括:A method for controlling a robotic arm, comprising:

获取机械臂控制程序包含的至少一个功能类对应的目标插件接口,并将至少一个功能类对应的目标插件接口暴露出来,其中,目标插件接口用于通过至少一个功能类的实例化指针调用机械臂控制程序中包含的至少一个功能类的程序,至少一个功能类中的任一功能类用于控制目标机械臂实现对应功能;Obtain the target plug-in interface corresponding to at least one functional class contained in the robotic arm control program, and expose the target plug-in interface corresponding to at least one functional class, wherein the target plug-in interface is used to call the robotic arm through the instantiation pointer of at least one functional class A program of at least one functional class contained in the control program, any one of the at least one functional class is used to control the target robotic arm to realize the corresponding function;

在暴露目标插件接口后,获取符合用户的机械臂控制需求的目标自定义程序和/或目标库文件,其中,库文件为基于目标自定义程序编译得到的库文件,目标自定义程序是指基于继承和实现的目标插件接口得到的自定义程序;After exposing the target plug-in interface, obtain the target custom program and/or target library file that meets the user's robotic arm control requirements, where the library file is a library file compiled based on the target custom program, and the target custom program refers to a target custom program based on Inherit and implement the target plugin interface to get custom programs;

基于目标自定义程序和/或目标库文件,得到目标自定义程序对应的实例化指针;Obtain an instantiation pointer corresponding to the target custom program based on the target custom program and/or the target library file;

基于目标自定义程序对应的实例化指针运行目标自定义程序,以对目标机械臂进行控制。Run the target custom program based on the instantiation pointer corresponding to the target custom program to control the target robotic arm.

可选的,获取机械臂控制程序包含的至少一个功能类对应的目标插件接口,包括:Optionally, obtain the target plug-in interface corresponding to at least one functional class included in the robotic arm control program, including:

获取并继承机械臂控制程序包含的至少一个功能类;Obtain and inherit at least one functional class contained in the robotic arm control program;

将至少一个功能类分别包含的虚函数实现为接口,以得到至少一个功能类分别对应的实例化指针;Realize the virtual functions contained in at least one functional class as interfaces, so as to obtain the instantiation pointers corresponding to at least one functional class;

将至少一个功能类分别对应的实例化指针作为参数传入虚基类中,得到传参后的虚基类,由传参后的虚基类作为至少一个功能类对应的目标插件接口。The instantiation pointer corresponding to at least one functional class is passed into the virtual base class as a parameter to obtain the virtual base class after the parameter passing, and the virtual base class after the parameter passing is used as the target plug-in interface corresponding to at least one functional class.

可选的,基于目标自定义程序,得到目标自定义程序对应的实例化指针,包括:Optionally, based on the target custom program, the instantiation pointer corresponding to the target custom program is obtained, including:

将目标自定义程序编译为目标库文件;Compile the target custom program into a target library file;

加载目标库文件,以得到目标自定义程序对应的实例化指针。Load the target library file to obtain the instantiation pointer corresponding to the target custom program.

可选的,加载目标库文件,以得到目标自定义程序对应的实例化指针,包括:Optionally, load the target library file to obtain the instantiation pointer corresponding to the target custom program, including:

使用dlopen库函数加载目标库文件,以获得目标库文件对应的实例化指针,作为目标自定义程序对应的实例化指针。Use the dlopen library function to load the target library file to obtain the instantiation pointer corresponding to the target library file as the instantiation pointer corresponding to the target custom program.

可选的,基于目标自定义程序对应的实例化指针运行目标自定义程序,包括:Optionally, run the target customizer based on the instantiation pointer corresponding to the target customizer, including:

基于目标自定义程序对应的实例化指针调用目标插件接口中的初始化接口,对目标库文件相关的用户资源信息进行初始化;Call the initialization interface in the target plug-in interface based on the instantiation pointer corresponding to the target custom program, and initialize the user resource information related to the target library file;

在初始化后,调用目标插件接口中的启动接口,运行目标自定义程序。After initialization, call the start interface in the target plug-in interface to run the target custom program.

可选的,还包括:Optionally, also include:

在目标自定义程序运行后,调用目标插件接口中的停止接口,将已运行的目标自定义程序卸载。After the target custom program is running, call the stop interface in the target plug-in interface to uninstall the running target custom program.

可选的,初始化接口、启动接口和停止接口均为非阻塞接口。Optionally, the initialization interface, the start interface and the stop interface are all non-blocking interfaces.

一种机械臂控制装置,包括:A control device for a robotic arm, comprising:

目标插件接口获取模块,用于获取机械臂控制程序包含的至少一个功能类对应的目标插件接口,并将至少一个功能类对应的目标插件接口暴露出来,其中,目标插件接口用于通过至少一个功能类的实例化指针调用机械臂控制程序中包含的至少一个功能类的程序,至少一个功能类中的任一功能类用于控制目标机械臂实现对应功能;The target plug-in interface acquisition module is used to obtain the target plug-in interface corresponding to at least one functional class included in the manipulator control program, and expose the target plug-in interface corresponding to at least one functional class, wherein the target plug-in interface is used to pass at least one functional class The instantiation pointer of the class calls the program of at least one functional class contained in the robotic arm control program, and any functional class in the at least one functional class is used to control the target robotic arm to realize the corresponding function;

自定义信息获取模块,用于在暴露目标插件接口后,获取符合用户的机械臂控制需求的目标自定义程序和/或目标库文件,其中,库文件为基于目标自定义程序编译得到的库文件,目标自定义程序是指基于继承和实现的目标插件接口得到的自定义程序;The custom information acquisition module is used to obtain the target custom program and/or target library file that meets the user's manipulator control requirements after exposing the target plug-in interface, wherein the library file is a library file compiled based on the target custom program , the target custom program refers to the custom program obtained based on the inherited and implemented target plug-in interface;

程序指针确定模块,用于基于目标自定义程序和/或目标库文件,得到目标自定义程序对应的实例化指针;A program pointer determination module, configured to obtain an instantiation pointer corresponding to the target custom program based on the target custom program and/or the target library file;

机械臂控制模块,用于基于目标自定义程序对应的实例化指针运行目标自定义程序,以对目标机械臂进行控制。The robotic arm control module is configured to run the target custom program based on the instantiation pointer corresponding to the target custom program, so as to control the target robotic arm.

一种机械臂控制设备,包括存储器和处理器;A mechanical arm control device, including a memory and a processor;

存储器,用于存储程序;memory for storing programs;

处理器,用于执行程序,实现如上述任一项的机械臂控制方法的各个步骤。The processor is configured to execute a program to realize each step of any one of the above-mentioned methods for controlling the mechanical arm.

一种可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时,实现如上述任一项的机械臂控制方法的各个步骤。A readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each step of any one of the above-mentioned methods for controlling a mechanical arm is realized.

经由上述的技术方案可知,本申请提供的机械臂控制方法,首先获取机械臂控制程序包含的至少一个功能类对应的目标插件接口,然后在暴露目标插件接口后,获取符合用户的机械臂控制需求的目标自定义程序和/或目标库文件,接着基于目标自定义程序和/或目标库文件,得到目标自定义程序对应的实例化指针,最后基于目标自定义程序对应的实例化指针运行自定义程序,以对目标机械臂进行控制。本申请将机械臂控制程序包含的至少一个功能类实现为目标插件接口,使得用户可以基于目标插件接口开发符合机械臂控制需求的目标自定义程序,从而本申请可以通过运行目标自定义程序实现对目标机械臂的控制,本申请在用户需要按照至少一个功能类外的其他功能对目标机械臂进行控制时,无需在机械臂控制程序的源码中额外添加程序,避免了机械臂控制程序冗余的问题,并且本申请无需用户发指令,降低了机械臂控制的时延,用户体验更好。It can be known from the above-mentioned technical solutions that the method for controlling the manipulator provided by this application first obtains the target plug-in interface corresponding to at least one functional class included in the manipulator control program, and then obtains the manipulator that meets the user’s manipulator control requirements after exposing the target plug-in interface. The target custom program and/or target library file, and then based on the target custom program and/or target library file, get the instantiation pointer corresponding to the target custom program, and finally run the custom program to control the target robotic arm. This application implements at least one functional class contained in the robot arm control program as a target plug-in interface, so that users can develop a target custom program that meets the requirements of manipulator control based on the target plug-in interface, so that this application can realize the target by running the target custom program. For the control of the target robotic arm, this application does not need to add additional programs to the source code of the robotic arm control program when the user needs to control the target robotic arm according to other functions other than at least one functional class, which avoids the redundancy of the robotic arm control program problem, and this application does not require the user to issue instructions, which reduces the delay in the control of the robotic arm and provides a better user experience.

附图说明Description of drawings

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

图1为本申请实施例提供的机械臂控制方法的流程示意图;FIG. 1 is a schematic flowchart of a method for controlling a robotic arm provided in an embodiment of the present application;

图2为本申请实施例提供的机械臂控制装置的结构示意图;FIG. 2 is a schematic structural diagram of a robotic arm control device provided in an embodiment of the present application;

图3为本申请实施例提供的机械臂控制设备的硬件结构框图。Fig. 3 is a block diagram of the hardware structure of the robotic arm control device provided by the embodiment of the present application.

具体实施方式detailed description

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the application with reference to the drawings in the embodiments of the application. Apparently, the described embodiments are only some of the embodiments of the application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.

鉴于现有技术存在的问题,本案发明人进行了深入研究,最终提出了一种机械臂控制方法,接下来通过下述实施例对本申请提供的机械臂控制方法进行详细介绍。In view of the problems existing in the prior art, the inventor of the present case conducted in-depth research, and finally proposed a method for controlling the manipulator. Next, the method for controlling the manipulator provided by the present application will be described in detail through the following embodiments.

请参阅图1,示出了本申请实施例提供的机械臂控制方法的流程示意图,该机械臂控制方法可以包括:Please refer to FIG. 1, which shows a schematic flowchart of a method for controlling a manipulator provided in an embodiment of the present application. The method for controlling a manipulator may include:

步骤S101、获取机械臂控制程序包含的至少一个功能类对应的目标插件接口,并将至少一个功能类对应的目标插件接口暴露出来。Step S101. Obtain a target plug-in interface corresponding to at least one functional class included in the robotic arm control program, and expose the target plug-in interface corresponding to at least one functional class.

其中,目标插件接口用于通过至少一个功能类的实例化指针调用机械臂控制程序中包含的至少一个功能类的程序,至少一个功能类中的任一功能类用于控制目标机械臂实现对应功能。Among them, the target plug-in interface is used to call the program of at least one function class contained in the robot arm control program through the instantiation pointer of at least one function class, and any function class in the at least one function class is used to control the target robot arm to realize the corresponding function .

具体的,本实施例可以对现有技术中的机械臂控制程序按照其中包含的各机械臂功能进行调整,得到包含至少一个功能类的机械臂控制程序,然后再得到至少一个功能类对应的目标插件接口,之后将得到的目标插件接口暴露出来,以便用户基于暴露的目标插件接口,调用至少一个功能类,以编写符合用户的机械臂控制需求的目标自定义程序。Specifically, this embodiment can adjust the robotic arm control program in the prior art according to the functions of each robotic arm contained therein, obtain a robotic arm control program containing at least one functional class, and then obtain the target corresponding to at least one functional class The plug-in interface, and then expose the obtained target plug-in interface, so that the user can call at least one functional class based on the exposed target plug-in interface, so as to write a target custom program that meets the user's robot arm control requirements.

这里,机械臂控制程序包含的至少一个功能类为根据目标机械臂的控制需求进行划分得到,例如根据正逆解、运动控制、外设IO控制、机器人状态获取、机器人开关机、协作机器人安全控制等功能划分。在本步骤中,每个功能类均用于控制机械臂实现对应功能。Here, at least one functional class included in the robot arm control program is divided according to the control requirements of the target robot arm, such as forward and reverse solutions, motion control, peripheral IO control, robot state acquisition, robot power on and off, and collaborative robot safety control and other functional divisions. In this step, each functional class is used to control the robotic arm to realize the corresponding function.

在一可选实施例中,本步骤中的功能类包括如下6类:第一类为算法接口类,例如包括:机械臂坐标系转换、正逆解、不同坐标系坐标点转换等;第二类为机器人控制类,例如包括:启动参数、工具参数、设置关节PID等;第三类为机器人IO类,例如包括设置获取用户IO、获取机器人内部IO状态等;第四类为机器人运动控制类,例如包括机器人速度、加速度、关节运动、直线运动、交融半径、轨迹运动等;第五类为机器人安全类,例如包括缩减模式、碰撞等级等;第六类为机器人状态类,例如包括获取机器人事件、获取机器人设备信息等。In an optional embodiment, the functional classes in this step include the following 6 classes: the first class is an algorithm interface class, for example including: manipulator coordinate system conversion, positive and negative solution, coordinate point conversion of different coordinate systems, etc.; The class is the robot control class, for example, including: startup parameters, tool parameters, joint PID setting, etc.; the third class is the robot IO class, for example, including setting and obtaining the user IO, obtaining the internal IO status of the robot, etc.; the fourth class is the robot motion control class , for example, including robot speed, acceleration, joint motion, linear motion, blend radius, trajectory motion, etc.; the fifth category is robot safety, for example, including reduced mode, collision level, etc.; the sixth category is robot status, for example, including obtaining robot Events, access to robot device information, etc.

当然,上述划分出的6类仅为示例,不作为对本申请的限定。Certainly, the above-mentioned 6 categories are only examples, and are not intended to limit the present application.

步骤S102、在暴露目标插件接口后,获取符合用户的机械臂控制需求的目标自定义程序和/或目标库文件。Step S102, after exposing the target plug-in interface, obtain the target custom program and/or target library file that meet the user's requirements for controlling the manipulator.

其中,库文件为基于目标自定义程序编译得到的库文件,目标自定义程序是指基于继承和实现的目标插件接口得到的自定义程序。Wherein, the library file is a library file compiled based on the target custom program, and the target custom program refers to a custom program obtained based on the inherited and realized target plug-in interface.

具体的,本申请可以实现目标插件接口,并将目标插件接口作为对外接口暴露出来,使得用户可以在暴露的目标插件接口的基础上,根据需求自行添加其他功能代码,以编写出符合机械臂控制需求的目标自定义程序,在该目标自定义程序中可以继承和实现目标插件接口,并基于继承和实现的目标插件接口实现该用户的机械臂控制需求。这里,机械臂控制需求可以为基于上述功能类中的至少一个功能类实现对目标机械臂的控制的需求。Specifically, this application can implement the target plug-in interface, and expose the target plug-in interface as an external interface, so that users can add other function codes according to their needs on the basis of the exposed target plug-in interface, so as to write a program that meets the control requirements of the manipulator. A target customization program for requirements, in which the target plug-in interface can be inherited and implemented, and based on the inherited and implemented target plug-in interface, the user's manipulator control requirements can be realized. Here, the requirement for controlling the robotic arm may be a requirement for controlling the target robotic arm based on at least one of the above functional categories.

可选的,本步骤可以直接获取用户编写的目标自定义程序;可选的,用户可以通过PC机将编写的目标自定义程序编译为目标库文件,那么本步骤可以获取目标库文件;可选的,本步骤还可以既获取目标自定义程序,又获取目标库文件。Optionally, this step can directly obtain the target custom program written by the user; optionally, the user can compile the written target custom program into a target library file through a PC, then this step can obtain the target library file; optional Yes, this step can also obtain both the target custom program and the target library file.

步骤S103、基于目标自定义程序和/或目标库文件,得到目标自定义程序对应的实例化指针。Step S103: Obtain an instantiation pointer corresponding to the target custom program based on the target custom program and/or the target library file.

具体的,若前述步骤获取到目标自定义程序,则本步骤可以将目标自定义程序编译为目标库文件,然后再对目标库文件进行实例化处理,得到目标自定义程序对应的实例化指针;若前述步骤获取到目标库文件,则本步骤可以直接对目标库文件进行实例化处理,得到目标自定义程序对应的实例化指针。Specifically, if the target custom program is obtained in the aforementioned steps, then in this step, the target custom program can be compiled into a target library file, and then the target library file is instantiated to obtain an instantiation pointer corresponding to the target custom program; If the target library file is obtained in the preceding steps, this step can directly instantiate the target library file to obtain an instantiation pointer corresponding to the target custom program.

步骤S104、基于目标自定义程序对应的实例化指针运行目标自定义程序,以对目标机械臂进行控制。Step S104, running the target custom program based on the instantiation pointer corresponding to the target custom program, so as to control the target mechanical arm.

本申请提供的机械臂控制方法,首先获取机械臂控制程序包含的至少一个功能类对应的目标插件接口,然后在暴露所述目标插件接口后,获取符合用户的机械臂控制需求的目标自定义程序和/或目标库文件,接着基于目标自定义程序和/或目标库文件,得到目标自定义程序对应的实例化指针,最后基于目标自定义程序对应的实例化指针运行自定义程序,以对目标机械臂进行控制。本申请将机械臂控制程序包含的至少一个功能类实现为目标插件接口,使得用户可以基于目标插件接口开发符合机械臂控制需求的目标自定义程序,从而本申请可以通过运行目标自定义程序实现对目标机械臂的控制,本申请在用户需要按照至少一个功能类外的其他功能对目标机械臂进行控制时,无需在机械臂控制程序的源码中额外添加程序,避免了机械臂控制程序冗余的问题,并且本申请无需用户发指令,降低了机械臂控制的时延,用户体验更好。The method for controlling the manipulator provided in this application first obtains the target plug-in interface corresponding to at least one functional class included in the manipulator control program, and then obtains the target custom program that meets the user’s manipulator control requirements after exposing the target plug-in interface and/or the target library file, and then based on the target custom program and/or the target library file, obtain the instantiation pointer corresponding to the target custom program, and finally run the custom program based on the instantiation pointer corresponding to the target custom program to target The robotic arm is controlled. This application implements at least one functional class contained in the robot arm control program as a target plug-in interface, so that users can develop a target custom program that meets the requirements of manipulator control based on the target plug-in interface, so that this application can realize the target by running the target custom program. For the control of the target robotic arm, this application does not need to add additional programs to the source code of the robotic arm control program when the user needs to control the target robotic arm according to other functions other than at least one functional class, which avoids the redundancy of the robotic arm control program problem, and this application does not require the user to issue instructions, which reduces the delay in the control of the robotic arm and provides a better user experience.

在本申请的一个实施例中,对前述“步骤S101、获取机械臂控制程序包含的至少一个功能类对应的目标插件接口”的过程进行介绍。In an embodiment of the present application, the aforementioned process of "step S101, obtaining the target plug-in interface corresponding to at least one functional class included in the robot control program" is introduced.

可选的,“步骤S101、获取机械臂控制程序包含的至少一个功能类对应的目标插件接口”的过程可以包括以下步骤:Optionally, the process of "step S101, obtaining the target plug-in interface corresponding to at least one functional class contained in the robotic arm control program" may include the following steps:

步骤S1011、获取并继承机械臂控制程序包含的至少一个功能类。Step S1011 , acquiring and inheriting at least one function class included in the robotic arm control program.

步骤S1012、将至少一个功能类分别包含的虚函数实现为接口,以得到至少一个功能类分别对应的实例化指针。Step S1012, implementing virtual functions included in at least one functional class as interfaces, so as to obtain instantiation pointers corresponding to at least one functional class.

具体的,在c++中为用户提供了很多虚函数,由此至少一个功能类包含的每个功能类中均可以包含多个c++中的虚函数,本步骤可以在继承每个功能类后,将每个功能类包含的虚函数实现为接口,以得到至少一个功能类分别对应的实例化指针。这里,一功能类对应的实例化指针用于指向该功能类,通过调用该功能类对应的实例化指针可以调用该功能类来对目标机械臂进行功能控制。Specifically, a lot of virtual functions are provided for users in c++, so that at least one functional class can include multiple virtual functions in c++ in each functional class. This step can be performed after inheriting each functional class The virtual functions included in each functional class are realized as interfaces, so as to obtain the instantiation pointers corresponding to at least one functional class. Here, the instantiation pointer corresponding to a function class is used to point to the function class, and by calling the instantiation pointer corresponding to the function class, the function class can be called to perform functional control on the target mechanical arm.

步骤S1013、将至少一个功能类分别对应的实例化指针作为参数传入虚基类中,得到传参后的虚基类,由传参后的虚基类作为至少一个功能类对应的目标插件接口。Step S1013, pass the instantiation pointer corresponding to at least one functional class into the virtual base class as a parameter, obtain the virtual base class after passing the parameter, and use the virtual base class after passing the parameter as the target plug-in interface corresponding to at least one functional class .

这里,传参后的虚基类是指传入至少一个功能类分别对应的实例化指针后的虚基类,在本步骤中,可以将传参后的虚基类定义为“RobotPlugin”类。Here, the virtual base class after parameter passing refers to the virtual base class after passing in the instantiation pointers corresponding to at least one functional class. In this step, the virtual base class after parameter passing can be defined as the "RobotPlugin" class.

可选的,如前述步骤S1012中的介绍,每个功能类中包括多个虚函数,那么,本步骤得到的目标插件接口可以包括至少一个功能类中与多个虚函数对应的多个功能接口,例如目标插件接口中包括控制目标机械臂轴动的接口。Optionally, as described in the aforementioned step S1012, each functional class includes multiple virtual functions, then the target plug-in interface obtained in this step may include multiple functional interfaces corresponding to multiple virtual functions in at least one functional class , for example, the target plug-in interface includes the interface for controlling the axis movement of the target manipulator.

本实施例通过剥离机械臂控制程序功能,重新实现对外接口,并通过C++虚函数方式对外提供目标插件接口,使得用户可以使用目标插件接口,并按照需求编写目标自定义程序,提高了用户对目标机械臂的控制体验。This embodiment re-realizes the external interface by stripping off the control program function of the manipulator, and provides the target plug-in interface externally through the C++ virtual function mode, so that the user can use the target plug-in interface and write the target custom program according to the demand, which improves the user's understanding of the target. The control experience of the robotic arm.

以下的一个实施例,对步骤S103中“基于目标自定义程序,得到目标自定义程序对应的实例化指针”的过程进行说明。In the following embodiment, the process of "obtaining the instantiation pointer corresponding to the target custom program based on the target custom program" in step S103 will be described.

在本实施例中,“基于目标自定义程序,得到目标自定义程序对应的实例化指针”的过程可以包括:In this embodiment, the process of "obtaining the instantiation pointer corresponding to the target custom program based on the target custom program" may include:

步骤S1031、将目标自定义程序编译为目标库文件。Step S1031, compiling the target custom program into a target library file.

步骤S1032、加载目标库文件,以得到目标自定义程序对应的实例化指针。Step S1032, loading the target library file to obtain the instantiation pointer corresponding to the target custom program.

可选的,本步骤“加载目标库文件,以得到目标自定义程序对应的实例化指针”的过程可以包括:使用dlopen库函数加载目标库文件,以获得目标库文件对应的实例化指针,作为目标自定义程序对应的实例化指针。Optionally, the process of "loading the target library file to obtain the instantiation pointer corresponding to the target custom program" in this step may include: using the dlopen library function to load the target library file to obtain the instantiation pointer corresponding to the target library file, as The instantiation pointer for the target customizer.

为了使机械臂控制程序运行过程中加载目标自定义程序,可以使用C语言中的dlopen库函数来记载目标库文件,这里,dlopen可以以指定模式打开指定的动态链接库文件,并返回一个句柄(对于本步骤来说,该句柄即目标自定义程序对应的实例化指针)给调用进程。In order to load the target custom program during the running of the manipulator control program, the dlopen library function in C language can be used to record the target library file. Here, dlopen can open the specified dynamic link library file in the specified mode and return a handle ( For this step, the handle (that is, the instantiation pointer corresponding to the target custom program) is given to the calling process.

具体来说,本步骤可以将目标库文件使用c++中的extern”C”导出为dlopen可识别的形式,然后再使用dlopen库函数加载,以得到目标库文件对应的实例化指针,该指针也即上述步骤中提及的目标自定义程序对应的实例化指针。Specifically, in this step, the target library file can be exported into a form recognizable by dlopen using extern "C" in c++, and then loaded with the dlopen library function to obtain the instantiation pointer corresponding to the target library file, which is also The instantiation pointer for the target customizer mentioned in the above steps.

经由本实施例的过程,使得后续步骤可以加载运行目标自定义程序。Through the process of this embodiment, the subsequent steps can load and run the target custom program.

在一可选实施例中,“步骤S104、基于目标自定义程序对应的实例化指针运行目标自定义程序”的过程可以包括:In an optional embodiment, the process of "step S104, running the target custom program based on the instantiation pointer corresponding to the target custom program" may include:

步骤S1041、基于目标自定义程序对应的实例化指针调用目标插件接口中的初始化接口,对目标库文件相关的用户资源信息进行初始化。Step S1041, calling the initialization interface in the target plug-in interface based on the instantiation pointer corresponding to the target custom program, and initializing the user resource information related to the target library file.

可选的,本实施例中的目标插件接口至少包括初始化接口和启动接口,其中,初始化接口用于对目标库文件相关的用户资源信息进行优化,启动接口用于在优化后运行目标自定义程序。Optionally, the target plug-in interface in this embodiment includes at least an initialization interface and a startup interface, wherein the initialization interface is used to optimize user resource information related to the target library file, and the startup interface is used to run the target custom program after optimization .

在本步骤中,可以通过目标自定义程序对应的实例化指针访问初始化接口,以在目标库文件中实现用户资源信息的初始化。In this step, the initialization interface can be accessed through the instantiation pointer corresponding to the target custom program, so as to realize the initialization of user resource information in the target library file.

步骤S1042、在初始化后,调用目标插件接口中的启动接口,运行目标自定义程序。Step S1042, after initialization, call the startup interface in the target plug-in interface, and run the target custom program.

本步骤可以通过运行目标自定义程序,来实现对目标机械臂的控制。In this step, the target robotic arm can be controlled by running the target custom program.

如用户通过jsonrpc数据控制机械臂,用户在初始化接口中获取至少一个功能类分别对应的实例化指针后便可以使用这些功能,在启动接口中开启webserver接收,接收到json数据并解析完成,根据json数据中的方法对应使用实例化指针去控制目标机械臂,如json数据中方法是moveJoint,数据是6个0,则可以调用机器人运动控制类中的轴动接口控制目标机械臂运动。If the user controls the robotic arm through jsonrpc data, the user can use these functions after obtaining the instantiation pointers corresponding to at least one functional class in the initialization interface, start the webserver reception in the startup interface, receive the json data and complete the analysis, according to the json The method in the data corresponds to using the instantiated pointer to control the target robotic arm. For example, the method in the json data is moveJoint, and the data is 6 zeros, then you can call the axis interface in the robot motion control class to control the movement of the target robotic arm.

考虑到用户在基于目标自定义程序对目标机械臂进行控制后,可能后续不再需要对目标机械臂进行控制,或者需要按照其他需求对目标机械臂进行控制,此时可以将已运行的目标自定义程序卸载,以避免资源占用。Considering that after the user controls the target robotic arm based on the target custom program, it may not be necessary to control the target robotic arm in the future, or the target robotic arm needs to be controlled according to other requirements. At this time, the running target automatic Define program unloading to avoid resource hogging.

那么,可选的,本实施例还可以包括以下步骤S1043:Then, optionally, this embodiment may also include the following step S1043:

步骤S1043、在目标自定义程序运行后,调用目标插件接口中的停止接口,将已运行的目标自定义程序卸载。Step S1043, after the target custom program runs, call the stop interface in the target plug-in interface to uninstall the running target custom program.

也即,可选的,目标插件接口还可以包括停止接口,该停止接口用于将已运行的目标自定义程序卸载,因此,本步骤可以在目标自定义程序运行后,根据用户的卸载需求,调用目标插件接口中的停止接口,将已运行的目标自定义程序卸载。That is, optionally, the target plug-in interface may also include a stop interface, which is used to uninstall the running target custom program. Therefore, in this step, after the target custom program runs, according to the user's uninstallation requirements, Call the stop interface in the target plug-in interface to uninstall the running target custom program.

在一种可能的实现方式中,考虑到本申请在执行时,可能会有其他程序也在执行,为了避免本实施例在调用初始化接口、启动接口和停止接口中的任一个接口时,影响其他程序的执行,可选的,初始化接口、启动接口和停止接口均为非阻塞接口。In a possible implementation, considering that other programs may also be executed when the application is being executed, in order to prevent this embodiment from affecting other For program execution, optionally, the initialization interface, start interface and stop interface are all non-blocking interfaces.

在另一种可能的实现方式中,用户可能会产生多个机械臂控制需求,由此可能编写多个目标自定义程序,为此,本实施例还可以提供一配置文件,在步骤S102获取到各目标自定义程序和/或各目标自定义程序对应的目标库文件时,根据目标自定义程序和/或目标库文件的获取顺序,依次在配置文件中进行配置,以采用上述各实施例顺序运行各目标自定义程序;或者,根据用户对控制顺序的需求,在配置文件中预先配置各目标自定义程序的运行顺序,以采用上述各实施例按配置文件中的顺序运行各目标自定义程序。In another possible implementation, the user may have multiple requirements for manipulator control, and thus may write multiple target custom programs. For this reason, this embodiment can also provide a configuration file, which is obtained in step S102. When each target custom program and/or the target library file corresponding to each target custom program, according to the acquisition sequence of the target custom program and/or target library file, configure them in the configuration file in order to adopt the order of the above-mentioned embodiments Run each target custom program; or, according to the user's demand for the control sequence, pre-configure the running sequence of each target custom program in the configuration file, so as to use the above-mentioned embodiments to run each target custom program in the order in the configuration file .

本申请实施例还提供了一种机械臂控制装置,下面对本申请实施例提供的机械臂控制装置进行描述,下文描述的机械臂控制装置与上文描述的机械臂控制方法可相互对应参照。The embodiment of the present application also provides a robotic arm control device. The following describes the robotic arm control device provided in the embodiment of the present application. The robotic arm control device described below and the robotic arm control method described above can be referred to in correspondence.

请参阅图2,示出了本申请实施例提供的机械臂控制装置的结构示意图,如图2所示,该机械臂控制装置可以包括:目标插件接口获取模块201、自定义信息获取模块202、程序指针确定模块203和机械臂控制模块204。Please refer to FIG. 2 , which shows a schematic structural diagram of a robotic arm control device provided by an embodiment of the present application. As shown in FIG. 2 , the robotic arm control device may include: a target plug-in interface acquisition module 201, a custom information acquisition module 202, A program pointer determination module 203 and a robot arm control module 204 .

目标插件接口获取模块201,用于获取机械臂控制程序包含的至少一个功能类对应的目标插件接口,并将至少一个功能类对应的目标插件接口暴露出来,其中,目标插件接口用于通过至少一个功能类的实例化指针调用机械臂控制程序中包含的至少一个功能类的程序,至少一个功能类中的任一功能类用于控制目标机械臂实现对应功能。The target plug-in interface acquisition module 201 is used to obtain the target plug-in interface corresponding to at least one functional class included in the manipulator control program, and expose the target plug-in interface corresponding to at least one functional class, wherein the target plug-in interface is used to pass at least one The instantiation pointer of the functional class calls the program of at least one functional class included in the control program of the robotic arm, and any functional class in the at least one functional class is used to control the target mechanical arm to realize the corresponding function.

自定义信息获取模块202,用于在暴露目标插件接口后,获取符合用户的机械臂控制需求的目标自定义程序和/或目标库文件,其中,库文件为基于目标自定义程序编译得到的库文件,目标自定义程序是指基于继承和实现的目标插件接口得到的自定义程序。The custom information acquisition module 202 is configured to obtain a target custom program and/or a target library file that meets the user's robotic arm control requirements after exposing the target plug-in interface, wherein the library file is a library compiled based on the target custom program file, a target customizer is a customizer based on inherited and implemented target plugin interfaces.

程序指针确定模块203,用于基于目标自定义程序和/或目标库文件,得到目标自定义程序对应的实例化指针。The program pointer determining module 203 is configured to obtain an instantiation pointer corresponding to the target custom program based on the target custom program and/or the target library file.

机械臂控制模块204,用于基于目标自定义程序对应的实例化指针运行目标自定义程序,以对目标机械臂进行控制。The robotic arm control module 204 is configured to run the target custom program based on the instantiation pointer corresponding to the target custom program, so as to control the target robotic arm.

本申请提供的机械臂控制装置,首先获取机械臂控制程序包含的至少一个功能类对应的目标插件接口,然后在暴露目标插件接口后,获取符合用户的机械臂控制需求的目标自定义程序和/或目标库文件,接着基于目标自定义程序和/或目标库文件,得到目标自定义程序对应的实例化指针,最后基于目标自定义程序对应的实例化指针运行自定义程序,以对目标机械臂进行控制。本申请将机械臂控制程序包含的至少一个功能类实现为目标插件接口,使得用户可以基于目标插件接口开发符合机械臂控制需求的目标自定义程序,从而本申请可以通过运行目标自定义程序实现对目标机械臂的控制,本申请在用户需要按照至少一个功能类外的其他功能对目标机械臂进行控制时,无需在机械臂控制程序的源码中额外添加程序,避免了机械臂控制程序冗余的问题,并且本申请无需用户发指令,降低了机械臂控制的时延,用户体验更好。The robot arm control device provided by this application first obtains the target plug-in interface corresponding to at least one functional class contained in the robot arm control program, and then obtains the target custom program and/or or the target library file, and then based on the target custom program and/or the target library file, obtain the instantiation pointer corresponding to the target custom program, and finally run the custom program based on the instantiation pointer corresponding to the target custom program to target the robot arm Take control. This application implements at least one functional class contained in the robot arm control program as a target plug-in interface, so that users can develop a target custom program that meets the requirements of manipulator control based on the target plug-in interface, so that this application can realize the target by running the target custom program. For the control of the target robotic arm, this application does not need to add additional programs to the source code of the robotic arm control program when the user needs to control the target robotic arm according to other functions other than at least one functional class, which avoids the redundancy of the robotic arm control program problem, and this application does not require the user to issue instructions, which reduces the delay in the control of the robotic arm and provides a better user experience.

在一种可能的实现方式中,上述目标插件接口获取模块201可以包括:功能类获取继承模块、功能指针确定模块和虚基类传参模块。In a possible implementation manner, the target plug-in interface acquisition module 201 may include: a function class acquisition inheritance module, a function pointer determination module, and a virtual base class parameter passing module.

功能类获取继承模块,用于获取并继承机械臂控制程序包含的至少一个功能类。The function class acquisition inheritance module is used to acquire and inherit at least one function class included in the robotic arm control program.

功能指针确定模块,用于将至少一个功能类分别包含的虚函数实现为接口,以得到至少一个功能类分别对应的实例化指针。The function pointer determination module is used to implement the virtual functions included in at least one function class as interfaces, so as to obtain the instantiation pointers corresponding to the at least one function class respectively.

虚基类传参模块,用于将至少一个功能类分别对应的实例化指针作为参数传入虚基类中,得到传参后的虚基类,由传参后的虚基类作为至少一个功能类对应的目标插件接口。The virtual base class parameter passing module is used to pass the instantiation pointer corresponding to at least one functional class into the virtual base class as a parameter, and obtain the virtual base class after passing the parameter, and use the virtual base class after passing the parameter as at least one function The class corresponds to the target plugin interface.

在一种可能的实现方式中,上述程序指针确定模块203在基于目标自定义程序,得到目标自定义程序对应的实例化指针时可以包括:程序编译模块和库文件加载模块。In a possible implementation manner, when the program pointer determination module 203 obtains the instantiation pointer corresponding to the target custom program based on the target custom program, it may include: a program compiling module and a library file loading module.

程序编译模块,用于将目标自定义程序编译为目标库文件。The program compilation module is used for compiling the target custom program into a target library file.

库文件加载模块,用于加载目标库文件,以得到目标自定义程序对应的实例化指针。The library file loading module is used to load the target library file to obtain the instantiation pointer corresponding to the target custom program.

在一种可能的实现方式中,上述库文件加载模块具体可以用于使用dlopen库函数加载目标库文件,以获得目标库文件对应的实例化指针,作为目标自定义程序对应的实例化指针。In a possible implementation manner, the above-mentioned library file loading module can specifically be used to load the target library file using the dlopen library function, so as to obtain the instantiation pointer corresponding to the target library file as the instantiation pointer corresponding to the target custom program.

在一种可能的实现方式中,上述机械臂控制模块204可以包括:初始化接口调用模块和启动接口调用模块。In a possible implementation manner, the aforementioned robotic arm control module 204 may include: an initialization interface calling module and a starting interface calling module.

初始化接口调用模块,用于基于目标自定义程序对应的实例化指针调用目标插件接口中的初始化接口,对目标库文件相关的用户资源信息进行初始化;The initialization interface calling module is used to call the initialization interface in the target plug-in interface based on the instantiation pointer corresponding to the target custom program, and initialize the user resource information related to the target library file;

启动接口调用模块,用于在初始化后,调用目标插件接口中的启动接口,运行目标自定义程序。The startup interface calling module is used to call the startup interface in the target plug-in interface after initialization, and run the target custom program.

在一种可能的实现方式中,本申请实施例提供的机械臂控制装置还可以包括:停止接口调用模块。In a possible implementation manner, the device for controlling a robotic arm provided in the embodiment of the present application may further include: a stop interface calling module.

停止接口调用模块,用于在目标自定义程序运行后,调用目标插件接口中的停止接口,将已运行的目标自定义程序卸载。The stop interface calling module is used to call the stop interface in the target plug-in interface after the target custom program is running, so as to unload the running target custom program.

在一种可能的实现方式中,上述初始化接口、启动接口和停止接口均为非阻塞接口。In a possible implementation manner, the above initialization interface, start interface and stop interface are all non-blocking interfaces.

本申请实施例还提供了一种机械臂控制设备。可选的,图3示出了机械臂控制设备的硬件结构框图,参照图3,该机械臂控制设备的硬件结构可以包括:至少一个处理器301,至少一个通信接口302,至少一个存储器303和至少一个通信总线304;The embodiment of the present application also provides a device for controlling a robotic arm. Optionally, FIG. 3 shows a block diagram of a hardware structure of the robotic arm control device. Referring to FIG. 3, the hardware structure of the robotic arm control device may include: at least one processor 301, at least one communication interface 302, at least one memory 303 and at least one communication bus 304;

在本申请实施例中,处理器301、通信接口302、存储器303、通信总线304的数量为至少一个,且处理器301、通信接口302、存储器303通过通信总线304完成相互间的通信;In the embodiment of the present application, the number of processor 301, communication interface 302, memory 303, and communication bus 304 is at least one, and the processor 301, communication interface 302, and memory 303 complete mutual communication through the communication bus 304;

处理器301可能是一个中央处理器CPU,或者是特定集成电路ASIC(ApplicationSpecific Integrated Circuit),或者是被配置成实施本发明实施例的一个或多个集成电路等;The processor 301 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention, etc.;

存储器303可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory)等,例如至少一个磁盘存储器;The memory 303 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory;

其中,存储器303存储有程序,处理器301可调用存储器303存储的程序,所述程序用于:Wherein, the memory 303 stores a program, and the processor 301 can call the program stored in the memory 303, and the program is used for:

获取机械臂控制程序包含的至少一个功能类对应的目标插件接口,并将至少一个功能类对应的目标插件接口暴露出来,其中,目标插件接口用于通过至少一个功能类的实例化指针调用机械臂控制程序中包含的至少一个功能类的程序,至少一个功能类中的任一功能类用于控制目标机械臂实现对应功能;Obtain the target plug-in interface corresponding to at least one functional class contained in the robotic arm control program, and expose the target plug-in interface corresponding to at least one functional class, wherein the target plug-in interface is used to call the robotic arm through the instantiation pointer of at least one functional class A program of at least one functional class contained in the control program, any one of the at least one functional class is used to control the target robotic arm to realize the corresponding function;

在暴露目标插件接口后,获取符合用户的机械臂控制需求的目标自定义程序和/或目标库文件,其中,库文件为基于目标自定义程序编译得到的库文件,目标自定义程序是指基于继承和实现的目标插件接口得到的自定义程序;After exposing the target plug-in interface, obtain the target custom program and/or target library file that meets the user's robotic arm control requirements, where the library file is a library file compiled based on the target custom program, and the target custom program refers to a target custom program based on Inherit and implement the target plugin interface to get custom programs;

基于目标自定义程序和/或目标库文件,得到目标自定义程序对应的实例化指针;Obtain an instantiation pointer corresponding to the target custom program based on the target custom program and/or the target library file;

基于目标自定义程序对应的实例化指针运行目标自定义程序,以对目标机械臂进行控制。Run the target custom program based on the instantiation pointer corresponding to the target custom program to control the target robotic arm.

可选的,所述程序的细化功能和扩展功能可参照上文描述。Optionally, the detailed functions and extended functions of the program can refer to the above description.

本申请实施例还提供一种可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时,实现如上述机械臂控制方法。The embodiment of the present application also provides a readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above method for controlling the mechanical arm is implemented.

可选的,所述程序的细化功能和扩展功能可参照上文描述。Optionally, the detailed functions and extended functions of the program can refer to the above description.

最后,还需要说明的是,在本文中,诸如和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should also be noted that in this text, relational terms such as and second etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that these entities or operations Any such actual relationship or order exists between. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other.

对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本申请。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the application. Therefore, the present application will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A robot arm control method is characterized by comprising the following steps:
acquiring a target plug-in interface corresponding to at least one function class contained in a mechanical arm control program, and exposing the target plug-in interface corresponding to the at least one function class, wherein the target plug-in interface is used for calling the program of the at least one function class contained in the mechanical arm control program through an instantiation pointer of the at least one function class, and any function class in the at least one function class is used for controlling a target mechanical arm to realize a corresponding function;
after the target plug-in interface is exposed, acquiring a target custom program and/or a target library file meeting the control requirement of a mechanical arm of a user, wherein the library file is compiled based on the target custom program, and the target custom program is a custom program obtained based on the inherited and realized target plug-in interface;
obtaining an instantiation pointer corresponding to the target self-defining program based on the target self-defining program and/or the target library file;
and operating the target self-defining program based on the instantiation pointer corresponding to the target self-defining program so as to control the target mechanical arm.
2. The method according to claim 1, wherein the obtaining of the target plug-in interface corresponding to at least one function class included in the robot control program comprises:
acquiring and inheriting at least one function class contained in the mechanical arm control program;
the virtual functions respectively contained in the at least one function class are realized as interfaces to obtain instantiation pointers respectively corresponding to the at least one function class;
and transmitting instantiation pointers corresponding to the at least one function class into a virtual base class as parameters to obtain a reference-transmitted virtual base class, and using the reference-transmitted virtual base class as a target plug-in interface corresponding to the at least one function class.
3. The mechanical arm control method of claim 1, wherein obtaining an instantiation pointer corresponding to the target custom program based on the target custom program comprises:
compiling the target custom program into the target library file;
and loading the target library file to obtain an instantiation pointer corresponding to the target self-defined program.
4. The method as claimed in claim 3, wherein the loading the target library file to obtain an instantiation pointer corresponding to the target custom program comprises:
and loading the target library file by using a dlopen library function to obtain an instantiation pointer corresponding to the target library file, wherein the instantiation pointer is used as the instantiation pointer corresponding to the target self-defined program.
5. The method for controlling a robot arm according to claim 1, wherein the running the target custom program based on the instantiation pointer corresponding to the target custom program comprises:
calling an initialization interface in the target plug-in interface based on an instantiation pointer corresponding to the target custom program, and initializing user resource information related to the target library file;
and after initialization, calling a starting interface in the target plug-in interface, and running the target custom program.
6. The robot arm control method according to claim 5, further comprising:
and after the target custom program runs, calling a stop interface in the target plug-in interface, and unloading the running target custom program.
7. The method of claim 6, wherein the initialization interface, the start interface, and the stop interface are non-blocking interfaces.
8. A robot arm control apparatus, comprising:
the system comprises a target plug-in interface acquisition module, a target plug-in interface acquisition module and a target plug-in interface acquisition module, wherein the target plug-in interface acquisition module is used for acquiring a target plug-in interface corresponding to at least one function class contained in a mechanical arm control program and exposing the target plug-in interface corresponding to the at least one function class, the target plug-in interface is used for calling the program of the at least one function class contained in the mechanical arm control program through an instantiation pointer of the at least one function class, and any one function class in the at least one function class is used for controlling a target mechanical arm to realize a corresponding function;
the user-defined information acquisition module is used for acquiring a target user-defined program and/or a target library file meeting the control requirement of the mechanical arm of a user after the target plug-in interface is exposed, wherein the library file is compiled based on the target user-defined program, and the target user-defined program is a user-defined program obtained based on the inherited and realized target plug-in interface;
the program pointer determining module is used for obtaining an instantiation pointer corresponding to the target self-defining program based on the target self-defining program and/or the target library file;
and the mechanical arm control module is used for operating the target self-defining program based on the instantiation pointer corresponding to the target self-defining program so as to control the target mechanical arm.
9. A robot arm control apparatus characterized by comprising a memory and a processor;
the memory is used for storing programs;
the processor is configured to execute the program to implement the steps of the robot arm control method according to any one of claims 1 to 7.
10. A readable storage medium having stored thereon a computer program for implementing the steps of the robot arm control method according to any of claims 1-7 when executed by a processor.
CN202211308971.3A 2022-10-25 2022-10-25 A robot arm control method, device, equipment and medium Active CN115502980B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211308971.3A CN115502980B (en) 2022-10-25 2022-10-25 A robot arm control method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211308971.3A CN115502980B (en) 2022-10-25 2022-10-25 A robot arm control method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN115502980A true CN115502980A (en) 2022-12-23
CN115502980B CN115502980B (en) 2024-12-24

Family

ID=84513172

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211308971.3A Active CN115502980B (en) 2022-10-25 2022-10-25 A robot arm control method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115502980B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050193392A1 (en) * 2004-02-27 2005-09-01 Francesco Carusi Method and system for instantiating components conforming to the "COM" specification in custom contexts
EP1944701A1 (en) * 2006-12-21 2008-07-16 Research In Motion Limited Sharing user defined location based zones
CN101683037A (en) * 2008-09-26 2010-03-31 中国农业大学 Controller for fruit picking robot
US20140075372A1 (en) * 2012-09-13 2014-03-13 Joyce Wu Pointer unification
WO2014114127A1 (en) * 2013-01-24 2014-07-31 Tencent Technology (Shenzhen) Company Limited Method, apparatus and system for webpage access control
CN104598282A (en) * 2015-02-05 2015-05-06 广州华多网络科技有限公司 Control capture method and equipment
CN107247634A (en) * 2017-06-06 2017-10-13 广州视源电子科技股份有限公司 Method and device for dynamic asynchronous remote process call of robot
CN109542536A (en) * 2018-11-12 2019-03-29 北京许继电气有限公司 The plug-in's data processing method of object-oriented
CN109828796A (en) * 2019-01-17 2019-05-31 武汉精立电子技术有限公司 A kind of plug-in unit call method and device based on microkernel architecture
CN109910010A (en) * 2019-03-23 2019-06-21 广东石油化工学院 A system and method for efficiently controlling a robot
CN113051088A (en) * 2021-03-31 2021-06-29 广州锦行网络科技有限公司 Program loading method, device, equipment and computer readable medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050193392A1 (en) * 2004-02-27 2005-09-01 Francesco Carusi Method and system for instantiating components conforming to the "COM" specification in custom contexts
EP1944701A1 (en) * 2006-12-21 2008-07-16 Research In Motion Limited Sharing user defined location based zones
CN101683037A (en) * 2008-09-26 2010-03-31 中国农业大学 Controller for fruit picking robot
US20140075372A1 (en) * 2012-09-13 2014-03-13 Joyce Wu Pointer unification
WO2014114127A1 (en) * 2013-01-24 2014-07-31 Tencent Technology (Shenzhen) Company Limited Method, apparatus and system for webpage access control
CN104598282A (en) * 2015-02-05 2015-05-06 广州华多网络科技有限公司 Control capture method and equipment
CN107247634A (en) * 2017-06-06 2017-10-13 广州视源电子科技股份有限公司 Method and device for dynamic asynchronous remote process call of robot
CN109542536A (en) * 2018-11-12 2019-03-29 北京许继电气有限公司 The plug-in's data processing method of object-oriented
CN109828796A (en) * 2019-01-17 2019-05-31 武汉精立电子技术有限公司 A kind of plug-in unit call method and device based on microkernel architecture
CN109910010A (en) * 2019-03-23 2019-06-21 广东石油化工学院 A system and method for efficiently controlling a robot
CN113051088A (en) * 2021-03-31 2021-06-29 广州锦行网络科技有限公司 Program loading method, device, equipment and computer readable medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
徐雪峰;黄余;: "基于机器视觉的机器人智能采摘实验平台开发", 中国农机化学报, no. 12, 15 December 2019 (2019-12-15), pages 183 - 189 *

Also Published As

Publication number Publication date
CN115502980B (en) 2024-12-24

Similar Documents

Publication Publication Date Title
US7823126B2 (en) Robot control software framework in open distributed process architecture
CN103718155B (en) runtime system
CN110531962B (en) Development processing method and device for applet and computer readable storage medium
CN113641413B (en) Target model loading and updating method and device, readable medium and electronic device
WO2024140416A1 (en) Industrial control program development platform and method
CN103853535A (en) Method and device for modifying middleware
CN112764729A (en) Application software development method and device, computer equipment and readable storage medium
US20130030568A1 (en) Robot system control method and a device therefor
CN111168668A (en) A robot control method and robot
WO2025112914A1 (en) Axis group motion control system, method and device
CN119473272A (en) A heterogeneous model calling method, device and storage medium for strongly typed languages
CN115502980A (en) Method, device, equipment and medium for controlling a mechanical arm
CN113656001A (en) Platform component development method, apparatus, computer equipment and storage medium
CN112052040B (en) Processing method, device, computer equipment and storage medium
US8200849B1 (en) Model based network communications
CN113459081A (en) Modular robot control system and electronic device comprising same
US12118412B2 (en) Data processing
CN104678875B (en) A kind of frequency converter configuration method and frequency converter configure system
CN114706790A (en) A kind of automatic software testing method, device and equipment
US12099870B2 (en) Reducing call stack usage for future object completions
EP4394601A1 (en) Systems, methods, and apparatus for intermediary representations of workflows for computational devices
WO2022166553A1 (en) Method and apparatus for implementing batch system calls
CN111061460B (en) Universal software development platform based on embedded system
CN110018959B (en) Embedded application debugging method and system
CN115061403A (en) A software-defined controller and its programming method and motion control method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant