WO2023115758A1 - 并联机器人的多线程控制器 - Google Patents

并联机器人的多线程控制器 Download PDF

Info

Publication number
WO2023115758A1
WO2023115758A1 PCT/CN2022/086273 CN2022086273W WO2023115758A1 WO 2023115758 A1 WO2023115758 A1 WO 2023115758A1 CN 2022086273 W CN2022086273 W CN 2022086273W WO 2023115758 A1 WO2023115758 A1 WO 2023115758A1
Authority
WO
WIPO (PCT)
Prior art keywords
thread
real
time
robot
preprocessing
Prior art date
Application number
PCT/CN2022/086273
Other languages
English (en)
French (fr)
Inventor
朱平步
李艳华
王慧
李志峰
刘松涛
Original Assignee
辰星(天津)自动化设备有限公司
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 辰星(天津)自动化设备有限公司 filed Critical 辰星(天津)自动化设备有限公司
Priority to JP2022578871A priority Critical patent/JP2024503168A/ja
Priority to US18/012,961 priority patent/US20240100697A1/en
Publication of WO2023115758A1 publication Critical patent/WO2023115758A1/zh

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/1656Programme controls characterised by programming, planning systems for manipulators
    • B25J9/1664Programme controls characterised by programming, planning systems for manipulators characterised by motion, path, trajectory planning
    • 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/003Programme-controlled manipulators having parallel kinematics
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J9/00Programme-controlled manipulators
    • B25J9/16Programme controls
    • B25J9/1615Programme controls characterised by special kind of manipulator, e.g. planar, scara, gantry, cantilever, space, closed chain, passive/active joints and tendon driven 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/1628Programme controls characterised by the control loop
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/30Nc systems
    • G05B2219/34Director, elements to supervisory
    • G05B2219/34333Multi threading
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/30Nc systems
    • G05B2219/39Robotics, robotics to robotics hand
    • G05B2219/39001Robot, manipulator control
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/30Nc systems
    • G05B2219/50Machine tool, machine tool null till machine tool work handling
    • G05B2219/50162Stewart platform, hexapod construction

Definitions

  • the present application relates to the technical field of robots, in particular to a multi-threaded controller of a parallel robot.
  • Robot motion control is a relatively complex process. Robot control has high requirements for real-time performance. It is necessary to ensure the timeliness of communication between the controller and hardware. At the same time, the process of robot motion planning requires reading and writing files, communications, and mathematics. For some time-consuming operations such as calculations, these operations need to provide the necessary data for motion, and cannot affect the real-time performance of communication with the hardware, so it is necessary to distinguish threads.
  • the present application provides a multi-thread controller for a parallel robot to solve the problem of insufficient real-time and security of the existing multi-thread control scheme.
  • An embodiment of the present application provides a multithreaded controller for a parallel robot, which includes: a main thread, a real-time thread, a preprocessing thread, and a background thread; Mutual scheduling, by creating thread tasks, storing data in the buffer list to be called by other processes, and using thread security queues to ensure the normal call and execution of threads;
  • the main thread is used for initialization and thread calling to realize the control of the motion logic of the parallel robot; wherein, the initialization includes: initializing hardware communication, initializing log management tools, initializing alarm management tools, initializing a custom TCP communication protocol . Initializing the clock and initializing the robot parameters; the thread calling includes: receiving instruction for modifying variables, receiving execution instruction, performing asynchronous operation and controlling communication;
  • the real-time thread is used to realize communication and interface interaction with hardware devices, including: acquiring robot hardware parameters, calculating the real-time position of the robot's moving platform, sending control signals to the hardware and triggering I/O devices in real time;
  • the preprocessing thread is used to implement motion planning, including: variable instruction parsing, robot motion planning and latest instruction planning;
  • the background thread is used for file reading and writing and time-consuming calculation.
  • the tasks in each thread are stored in the memory in the form of a task list.
  • Each generated task includes a specific clock signal, and the tasks are arranged in the order of the clock sequence.
  • each thread calls a task in the task list, Called sequentially in clock order.
  • the calling logic executed by each thread includes:
  • the main thread creates a background cache thread and adds the task corresponding to the modification variable instruction to the background task list, and creates a preprocessing thread, and sends the data packet corresponding to the modification variable instruction to the preprocessing thread;
  • the preprocessing thread After the preprocessing thread obtains the data packet sent by the main thread, it performs instruction parsing, and creates a real-time thread task for obtaining the robot end position;
  • the real-time thread reads the robot hardware parameters according to the task created by the preprocessing thread, calculates the real-time platform position parameters, and creates a preprocessing thread to plan the next location update;
  • the background thread does the necessary file reading.
  • the calling logic executed by each thread includes:
  • the real-time thread reads the robot hardware parameters, calculates the real-time platform position parameters, and creates a preprocessing thread to process the trajectory points; on the other hand, reads the robot terminal torque sensor parameters, and converts the torque parameters into control signal, and send the control signal to the driver;
  • the preprocessing thread obtains the robot position list sent by the real-time thread, performs path planning and instruction analysis, and serializes the position parameters into a visual program format, and creates a main thread task and updates the HMI interface instruction in real time; the other On the one hand, obtain the real-time position of the robot sent by the real-time thread, create a real-time process, and update the HMI simulation display;
  • the main thread obtains the data packet of the visual program format sent by the preprocessing thread, and sends update display information to the HMI; on the other hand, creates a background process to make it store the program operation log information in the file;
  • the background process does the necessary file reading.
  • the calling logic executed by each thread includes:
  • the preprocessing thread obtains the list of running programs of the robot, performs serialization analysis to obtain a data packet in a visual text format, and sends the data packet to the main thread task; on the other hand, obtains the real-time position of the robot sent by the real-time thread, Calculate the position parameters of the robot's next arrival, and create a real-time thread task to perform this operation;
  • the real-time thread reads the robot hardware parameters, calculates the position parameters of the real-time moving platform, and creates a preprocessing thread to carry out the next position update planning; Convert it into a control signal and send the control signal to the driver;
  • the main thread obtains the data packet in the visual text format sent by the preprocessing thread, and sends update display information to the HMI; on the other hand, creates a background thread, and stores the program operation log information in a file;
  • the background process does the necessary file reading.
  • all tasks are concentrated in the four threads of the hierarchical main thread, real-time thread, preprocessing thread and background thread, and tasks of different priorities are placed in threads of different levels Among them, the priority is to ensure the motion logic, followed by motion planning, communication and interface interaction, and finally file reading and time-consuming calculations, and make various operations strictly run in their own threads, and, through each thread Provide a thread-safe queue for data interaction, as well as a thread clock call and mutual push task mechanism, so as to realize the security of communication calls between threads and the flexibility of data interaction.
  • FIG. 1 is a schematic structural diagram of a multi-threaded controller of a parallel robot provided in an embodiment of the present application;
  • Figure 2 is a schematic diagram of the initialization process of the main thread
  • Fig. 3 is a schematic diagram of the task list pushing process of each thread
  • Fig. 4 is a logical schematic diagram of each thread calling after obtaining the modification variable instruction issued by the HMI;
  • Fig. 5 is a logical schematic diagram of each thread calling when dragging and teaching
  • Fig. 6 is a schematic diagram of logic calling of each thread during operation control.
  • the thread management method of the existing controller has the disadvantages shown in Table 1:
  • the present application provides a multi-thread control allocation and integration solution. The following will be described in detail through examples.
  • FIG. 1 is a schematic structural diagram of a multi-threaded controller of a parallel robot provided by an embodiment of the present application.
  • the multi-thread controller includes: a main thread, a real-time thread, a preprocessing thread and a background thread.
  • the real-time thread communicates with the driver (such as a motor) and the sensor in real time.
  • Real-time threads need to reduce complex calculations as much as possible, so as to ensure that the calculation of each real-time thread cycle will not time out.
  • the large amount of calculation tasks are handed over to the preprocessing thread, and the preprocessing thread sends the calculation results to the real-time thread.
  • Each thread has a clear task type division, and the specific tasks are shown in Table 2.
  • the execution process of the main thread is mainly divided into two parts: initialization and thread calling to realize the control of the motion logic of the parallel robot;
  • the initialization is completed when the program process starts, and is used for the initialization of communication, log, clock and other tools and the reading of robot hardware parameters, including:
  • each thread executes periodically, through a counting method of time intervals that are not affected by system time changes, to ensure that the threads are executed in the cycle;
  • the motion control system is a general control system for parallel robots, which can be adapted according to the actual parameters of the robot. Therefore, when the program process is started, the robot parameters must be configured first to facilitate subsequent calculations.
  • Thread calls specifically include:
  • Control communication that is, control the periodic execution of HMI communication and TCP control communication, to ensure the real-time and stability of the system.
  • the real-time thread needs to ensure strict real-time performance, so as to make the movement of the manipulator more stable.
  • the real-time thread is the thread with the highest priority. It needs to strictly guarantee the time of each entry, and at the beginning of each cycle, the calculation result of the previous cycle is written to the hardware (that is, sent to the driver, such as a motor), and the sensor, etc. Feedback data is read into the control system, that is, to realize communication and interface interaction with hardware devices, as follows:
  • the robot hardware pose parameters can be calculated according to the position to be reached by the command, and the hardware sends control signals; it can also be based on the real-time pose Parameters send data packets to the preprocessing thread to generate instructions;
  • the preprocessing thread is responsible for the analysis of HMI variable instructions and the instruction planning of the robot running program, that is, the realization of motion planning. Specifically include:
  • Variable instruction analysis that is, receiving the HMI variable instruction modification data packet sent by the main thread, deserializing it into an executable program through the parser, and creating a real-time thread to execute;
  • Robot motion planning that is, obtaining real-time thread pose parameters, performing path planning, and serializing instructions into visual instruction variables, which are sent to the main thread in the form of data packets;
  • Motion planning in the preprocessing thread is a very complicated process, including path planning, speed planning, workspace, coordinate system conversion, etc. This embodiment only introduces the logic part of instruction calling, and the specific execution details are not described in detail.
  • the background thread performs operations that need to wait, mainly performing file reading and writing, time-consuming calculations, and system operation tasks.
  • the background thread has the lowest priority to prevent interference with other threads and ensure time-efficient calculations are prioritized. Specifically include:
  • File reading and writing that is, the main thread creates a background access process when receiving HMI variable instructions to modify, and can be interrupted by other threads at any time during the execution process.
  • Time-consuming calculation that is, when the program requires large-capacity calculation, it is placed in the background calculation to improve the real-time performance of the controller and avoid affecting system performance.
  • a thread-safe queue is a program-level queue, and data can only be written from one thread, so as to ensure that abnormal data and wrong data will not be read when read from other threads.
  • the program When the program is used, it needs to add the prepared data structure to the end of the queue, and when it is used, the earliest stored structure is popped from the queue.
  • the program provides calls for data interaction between all threads by encapsulating these two interfaces.
  • the data manages memory in the form of smart pointers to avoid waste of system resources.
  • a thread security queue mechanism is required to ensure the stable execution of the program.
  • the tasks in each thread are stored in the memory in the form of a task list.
  • Each generated task contains a specific clock signal, and the tasks are arranged in the order of the clock sequence. Therefore, pushing to each task list not only supports FIFO rules but also supports insert.
  • pushing to each task list not only supports FIFO rules but also supports insert.
  • each thread invokes the tasks in the task list, they are invoked successively in clock order. The thread invokes system resources during the execution cycle, and releases the system resources after the execution or the cycle is completed, so as to avoid idleness of the system resources, as shown in Figure 3.
  • each thread has a clear division of task types, but in actual applications, each thread does not need to execute all executable commands once, but only needs to have a clear execution step and return to the next The execution command of the thread.
  • one real-time thread may only calculate the real-time position of the robot's moving platform and send it to the pre-processing thread, which continues to respond to the command; another real-time thread may obtain robot hardware parameters and send it to the pre-processing thread.
  • Processing threads used for calculations such as robot motion planning.
  • the calling logic executed by the above-mentioned threads is illustrated through the following examples.
  • the main thread creates a background cache thread and adds the task corresponding to the variable modification instruction to the background task list, and creates a preprocessing thread, and sends the data packet corresponding to the variable modification instruction to the preprocessing thread;
  • the preprocessing thread After the preprocessing thread obtains the data packet sent by the main thread, it performs instruction analysis and creates a real-time thread task to obtain the end position of the robot;
  • the real-time thread reads the robot hardware parameters according to the task created by the preprocessing thread, calculates the real-time platform position parameters, and creates a preprocessing thread for next time location update planning;
  • a background thread does the necessary file reading.
  • the real-time thread reads the hardware parameters of the robot, calculates the real-time platform position parameters, and creates a preprocessing thread to process the trajectory points; on the other hand, reads the torque sensor parameters at the end of the robot, and converts the torque parameters into control signals , and send the control signal to the driver;
  • the preprocessing thread obtains the robot position list sent by the real-time thread, performs path planning and instruction parsing, serializes the position parameters into a visual program format, and creates main thread tasks and updates HMI interface instructions in real time; on the other hand, Obtain the real-time position of the robot sent by the real-time thread, create a real-time process, and update the HMI simulation display;
  • the main thread obtains the data packet in the format of the visualization program sent by the preprocessing thread, and sends updated display information to the HMI; on the other hand, creates a background process to store the program running log information in a file;
  • a background process does the necessary file reading.
  • 3Running control that is, the controller controls the robot to run according to the instructions.
  • the main calling logic of each thread can refer to Figure 6, which mainly includes:
  • the preprocessing thread obtains the robot running program list, performs serialization analysis to obtain the data packet in the visual text format, and sends the data packet to the main thread task; on the other hand, obtains the real-time position of the robot sent by the real-time thread, and calculates the robot The position parameter of the next arrival, and create a real-time thread task to perform this operation;
  • the real-time thread reads the hardware parameters of the robot, calculates the position parameters of the real-time moving platform, and creates a preprocessing thread to plan the next position update; on the other hand, obtains the position parameters updated by the preprocessing thread, and converts the position parameters into control signal, and send the control signal to the driver;
  • the main thread obtains the data packet in the visual text format sent by the preprocessing thread, and sends updated display information to the HMI; on the other hand, creates a background thread to store the program running log information in a file;
  • a background process does the necessary file reading.
  • each part of the present application may be realized by hardware, software, firmware or a combination thereof.
  • various steps or methods may be implemented by software or firmware stored in memory and executed by a suitable instruction execution system.
  • a suitable instruction execution system For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques known in the art: Discrete logic circuits, ASICs with suitable combinational logic gates, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
  • each functional unit in each embodiment of the present application may be integrated into one processing module, each unit may exist separately physically, or two or more units may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules. If the integrated modules are implemented in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium.
  • the storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, and the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Robotics (AREA)
  • Mechanical Engineering (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Orthopedic Medicine & Surgery (AREA)
  • Numerical Control (AREA)
  • Programmable Controllers (AREA)

Abstract

一种并联机器人的多线程控制器。其中,将所有任务集中在分层次的主线程、实时线程、预处理线程和后台线程这四个线程中,并将不同优先级的任务放在不同级别的线程中,优先保证运动逻辑,其次是运动规划,再次是通讯与界面交互,最后是文件读取和耗时计算,并使各种运算严格的在各自线程中运行,以及,通过在各个线程之间提供进行数据交互的线程安全队列,以及线程时钟调用和相互推送任务机制,从而实现线程之间的通讯调用的安全性与数据交互的灵活性。

Description

并联机器人的多线程控制器 技术领域
本申请涉及机器人技术领域,尤其涉及一种并联机器人的多线程控制器。
背景技术
机器人运动控制是一个相对复杂的过程,机器人的控制对实时性要求较高,需要保证控制器与硬件的通讯的时效性,而同时,机器人运动规划的过程中又需要读写文件、通讯、数学计算等一些耗时操作,这些操作既需要提供运动必要的数据,又不能影响与硬件的通讯的实时性,所以就有了区分线程的必要。
但是对于多线程程序,线程之间的配合和交互一直是程序的难点,比如现有方案针对多线程之间的数据交换和任务推送的处理不够灵活,导致整体控制流程实时性和安全性不够。
发明内容
本申请提供一种并联机器人的多线程控制器,以解决现有的多线程控制方案的实时性和安全性不够的问题。
本申请的上述目的是通过以下技术方案实现的:
本申请实施例提供一种并联机器人的多线程控制器,其包括:主线程、实时线程、预处理线程和后台线程;其中,所述主线程、实时线程、预处理线程和后台线程之间存在互相调度,通过创建线程任务、存放数据到缓冲区列表被其他进程调用的方式,以线程的安全队列方式来保障线程正常的调用及执行;
所述主线程用于进行初始化和线程调用,以实现并联机器人的运动逻辑的控制;其中,所述初始化包括:初始化硬件通信、初始化日志管理工具、初始化报警管理工具、初始化自定义的TCP通信协议、初始化时钟和初始化机器人参数;所述线程调用包括:接收修改变量指令、接收执行指令、进行异步操作和控制通信;
所述实时线程用于实现与硬件设备的通讯和界面交互,其中包括:获取机器人硬件参数、计算机器人动平台实时位置、向硬件发送控制信号和实时触发I/O设备;
所述预处理线程用于实现运动规划,其中包括:变量指令解析、机器人运动规划和最新指令规划;
所述后台线程用于文件读写和耗时计算。
可选的,各线程中的任务以任务列表的形式存放在内存中,每个生成的任务都包含 一个具体的时钟信号,且任务按时钟的时序顺序排列,各线程调用任务列表的任务时,按时钟顺序先后调用。
可选的,在进行变量修改时,各线程执行的调用逻辑包括:
所述主线程创建后台缓存线程并将修改变量指令对应的任务添加到后台任务列表,以及创建预处理线程,并将修改变量指令对应的数据包发送给预处理线程;
所述预处理线程获取到主线程发送的数据包后,进行指令解析,以及创建获取机器人末端位置的实时线程任务;
所述实时线程根据所述预处理线程创建的任务读取机器人硬件参数,计算实时平台位置参数,以及创建预处理线程,以进行下次位置更新规划;
所述后台线程进行必要的文件读取。
可选的,在进行拖动示教时,各线程执行的调用逻辑包括:
所述实时线程,一方面,读取机器人硬件参数,计算实时平台位置参数,以及创建预处理线程以对轨迹点进行路径处理;另一方面,读取机器人末端力矩传感器参数,将力矩参数转化为控制信号,并将控制信号发送到驱动器;
所述预处理线程,一方面,获取实时线程发送的机器人位置列表,进行路径规划和指令解析,并将位置参数序列化为可视化程序格式,以及创建主线程任务和实时更新HMI界面指令;另一方面,获取实时线程发送的机器人实时位置,并创建实时进程,更新HMI仿真显示;
所述主线程,一方面,获取预处理线程发送的可视化程序格式的数据包,并向HMI发送更新显示信息;另一方面,创建后台进程,使其将程序运行日志信息存储到文件中;
所述后台进程进行必要的文件读取。
可选的,在进行机器人运行控制时,各线程执行的调用逻辑包括:
所述预处理线程,一方面,获取机器人运行程序列表,进行序列化解析得到可视化文本格式的数据包,并将数据包发送给主线程任务;另一方面,获取实时线程发送的机器人实时位置,计算机器人下一次到达的位置参数,以及创建实时线程任务执行此次操作;
所述实时线程,一方面,读取机器人硬件参数,计算实时动平台的位置参数,以及创建预处理线程进行下次位置更新规划;另一方面,获取预处理线程更新的位置参数,将位置参数转化为控制信号,并将控制信号发送到驱动器;
所述主线程,一方面,获取预处理线程发送的可视化文本格式的数据包,向HMI发送更新显示信息;另一方面,创建后台线程,将程序运行日志信息存储到文件中;
所述后台进程进行必要的文件读取。
本申请的实施例提供的技术方案可以包括以下有益效果:
本申请的实施例提供的技术方案中,将所有任务集中在分层次的主线程、实时线程、预处理线程和后台线程这四个线程中,并将不同优先级的任务放在不同级别的线程中,优先保证运动逻辑,其次是运动规划,再次是通讯与界面交互,最后是文件读取和耗时计算,并使各种运算严格的在各自线程中运行,以及,通过在各个线程之间提供进行数据交互的线程安全队列,以及线程时钟调用和相互推送任务机制,从而实现线程之间的通讯调用的安全性与数据交互的灵活性。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。
图1为本申请实施例提供的一种并联机器人的多线程控制器的结构示意图;
图2为主线程的初始化流程示意图;
图3为各线程的任务列表推送过程示意图;
图4为获取到HMI下发的修改变量指令后的各线程调用逻辑示意图;
图5为拖动示教时各线程调用逻辑示意图;
图6为运行控制时各线程调用逻辑示意图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。
现有的控制器的线程管理方式存在如表1所示的缺点:
表1:
Figure PCTCN2022086273-appb-000001
Figure PCTCN2022086273-appb-000002
为了解决上述问题,本申请提供一种多线程控制的分配、整合方案。以下通过实施例进行详细说明。
实施例
参照图1,图1为本申请实施例提供的一种并联机器人的多线程控制器的结构示意图。如图1所示,该多线程控制器包括:主线程、实时线程、预处理线程和后台线程。其中,实时线程与驱动器(比如电机)和传感器进行实时通讯。实时线程需要尽可能减少复杂的计算,以此来保证每个实时线程周期计算不会超时。为了减轻实时线程的负担,将大计算量任务交由预处理线程,预处理线程将计算结果发送到实时线程。每个线程有明确的任务类型划分,具体任务如表2所示。
结合表2,对各线程的主要任务的详细说明如下:
表2:
Figure PCTCN2022086273-appb-000003
一、主线程
主线程执行过程中主要分为两部分:进行初始化和线程调用,以实现并联机器人的运动逻辑的控制;
其中,初始化是在程序进程启动时完成,用于通信、日志、时钟等工具的初始化及机器人硬件参数的读取,具体包括:
1.初始化硬件通信,初始化基于以太网的开发构架的实时工业现场总线通讯协议EtherCAT,使其获得具有分布时钟特点的抖动小、更精准的时钟,完成基于硬件设备完成数据交互;
2.初始化日志管理工具,使其能够在各个线程被调用时使用该工具,记录线程执行的所有行为,并按照某种规范表达出来,并能够以文本形式存储在文件中;
3.初始化报警管理工具,使其能够在用户交互中检查程序进程的运行时可能出现的异常问题,减少程序崩溃,提高程序稳定性;
4.初始化自定义的TCP通信协议,线程之间的通信、HMI(Human Machine Interface,人机界面)与运动控制系统之间的通信都是通过TCP协议完成的;
5.初始化时钟,每个线程周期性执行,通过一种不随系统时间变化而受影响的时间间隔的计数方式,保障线程在周期执行完毕;
6.初始化机器人参数,运动控制系统是一种并联机器人通用控制系统,能够根据机器人实际参数完成适配,因此在程序进程启动时要先进行机器人参数的配置,便于后续计算。
所有的子线程都在主线程中创建并运行,因此,在主线程中需要将系统的硬件通信协议、日志管理及报警等进行初始化,在注册主线程之后,需要对系统时钟池对象进行初始化,保证各个线程运行时的时钟响应能正常进行。接着初始化TCP通信协议,保证运动控制系统与HMI、运动控制系统与设备之间的通信。每次进行主线程任务响应时,都需初始化机器人参数,保证机器人运动的安全性、稳定性。具体过程如图2所示。
此外,线程调用是创建子线程,并负责管理子线程的调用。在每个子线程完成单例实例相关对象后将控制权还给主线程,子线程周期性的反馈运行状态,并接受主线程的中断调度。线程调用具体包括:
1.接收修改变量指令,也即在HMI修改变量指令时,被主线程中的HMI通信循环侦听,接收HMI数据包,唤醒后台进程进行缓存操作,实时更新HMI界面,创建预处理线程任务,并将数据包发送给预处理线程;
2.接收执行指令,也即接收HMI执行指令的数据包,并将其发送给预处理指令,实时显示指令执行情况;
3.进行异步操作,也即在程序执行的时候同时执行报警、HMI界面更新等异步操作,支持线程之间通信的同时执行程序;
4.控制通信,也即控制HMI通信、TCP控制通信周期性的执行,保障系统的实时性和稳定性。
二、实时线程
实时线程需要保证严格的实时性,这样才能使机械手的运动更稳定。实时线程是优先级最高的线程,需要严格保证每次进入的时间,并在每次循环开始将上一周期的运算结果写入硬件(也即发送到驱动器,比如电机),并将传感器等的反馈数据读入控制系统,也即实现与硬件设备的通讯和界面交互,具体如下:
1.获取机器人硬件参数,也即实时读取机器人关节角度、位置等硬件参数,创建预处理线程,并将数据包发送给预处理线程;
2.计算机器人动平台实时位置,也即根据机器人硬件参数计算机器人末端(动平台)位置,这里可根据指令要到达的位置计算机器人硬件位姿参数,硬件发送控制信号;也可以根据实时位姿参数向预处理线程发送数据包,进行指令的生成;
3.向硬件发送控制信号,也即将接收的预处理线程指令转化成具体的电机(驱动器)控制信号;
4.实时触发I/O设备,也即实时向运动控制系统发送I/O响应信号。对于大于100微秒的任务就需要格外小心,应考虑放到预处理线程或其他线程进行处理。
三、预处理线程
预处理线程负责对HMI变量指令的解析与机器人运行程序做指令规划,也即实现运动规划。具体包括:
1.变量指令解析,也即接收主线程发送的HMI变量指令修改数据包,通过解析器反序列化成可执行程序,并创建实时线程去执行;
2.机器人运动规划,也即获取实时线程位姿参数,进行路径规划,并进行指令序列化成可视化指令变量,以数据包形式发送给主线程;
3.最新指令规划,也即规划指令的先后顺序。
预处理线程中关于运动规划是个非常复杂的过程,包括路径规划、速度规划、工作空间、坐标系转换等,本实施例只介绍关于指令调用的逻辑部分,具体执行细节不进行详述。
四、后台线程
后台线程执行需要等待的操作,主要执行文件的读写、耗时计算及系统操作任务,后台线程优先级最低,防止对其他线程产生干扰,保证时效性高的计算优先进行。具体包括:
1.文件读写,也即主线程接收HMI变量指令修改时创建后台存取进程,在执行过程中可随时被其他线程中断。
2.耗时计算,也即当程序需要大容量计算时,放在后台计算,提高控制器实时性,避免影响系统性能。
此外,实际应用中,主线程、实时线程、预处理线程和后台线程之间存在互相调度,通过创建线程任务、存放数据到缓冲区列表被其他进程调用的方式,以线程的安全队列方式来保障线程正常的调用及执行。线程安全队列是一个程序层面上的队列,数据只能从一 个线程写入,从而确保从其他线程读出时,不会读取到异常数据和错误数据。程序使用时需要将准备好的数据结构体添加到队列末端,使用时则从队列中弹出最早存入的结构。程序通过封装这两个接口提供给所有线程间数据交互的调用。这里的数据通过智能指针的形式管理内存,避免出现系统资源的浪费。通过线程安全队列,一个线程可以将所需数据添加到队列,安全的交给另一个线程做后续处理。
在保证时钟准确的前提下,需要线程的安全队列机制来保障程序的稳定执行。各线程中的任务以任务列表的形式存放在内存中,每个生成的任务都包含一个具体的时钟信号,且任务按时钟的时序顺序排列,因此推送到各任务列表除支持FIFO规则外还支持插入。各线程调用任务列表的任务时,按时钟顺序先后调用。线程在执行周期内调用系统资源,执行完毕或周期完毕则释放系统资源,避免系统资源的闲置,具体如图3所示。
此外,如上述实施例所述,每个线程都有明确的任务类型划分,但实际应用中每个线程不需要将所有能执行命令执行一遍,只需要有一个明确的执行步骤,并返回下一个线程的执行命令。例如,一个实时线程可能只计算机器人动平台实时位置,并将其发送给预处理线程,由预处理线程继续响应行该命令;另一个实时线程可以是获取机器人硬件参数,并将其发送给预处理线程,用于机器人运动规划等计算。为了更好地理解,通过以下几个示例对上述各线程执行的调用逻辑进行举例说明。
①修改变量,也即用户通过HMI下发修改变量指令,进行变量修改。其中各线程的主要调用逻辑可参照图4,主要包括:
主线程创建后台缓存线程并将修改变量指令对应的任务添加到后台任务列表,以及创建预处理线程,并将修改变量指令对应的数据包发送给预处理线程;
预处理线程获取到主线程发送的数据包后,进行指令解析,以及创建获取机器人末端位置的实时线程任务;
实时线程根据所述预处理线程创建的任务读取机器人硬件参数,计算实时平台位置参数,以及创建预处理线程,以进行下次位置更新规划;
后台线程进行必要的文件读取。
②拖动示教,也即操作员直接拖着机器人各关节运动到理想的姿态,并由机器人记录下来的过程。其中各线程的主要调用逻辑可参照图5,主要包括:
实时线程,一方面,读取机器人硬件参数,计算实时平台位置参数,以及创建预处理线程以对轨迹点进行路径处理;另一方面,读取机器人末端力矩传感器参数,将力矩参数转化为控制信号,并将控制信号发送到驱动器;
预处理线程,一方面,获取实时线程发送的机器人位置列表,进行路径规划和指令解析,并将位置参数序列化为可视化程序格式,以及创建主线程任务和实时更新HMI界面指令;另一方面,获取实时线程发送的机器人实时位置,并创建实时进程,更新HMI仿真显示;
主线程,一方面,获取预处理线程发送的可视化程序格式的数据包,并向HMI发送更新显示信息;另一方面,创建后台进程,使其将程序运行日志信息存储到文件中;
后台进程进行必要的文件读取。
③运行控制,也即控制器控制机器人按照指令运行。其中各线程的主要调用逻辑可参照图6,主要包括:
预处理线程,一方面,获取机器人运行程序列表,进行序列化解析得到可视化文本格式的数据包,并将数据包发送给主线程任务;另一方面,获取实时线程发送的机器人实时位置,计算机器人下一次到达的位置参数,以及创建实时线程任务执行此次操作;
实时线程,一方面,读取机器人硬件参数,计算实时动平台的位置参数,以及创建预处理线程进行下次位置更新规划;另一方面,获取预处理线程更新的位置参数,将位置参数转化为控制信号,并将控制信号发送到驱动器;
主线程,一方面,获取预处理线程发送的可视化文本格式的数据包,向HMI发送更新显示信息;另一方面,创建后台线程,将程序运行日志信息存储到文件中;
后台进程进行必要的文件读取。
基于上述各实施例,本申请的方案中,将所有任务集中在分层次的主线程、实时线程、预处理线程和后台线程这四个线程中,并将不同优先级的任务放在不同级别的线程中,优先保证运动逻辑,其次是运动规划,再次是通讯与界面交互,最后是文件读取和耗时计算,并使各种运算严格的在各自线程中运行,以及,通过在各个线程之间提供进行数据交互的线程安全队列,以及线程时钟调用和相互推送任务机制,从而实现线程之间的通讯调用的安全性与数据交互的灵活性。
可以理解的是,上述各实施例中相同或相似部分可以相互参考,在一些实施例中未详细说明的内容可以参见其他实施例中相同或相似的内容。
需要说明的是,在本申请的描述中,术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性。此外,在本申请的描述中,除非另有说明,“多个”的含义是指至少两个。
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分, 并且本申请的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本申请的实施例所属技术领域的技术人员所理解。
应当理解,本申请的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。
本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。
此外,在本申请各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。
上述提到的存储介质可以是只读存储器,磁盘或光盘等。
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本申请的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。
尽管上面已经示出和描述了本申请的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本申请的限制,本领域的普通技术人员在本申请的范围内可以对上述实施例进行变化、修改、替换和变型。

Claims (5)

  1. 一种并联机器人的多线程控制器,其特征在于,包括:主线程、实时线程、预处理线程和后台线程;其中,所述主线程、实时线程、预处理线程和后台线程之间存在互相调度,通过创建线程任务、存放数据到缓冲区列表被其他进程调用的方式,以线程的安全队列方式来保障线程正常的调用及执行;
    所述主线程用于进行初始化和线程调用,以实现并联机器人的运动逻辑的控制;其中,所述初始化包括:初始化硬件通信、初始化日志管理工具、初始化报警管理工具、初始化自定义的TCP通信协议、初始化时钟和初始化机器人参数;所述线程调用包括:接收修改变量指令、接收执行指令、进行异步操作和控制通信;
    所述实时线程用于实现与硬件设备的通讯和界面交互,其中包括:获取机器人硬件参数、计算机器人动平台实时位置、向硬件发送控制信号和实时触发I/O设备;
    所述预处理线程用于实现运动规划,其中包括:变量指令解析、机器人运动规划和最新指令规划;
    所述后台线程用于文件读写和耗时计算。
  2. 根据权利要求1所述的并联机器人的多线程控制器,其特征在于,各线程中的任务以任务列表的形式存放在内存中,每个生成的任务都包含一个具体的时钟信号,且任务按时钟的时序顺序排列,各线程调用任务列表的任务时,按时钟顺序先后调用。
  3. 根据权利要求2所述的并联机器人的多线程控制器,其特征在于,在进行变量修改时,各线程执行的调用逻辑包括:
    所述主线程创建后台缓存线程并将修改变量指令对应的任务添加到后台任务列表,以及创建预处理线程,并将修改变量指令对应的数据包发送给预处理线程;
    所述预处理线程获取到主线程发送的数据包后,进行指令解析,以及创建获取机器人末端位置的实时线程任务;
    所述实时线程根据所述预处理线程创建的任务读取机器人硬件参数,计算实时平台位置参数,以及创建预处理线程,以进行下次位置更新规划;
    所述后台线程进行必要的文件读取。
  4. 根据权利要求2所述的并联机器人的多线程控制器,其特征在于,在进行拖动示教时,各线程执行的调用逻辑包括:
    所述实时线程,一方面,读取机器人硬件参数,计算实时平台位置参数,以及创建预处理线程以对轨迹点进行路径处理;另一方面,读取机器人末端力矩传感器参数,将力矩参数转化为控制信号,并将控制信号发送到驱动器;
    所述预处理线程,一方面,获取实时线程发送的机器人位置列表,进行路径规划和指令解析,并将位置参数序列化为可视化程序格式,以及创建主线程任务和实时更新HMI界面指令;另一方面,获取实时线程发送的机器人实时位置,并创建实时进程,更新HMI仿真显示;
    所述主线程,一方面,获取预处理线程发送的可视化程序格式的数据包,并向HMI发送更新显示信息;另一方面,创建后台进程,使其将程序运行日志信息存储到文件中;
    所述后台进程进行必要的文件读取。
  5. 根据权利要求2所述的并联机器人的多线程控制器,其特征在于,在进行机器人运行控制时,各线程执行的调用逻辑包括:
    所述预处理线程,一方面,获取机器人运行程序列表,进行序列化解析得到可视化文本格式的数据包,并将数据包发送给主线程任务;另一方面,获取实时线程发送的机器人实时位置,计算机器人下一次到达的位置参数,以及创建实时线程任务执行此次操作;
    所述实时线程,一方面,读取机器人硬件参数,计算实时动平台的位置参数,以及创建预处理线程进行下次位置更新规划;另一方面,获取预处理线程更新的位置参数,将位置参数转化为控制信号,并将控制信号发送到驱动器;
    所述主线程,一方面,获取预处理线程发送的可视化文本格式的数据包,向HMI发送更新显示信息;另一方面,创建后台线程,将程序运行日志信息存储到文件中;
    所述后台进程进行必要的文件读取。
PCT/CN2022/086273 2021-12-23 2022-04-12 并联机器人的多线程控制器 WO2023115758A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2022578871A JP2024503168A (ja) 2021-12-23 2022-04-12 パラレルロボットのマルチスレッドコントローラ
US18/012,961 US20240100697A1 (en) 2021-12-23 2022-04-12 Multi-Thread Controller for Parallel Robot

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111584313.2 2021-12-23
CN202111584313.2A CN113954104B (zh) 2021-12-23 2021-12-23 并联机器人的多线程控制器

Publications (1)

Publication Number Publication Date
WO2023115758A1 true WO2023115758A1 (zh) 2023-06-29

Family

ID=79473669

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/086273 WO2023115758A1 (zh) 2021-12-23 2022-04-12 并联机器人的多线程控制器

Country Status (4)

Country Link
US (1) US20240100697A1 (zh)
JP (1) JP2024503168A (zh)
CN (1) CN113954104B (zh)
WO (1) WO2023115758A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113954104B (zh) * 2021-12-23 2022-04-01 辰星(天津)自动化设备有限公司 并联机器人的多线程控制器
CN114722050B (zh) * 2022-06-10 2022-09-30 辰星(天津)自动化设备有限公司 机器人系统的数据同步方法、及机器人系统
CN115866035A (zh) * 2022-11-30 2023-03-28 广东舜势测控设备有限公司 多线程数据高速推送方法、系统、控制器及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101853006A (zh) * 2010-04-17 2010-10-06 上海交通大学 多智能体协同控制系统
WO2012163245A1 (zh) * 2011-05-27 2012-12-06 运软网络科技(上海)有限公司 一种基于事务的服务控制系统及其控制方法
CN107942753A (zh) * 2017-12-07 2018-04-20 惠州市德赛西威汽车电子股份有限公司 机器人与终端设备的软件的通讯框架和通讯方法
CN109454641A (zh) * 2018-12-25 2019-03-12 哈工大机器人(合肥)国际创新研究院 一种运动控制器多任务分工及数据交互方法
CN110569121A (zh) * 2019-09-12 2019-12-13 华润万家有限公司 基于应用机器人的多线程并发处理方法和装置
EP3677984A1 (en) * 2019-01-07 2020-07-08 ADVA Optical Networking SE Method of time delivery in a computing system and system thereof
CN113954104A (zh) * 2021-12-23 2022-01-21 辰星(天津)自动化设备有限公司 并联机器人的多线程控制器

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3671694B2 (ja) * 1998-09-18 2005-07-13 株式会社デンソー ロボットのティーチング方法およびその装置
CN107901039B (zh) * 2017-11-13 2020-11-13 浙江工业大学 基于Python的桌面级机器人离线编程仿真系统
CN111124621A (zh) * 2019-11-21 2020-05-08 南京桐润新能源有限公司 一种基于多线程定时器读取can数据方法及系统
CN111309453A (zh) * 2020-02-13 2020-06-19 佛山智能装备技术研究院 分布式部署的智能机器人系统

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101853006A (zh) * 2010-04-17 2010-10-06 上海交通大学 多智能体协同控制系统
WO2012163245A1 (zh) * 2011-05-27 2012-12-06 运软网络科技(上海)有限公司 一种基于事务的服务控制系统及其控制方法
CN107942753A (zh) * 2017-12-07 2018-04-20 惠州市德赛西威汽车电子股份有限公司 机器人与终端设备的软件的通讯框架和通讯方法
CN109454641A (zh) * 2018-12-25 2019-03-12 哈工大机器人(合肥)国际创新研究院 一种运动控制器多任务分工及数据交互方法
EP3677984A1 (en) * 2019-01-07 2020-07-08 ADVA Optical Networking SE Method of time delivery in a computing system and system thereof
CN110569121A (zh) * 2019-09-12 2019-12-13 华润万家有限公司 基于应用机器人的多线程并发处理方法和装置
CN113954104A (zh) * 2021-12-23 2022-01-21 辰星(天津)自动化设备有限公司 并联机器人的多线程控制器

Also Published As

Publication number Publication date
CN113954104B (zh) 2022-04-01
JP2024503168A (ja) 2024-01-25
CN113954104A (zh) 2022-01-21
US20240100697A1 (en) 2024-03-28

Similar Documents

Publication Publication Date Title
WO2023115758A1 (zh) 并联机器人的多线程控制器
US20070168082A1 (en) Task-based robot control system for multi-tasking
US9501324B2 (en) Computer system and control apparatus comprising an industrial robot and method for controlling motion of an industrial robot
Schoepfer et al. Open source real-time control software for the kuka light weight robot
Saksena et al. Guidelines for automated implementation of executable object oriented models for real-time embedded control systems
CN104750554B (zh) 一种虚拟机间数据迁移的方法和设备
EP3582036B1 (en) Control device
CN110058592A (zh) 一种移动机器人控制方法
WO2018192178A1 (zh) 机器人点到点运动控制方法和系统
CN107430787A (zh) 在共享着色器核心上提供异步显示着色器功能
CN116197919B (zh) 机器人控制系统及控制方法
Wu et al. The design and experimental research of an open architecture soft-CNC system based on RTX and an IPC
Roda-Sanchez et al. Gesture control wearables for human-machine interaction in Industry 4.0
WO2023071643A1 (zh) 用于处理任务的方法、装置、电子设备和介质
WO2023178723A1 (zh) 基于模型开发的仿真控制平台及上料交接测试方法
CN115502975A (zh) 一种机器人调度方法、装置、电子设备及存储介质
Mineo et al. Interfacing toolbox for robotic arms with real-time adaptive behavior capabilities
WO2022199000A1 (zh) 一种控制方法、控制系统及智能设备
US20220397880A1 (en) Control device
Yu et al. Design of controller system for industrial robot based on RTOS Xenomai
CN111844021B (zh) 机械臂协同控制方法、装置、设备及存储介质
Xi et al. Design of a real-time robot control system oriented for human-robot cooperation
Li et al. Multi-tasking syetem design for multi-axis synchronous control of robot based on RTOS
Partap et al. On-device cpu scheduling for sense-react systems
WO2018192177A1 (zh) 基于ros和orocos的机器人控制方法和系统

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 2022578871

Country of ref document: JP

WWE Wipo information: entry into national phase

Ref document number: 18012961

Country of ref document: US

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22909095

Country of ref document: EP

Kind code of ref document: A1