CN110433467A - Picking up table tennis ball robot operation method and equipment based on binocular vision and ant group algorithm - Google Patents

Picking up table tennis ball robot operation method and equipment based on binocular vision and ant group algorithm Download PDF

Info

Publication number
CN110433467A
CN110433467A CN201910744905.2A CN201910744905A CN110433467A CN 110433467 A CN110433467 A CN 110433467A CN 201910744905 A CN201910744905 A CN 201910744905A CN 110433467 A CN110433467 A CN 110433467A
Authority
CN
China
Prior art keywords
table tennis
coordinate system
coordinate
robot
camera
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
CN201910744905.2A
Other languages
Chinese (zh)
Other versions
CN110433467B (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.)
Nanjing Post and Telecommunication University
Original Assignee
Nanjing Post and Telecommunication University
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 Nanjing Post and Telecommunication University filed Critical Nanjing Post and Telecommunication University
Priority to CN201910744905.2A priority Critical patent/CN110433467B/en
Publication of CN110433467A publication Critical patent/CN110433467A/en
Application granted granted Critical
Publication of CN110433467B publication Critical patent/CN110433467B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63BAPPARATUS FOR PHYSICAL TRAINING, GYMNASTICS, SWIMMING, CLIMBING, OR FENCING; BALL GAMES; TRAINING EQUIPMENT
    • A63B47/00Devices for handling or treating balls, e.g. for holding or carrying balls
    • A63B47/02Devices for handling or treating balls, e.g. for holding or carrying balls for picking-up or collecting
    • A63B47/021Devices for handling or treating balls, e.g. for holding or carrying balls for picking-up or collecting for picking-up automatically, e.g. by apparatus moving over the playing surface
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63BAPPARATUS FOR PHYSICAL TRAINING, GYMNASTICS, SWIMMING, CLIMBING, OR FENCING; BALL GAMES; TRAINING EQUIPMENT
    • A63B67/00Sporting games or accessories therefor, not provided for in groups A63B1/00 - A63B65/00
    • A63B67/04Table games physically beneficial for the human body, modelled on outdoor sports, e.g. table tennis

Landscapes

  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Physical Education & Sports Medicine (AREA)
  • Image Processing (AREA)
  • Control Of Position, Course, Altitude, Or Attitude Of Moving Bodies (AREA)

Abstract

本发明公开了一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法及设备,方法包括:获取双目摄像机拍摄的RGB图像,从RGB图像中检测出乒乓球并获得各乒乓球的坐标位置;获取双目摄像机的深度数据,得到各乒乓球距离摄像机的距离;计算得到在全局坐标系下乒乓球的坐标点集;对坐标点集使用蚁群算法进行最短遍历路径规划,得到初步的捡球路径;从初步的捡球路径去除多次经过的乒乓球,得到没有冗余路线的路径。本发明使用双目摄像机同时实现了乒乓球的检测和定位,方便高效,同时保证了精度,使得捡球过程更加智能化;对蚁群算法规划出的路径进行冗余路线优化,进一步减少了机器人的行走路径,节约了时间。

The invention discloses a method and equipment for picking up table tennis robots based on binocular vision and an ant colony algorithm. Coordinate position; obtain the depth data of the binocular camera, and obtain the distance between each table tennis ball and the camera; calculate the coordinate point set of the table tennis ball in the global coordinate system; use the ant colony algorithm to plan the shortest traversal path for the coordinate point set, and obtain a preliminary The ball-picking path; remove the ping-pong balls that have passed through many times from the preliminary ball-picking path to obtain a path without redundant routes. The invention uses a binocular camera to realize the detection and positioning of the table tennis ball at the same time, which is convenient and efficient, and at the same time ensures the accuracy, making the ball picking process more intelligent; the redundant route optimization is carried out on the path planned by the ant colony algorithm, which further reduces the number of robots. The walking path saves time.

Description

基于双目视觉和蚁群算法的捡乒乓球机器人运行方法及设备Operation method and equipment for table tennis picking robot based on binocular vision and ant colony algorithm

技术领域technical field

本发明涉及机器人技术领域,具体涉及一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法及设备。The invention relates to the technical field of robots, in particular to an operating method and equipment for a table tennis picking robot based on binocular vision and an ant colony algorithm.

背景技术Background technique

随着人工智能技术以及我国社会经济的发展,服务型机器人逐渐走进大众的家庭。乒乓球作为国球,深受人民群众的喜爱。但是随之而来的大量的捡球工作却让人很烦恼,目前乒乓球俱乐部中有专人负责捡球,人力成本较高。而市面上没有一款可以普及的捡乒乓球机器人,仅有的研究也偏重于学术研究,实际的工程应用很少,且大都只有零散的方法。With the development of artificial intelligence technology and my country's social economy, service robots have gradually entered the homes of the public. As a national game, table tennis is very popular among the people. However, the subsequent work of picking up balls is very troublesome. At present, there is a special person in the table tennis club to be responsible for picking up the balls, and the labor cost is relatively high. And there is not a table tennis robot that can be popularized on the market, and the only research is also focused on academic research, and the actual engineering applications are seldom, and most of them only have scattered methods.

现有的检测和定位技术复杂繁琐,利用普通的RGB摄像头很难完成对乒乓球的定位任务,因此大多数捡球机器人无法对球进行定位,因而无法实现对所有球的全局遍历路径规划,导航方法很低效。The existing detection and positioning technology is complex and cumbersome. It is difficult to use ordinary RGB cameras to complete the positioning task of table tennis. Therefore, most ball-picking robots cannot locate the ball, so it is impossible to realize the global traversal path planning and navigation of all balls. The method is very inefficient.

蚁群算法是一种仿生学算法,主要用于TSP问题,它可在很短时间内求得一个接近最优的解。但是它实际应用在捡球机器人上时,受到机器人宽度的限制,需要进行进一步优化。Ant colony algorithm is a bionic algorithm, mainly used for TSP problems, it can find a near optimal solution in a short time. However, when it is actually applied to the ball-picking robot, it is limited by the width of the robot and needs to be further optimized.

发明内容Contents of the invention

本发明的目的在于克服现有技术中的不足,提出了一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法及设备,实现了乒乓球的检测和定位,并对规划出的路径进行冗余路线优化,进一步减少了机器人的行走路径,节约了时间。The purpose of the present invention is to overcome the deficiencies in the prior art, proposes a kind of table tennis picking robot operating method and equipment based on binocular vision and ant colony algorithm, realizes the detection and location of table tennis, and the path that goes out of planning Redundant route optimization is carried out to further reduce the walking path of the robot and save time.

为解决上述技术问题,本发明提供了一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法,其特征是,包括以下过程:For solving the problems of the technologies described above, the invention provides a kind of robot operation method of picking up table tennis based on binocular vision and ant colony algorithm, it is characterized in that, comprises following process:

建立乒乓球训练场地的全局坐标系;Establish the global coordinate system of the table tennis training ground;

获取双目摄像机拍摄的场地中地面乒乓球散落情况的RGB图像,从RGB图像中检测出乒乓球并获得各乒乓球的坐标位置;Obtain the RGB image of the scattered situation of the ground table tennis balls in the venue captured by the binocular camera, detect the table tennis balls from the RGB image and obtain the coordinate positions of each table tennis ball;

获取双目摄像机的深度数据,得到各乒乓球距离摄像机的距离;Obtain the depth data of the binocular camera, and get the distance between each table tennis ball and the camera;

根据各乒乓球的坐标位置和距离摄像机的距离,计算得到在全局坐标系下乒乓球的坐标点集;According to the coordinate position of each table tennis ball and the distance from the camera, calculate the coordinate point set of the table tennis ball under the global coordinate system;

对坐标点集使用蚁群算法进行最短遍历路径规划,得到初步的捡球路径;Use the ant colony algorithm to plan the shortest traversal path for the coordinate point set, and get the preliminary ball picking path;

从初步的捡球路径去除多次经过的乒乓球,得到没有冗余路线的路径。Remove the ping-pong balls that have passed multiple times from the initial ball picking path to obtain a path without redundant paths.

进一步的,从RGB图像中检测出乒乓球并获得各乒乓球的坐标位置的具体过程包括:Further, the specific process of detecting table tennis balls from the RGB image and obtaining the coordinate positions of each table tennis ball includes:

将RGB图像转换为HSV图像;Convert an RGB image to an HSV image;

将HSV图像转成灰度图,进行高斯模糊;Convert the HSV image into a grayscale image for Gaussian blurring;

使用canny算子进行轮廓检测,获得图中所有物体的轮廓;Use the canny operator for contour detection to obtain the contours of all objects in the picture;

使用霍夫圆变换检测图中的圆,即可检测出场地中的乒乓球,并计算得到所有乒乓球在图中的坐标位置。By using Hough circle transformation to detect the circles in the picture, the table tennis balls in the field can be detected, and the coordinate positions of all table tennis balls in the picture can be calculated.

进一步的,根据各乒乓球的坐标位置和距离摄像机的距离计算得到在全局坐标系下乒乓球的坐标点集包括以下过程:Further, according to the coordinate position of each table tennis ball and the distance from the camera, the coordinate point set of the table tennis ball under the global coordinate system includes the following process:

将各乒乓球的坐标位置和距离摄像机的距离,转换到相机三维坐标系下,得到在相机三围坐标系下乒乓球的坐标点集;Convert the coordinate position of each table tennis ball and the distance from the camera to the three-dimensional coordinate system of the camera, and obtain the coordinate point set of the table tennis ball under the three-dimensional coordinate system of the camera;

再将乒乓球在相机三维坐标系下的坐标转换到机器人坐标系下;Then transform the coordinates of the table tennis ball in the camera's three-dimensional coordinate system to the robot coordinate system;

最后将乒乓球在机器人坐标系下的坐标转换到全局坐标系下,得到在全局坐标系下乒乓球的坐标点集。Finally, transform the coordinates of the table tennis ball in the robot coordinate system to the global coordinate system, and obtain the coordinate point set of the table tennis ball in the global coordinate system.

进一步的,将各乒乓球的坐标位置和距离摄像机的距离转换到相机三维坐标系下的过程包括:Further, the process of converting the coordinate positions of each table tennis ball and the distance from the camera to the three-dimensional coordinate system of the camera includes:

建立相机三维坐标系XYZ、图像平面坐标系xy;Establish camera three-dimensional coordinate system XYZ, image plane coordinate system xy;

相机三围坐标系中点P(X,Y,Z)和图像平面坐标系中点p(x,y)两者的映射关系为:The mapping relationship between the point P(X, Y, Z) in the camera’s three-dimensional coordinate system and the point p(x, y) in the image plane coordinate system is:

其中,f为相机焦距,Z为从深度数据中获取的乒乓球的深度,x表示图像平面坐标系的x轴坐标,X表示相机三维坐标系中的X轴坐标;y表示图像平面坐标系中的y轴坐标,Y表示相机三维坐标系中的Y轴坐标;cx为主点在x轴上的坐标,cy为主点在y轴上的坐标,fx为f在x轴上的像素量纲,fy为f在y轴上的像素量纲;Among them, f is the focal length of the camera, Z is the depth of the ping-pong ball obtained from the depth data, x represents the x-axis coordinate of the image plane coordinate system, X represents the X-axis coordinate of the camera's three-dimensional coordinate system; y represents the image plane coordinate system The y-axis coordinate of the camera, Y indicates the Y-axis coordinate in the camera's three-dimensional coordinate system; c x is the coordinate of the main point on the x-axis, c y is the coordinate of the main point on the y-axis, and f x is the coordinate of f on the x-axis Pixel dimension, f y is the pixel dimension of f on the y-axis;

各乒乓球的坐标位置为图像平面坐标系中坐标,距离摄像机的距离为相机坐标系中Z轴数值,根据上述公式计算得到乒乓球在相机坐标系中的三维坐标P(X,Y,Z)。The coordinate position of each table tennis ball is the coordinate in the image plane coordinate system, and the distance from the camera is the Z-axis value in the camera coordinate system. According to the above formula, the three-dimensional coordinates P(X, Y, Z) of the table tennis ball in the camera coordinate system are calculated. .

进一步的,将乒乓球在机器人坐标系下的坐标转换到全局坐标系下的过程为:Further, the process of converting the coordinates of the table tennis ball in the robot coordinate system to the global coordinate system is:

起始时机器人坐标系在全局坐标系的原点,坐标为(x0,y0,th0)=(0,0,0),设机器人移动速度V=(Vx,Vy,Vth),Vx指沿x轴方向的速度,Vy指沿着y轴方向的速度,Vth指机器人旋转速度;则经过dt时间后,机器人坐标系相对于全局坐标原点的坐标为:At the beginning, the robot coordinate system is at the origin of the global coordinate system, the coordinates are (x 0 , y 0 , th 0 )=(0, 0, 0), and the moving speed of the robot is V=(V x , V y , V th ) , V x refers to the speed along the x-axis direction, V y refers to the speed along the y-axis direction, and V th refers to the robot rotation speed; after the dt time, the coordinates of the robot coordinate system relative to the global coordinate origin are:

(x1,y1,th1)=(x0+(Vx*cos(th0)-Vy*sin(th0))*dt,y0+(Vx*sin(th0)+Vy*cos(th0))*dt,th0+Vth*dt) (5)(x 1 , y 1 , th 1 )=(x 0 +(V x *cos(th 0 )-V y *sin(th 0 ))*dt, y 0 +(V x *sin(th 0 )+ V y *cos(th 0 ))*dt, th 0 +V th *dt) (5)

根据公式(5)得到的机器人坐标系的坐标转换关系,可以进行坐标转换,在机器人坐标系下的目标乒乓球坐标(X′,Y′)转换到全局坐标系下的坐标(X″,Y″)为:According to the coordinate conversion relationship of the robot coordinate system obtained by formula (5), coordinate conversion can be carried out, and the target table tennis coordinates (X', Y') under the robot coordinate system are converted to the coordinates (X ", Y) under the global coordinate system ")for:

(X″,Y″)=(x1+(X′*cos(th1)-Y′*sin(th1)),(X″, Y″)=(x 1 +(X′*cos(th 1 )-Y′*sin(th 1 )),

y1+(X′*sin(th1)+Y′*cos(th1)))y 1 +(X′*sin(th 1 )+Y′*cos(th 1 )))

完成所有乒乓球的坐标转换,得到在全局坐标系下乒乓球的坐标点集。Complete the coordinate transformation of all table tennis balls, and obtain the coordinate point set of table tennis balls in the global coordinate system.

进一步的,从初步的捡球路径中去除多次经过的乒乓球,得到没有冗余路线的路径包括以下过程:Further, removing the ping-pong balls that have passed through multiple times from the preliminary ball picking path, and obtaining a path without redundant routes includes the following process:

根据初步的捡球路径,假设机器人移动从出发点移动到第1个目标乒乓球,According to the preliminary ball picking path, assuming that the robot moves from the starting point to the first target table tennis ball,

画出直线b1、b2与d1、d2,b1、b2平行于出发点点和目标乒乓球两点的连线,并且与机器人在出发点的最小外接圆相切;直线d1与两点连线方向垂直并与机器人在出发点的最小外接圆的尾部相切;直线d2与两点连线方向垂直并与机器人在目标点的最小外接圆的头部相切;这四条线构成的矩形表示机器人从出发点到目标点扫过的区域,计算取得在四条线构成的矩形中的所有乒乓球坐标点,将这些点从坐标点集中删去,Draw straight lines b 1 , b 2 and d 1 , d 2 , b 1 , b 2 are parallel to the starting point and the target table tennis point, and are tangent to the minimum circumscribed circle of the robot at the starting point; straight line d 1 and The direction of the line connecting two points is perpendicular to and tangent to the tail of the smallest circumscribed circle of the robot at the starting point; the straight line d 2 is perpendicular to the direction of the line connecting two points and tangent to the head of the smallest circumscribed circle of the robot at the target point; these four lines constitute The rectangle represents the area swept by the robot from the starting point to the target point, calculate and obtain all the table tennis coordinate points in the rectangle formed by four lines, delete these points from the coordinate point set,

然后将此目标点作为起始点,从初步的捡球路径中选取下一个目标点,进行上述同样的操作;以此类推,直到捡球路径上所有的点全部处理完毕,最终得到一条没有冗余路线的路径。Then use this target point as the starting point, select the next target point from the initial ball picking path, and perform the same operation above; The path of the route.

相应的,本发明还提供了一种存储一个或多个程序的计算机可读存储介质,所述一个或多个程序包括指令,所述指令当由计算设备执行时,使得所述计算设备执行上述方法。Correspondingly, the present invention also provides a computer-readable storage medium storing one or more programs, and the one or more programs include instructions, and the instructions, when executed by a computing device, cause the computing device to perform the above-mentioned method.

相应的,本发明还提供了一种计算设备,包括,Correspondingly, the present invention also provides a computing device, including:

一个或多个处理器、存储器以及一个或多个程序,其中一个或多个程序存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序包括用于执行上述方法的指令。one or more processors, memory, and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs include Instructions for performing the methods described above.

与现有技术相比,本发明所达到的有益效果是:本发明使用双目摄像机同时实现了乒乓球的检测和定位,方便高效,同时保证了精度,使得捡球过程更加智能化;对蚁群算法规划出的路径进行冗余路线优化,进一步减少了机器人的行走路径,节约了时间。Compared with the prior art, the beneficial effects achieved by the present invention are: the present invention uses the binocular camera to realize the detection and positioning of the table tennis ball at the same time, which is convenient and efficient, and at the same time ensures the accuracy, making the ball picking process more intelligent; The path planned by the group algorithm is optimized for redundant routes, which further reduces the walking path of the robot and saves time.

附图说明Description of drawings

图1是本发明的方法的流程示意图;Fig. 1 is a schematic flow sheet of the method of the present invention;

图2是乒乓球检测和定位的流程示意图;Fig. 2 is the schematic flow chart of table tennis detection and location;

图3是相机小孔成像模型示意图;Fig. 3 is a schematic diagram of a camera pinhole imaging model;

图4是base_link和map坐标系转换图;Figure 4 is a conversion diagram of the base_link and map coordinate systems;

图5是蚁群算法用于遍历路径规划的流程示意图;Fig. 5 is a schematic flow chart of ant colony algorithm for traversal path planning;

图6是冗余点示意图。Fig. 6 is a schematic diagram of redundant points.

具体实施方式Detailed ways

下面结合附图对本发明作进一步描述。以下实施例仅用于更加清楚地说明本发明的技术方案,而不能以此来限制本发明的保护范围。The present invention will be further described below in conjunction with the accompanying drawings. The following examples are only used to illustrate the technical solution of the present invention more clearly, but not to limit the protection scope of the present invention.

本发明的一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法,参见图1所示,包括以下步骤:A kind of picking table tennis robot operating method based on binocular vision and ant colony algorithm of the present invention, referring to shown in Figure 1, comprises the following steps:

步骤1,获取乒乓球训练场地的地图,建立全局坐标系。Step 1. Obtain the map of the table tennis training venue and establish a global coordinate system.

首先使用激光雷达以及ROS(机器人操作系统)平台下的gmapping建图程序获得乒乓球训练场地的静态地图,然后对地图进行去噪和修饰,得到可用的全局静态栅格地图,机器人根据这个地图来进行导航避障。作为全局坐标系map,此坐标系以矩形训练场地的某个角点作为原点,沿着训练场地的长宽方向分别作为横纵坐标轴。后面检测到的乒乓球将会转换到这个坐标系下显示。First, use the lidar and the gmapping mapping program under the ROS (Robot Operating System) platform to obtain a static map of the table tennis training ground, and then denoise and modify the map to obtain an available global static grid map. Carry out navigation and obstacle avoidance. As a global coordinate system map, this coordinate system takes a corner point of the rectangular training field as the origin, and the length and width directions of the training field are used as the horizontal and vertical axes respectively. The ping-pong balls detected later will be converted to this coordinate system for display.

步骤2,获取双目摄像机的RGB图像,从RGB图像中检测出乒乓球并获取其在图中的坐标点。Step 2, obtain the RGB image of the binocular camera, detect the ping-pong ball from the RGB image and obtain its coordinate point in the figure.

双目摄像机使用kinect,它有一个RGB彩色摄像头和一个深度摄像头。双目摄像机安装在机器人前部正中位置,视角平视前方,距离地面高度取15cm到40cm为宜。机器人在捡球任务开始之前拍摄地面的乒乓球,在ROS平台中同时接收同一时刻的kinect的RGB数据和深度数据,保证获得的两个数据时间戳是一致的。The binocular camera uses kinect, which has an RGB color camera and a depth camera. The binocular camera is installed in the center of the front of the robot, with the angle of view looking straight ahead, and the height from the ground is preferably 15cm to 40cm. The robot takes pictures of the ping pong ball on the ground before the start of the ball picking task, and simultaneously receives the RGB data and depth data of the kinect at the same time in the ROS platform to ensure that the time stamps of the two data obtained are consistent.

如图2所示,取出某一时间kinect拍摄的场地内包含若干乒乓球的RGB图像,并将图像转换为HSV图像,按白色乒乓球的HSV数值阈值进行过滤,取出图像中白色部分,即取出包括乒乓球在内的白色物体图像。然后将HSV图像转成灰度图,进行高斯模糊,让图像边缘更平滑。再使用canny算子进行轮廓检测,设置阈值为100到200,取出图中所有物体的轮廓。最后使用霍夫圆变换检测图中的圆,即可检测出场地中的乒乓球(乒乓球在图中的坐标),并计算得到所有乒乓球在图中的坐标点集,并对这些检测出的乒乓球按照检测的顺序从1到N(乒乓球个数)进行编号。As shown in Figure 2, take out the RGB image containing several table tennis balls captured by kinect at a certain time, convert the image into an HSV image, filter according to the HSV value threshold of the white table tennis ball, and take out the white part of the image, that is, take out Image of white objects including ping pong balls. Then convert the HSV image into a grayscale image and perform Gaussian blurring to make the edges of the image smoother. Then use the canny operator for contour detection, set the threshold to 100 to 200, and take out the contours of all objects in the picture. Finally, use the Hough circle transformation to detect the circle in the picture, and then the table tennis balls in the field (the coordinates of the table tennis balls in the picture) can be detected, and the coordinate point sets of all table tennis balls in the picture can be calculated, and these detected The table tennis balls are numbered from 1 to N (the number of table tennis balls) according to the order of detection.

步骤3,获取双目摄像机的深度数据,根据乒乓球的二维坐标得到其对应的深度信息(即乒乓球距离相机的水平距离),根据所述深度信息计算出乒乓球在机器人坐标系下的坐标。Step 3, obtain the depth data of the binocular camera, obtain its corresponding depth information (that is, the horizontal distance between the table tennis and the camera) according to the two-dimensional coordinates of the table tennis ball, and calculate the distance of the table tennis ball under the robot coordinate system according to the depth information. coordinate.

根据相机针孔模型,即理想化的小孔成像模型,得到两个坐标系,如图3所示一个是相机三维坐标系XYZ,其中X轴平行于地面且平行于图像平面,Y轴垂直于地面,Z轴垂直于图像平面;一个是图像平面坐标系xy,图像平面垂直于地面;根据几何中的截线定理,得到相机三围坐标系中点P(X,Y,Z)和图像平面坐标系中点p(x,y)两者的映射关系为:According to the camera pinhole model, that is, the idealized pinhole imaging model, two coordinate systems are obtained, as shown in Figure 3. One is the camera's three-dimensional coordinate system XYZ, where the X axis is parallel to the ground and the image plane, and the Y axis is perpendicular to On the ground, the Z axis is perpendicular to the image plane; one is the image plane coordinate system xy, and the image plane is perpendicular to the ground; according to the intercept theorem in geometry, the midpoint P (X, Y, Z) of the camera measurement coordinate system and the image plane coordinates are obtained The mapping relationship between the midpoint p(x, y) of the system is:

其中,f为相机焦距,Z为从深度数据中获取的乒乓球的深度,x表示图像平面坐标系的x轴坐标,X表示相机三维坐标系中的X轴坐标;y表示图像平面坐标系中的y轴坐标,Y表示相机三维坐标系中的Y轴坐标。Among them, f is the focal length of the camera, Z is the depth of the ping-pong ball obtained from the depth data, x represents the x-axis coordinate of the image plane coordinate system, X represents the X-axis coordinate of the camera's three-dimensional coordinate system; y represents the image plane coordinate system The y-axis coordinate of , Y represents the Y-axis coordinate in the camera's three-dimensional coordinate system.

根据相机内参,对以上步骤进行改进:According to the internal parameters of the camera, the above steps are improved:

由于实际的差异,每个相机的主点(图像平面坐标系的原点),不一定都在图像的正中心;x和y方向的像素也有差异,因此将上述公式(1)(2)变换为:Due to actual differences, the principal point of each camera (the origin of the image plane coordinate system) is not necessarily in the exact center of the image; the pixels in the x and y directions are also different, so the above formula (1) (2) is transformed into :

其中,cx为主点在x轴上的坐标,cy为主点在y轴上的坐标,fx为f在x轴上的像素量纲,fy为f在y轴上的像素量纲。Among them, c x is the coordinate of the main point on the x-axis, c y is the coordinate of the main point on the y-axis, f x is the pixel dimension of f on the x-axis, f y is the pixel volume of f on the y-axis outline.

如流程图2所示。首先调用接口函数获取相机的内参矩阵,然后根据上述公式(3)(4)计算得到目标乒乓球在相机坐标系中的三维坐标P(X,Y,Z)(X、Y由上面计算得到,Z即为该点的深度,也就是乒乓球距离相机的水平距离)。由于相机三维坐标系和机器人坐标系(名为base_link,以机器人前进方向为X轴,左边为Y轴)方向不一致,存在转换关系,最终乒乓球在机器人坐标系下的坐标为(X′,Y′)=(Z,X)(假设乒乓球全部在地面上,高度坐标为0),并在ROS平台下的RVIZ(ROS可视化工具)中显示。As shown in flow chart 2. First call the interface function to obtain the internal reference matrix of the camera, then calculate the three-dimensional coordinates P (X, Y, Z) of the target table tennis ball in the camera coordinate system according to the above formula (3) (4) (X, Y are obtained by the above calculation, Z is the depth of the point, which is the horizontal distance from the ping-pong ball to the camera). Since the camera's three-dimensional coordinate system and the robot coordinate system (named base_link, the robot's forward direction is the X axis, and the left is the Y axis), there is a conversion relationship. The final coordinates of the table tennis ball in the robot coordinate system are (X′, Y ')=(Z, X) (assuming that the table tennis balls are all on the ground, and the height coordinate is 0), and displayed in RVIZ (ROS visualization tool) under the ROS platform.

重复以上过程,得到图像里地面上所有的乒乓球组成的在机器人坐标系下的坐标点集。Repeat the above process to get the set of coordinate points in the robot coordinate system composed of all the table tennis balls on the ground in the image.

步骤4:根据机器人坐标系和全局坐标系的转换关系,对机器人坐标系下的乒乓球进行坐标转换,得到乒乓球在全局坐标系下的坐标点集。Step 4: According to the conversion relationship between the robot coordinate system and the global coordinate system, coordinate conversion is performed on the table tennis ball in the robot coordinate system to obtain the coordinate point set of the table tennis ball in the global coordinate system.

全局坐标系名为map,机器人坐标系名为base_link。起始时base_link坐标系在map坐标系的原点(坐标为(x0,y0,th0)=(0,0,0),x,y,th分别指x轴坐标,y轴坐标,两个坐标系偏移的角度),设机器人移动速度V=(Vx,Vy,Vth),Vx指沿x轴方向的速度,Vy指沿着y轴方向的速度,Vth指机器人旋转速度。则经过dt时间后,base_link坐标系相对于全局坐标原点的坐标为:The global coordinate system is named map, and the robot coordinate system is named base_link. At the beginning, the base_link coordinate system is at the origin of the map coordinate system (the coordinates are (x 0 , y 0 , th 0 )=(0, 0, 0), where x, y, and th refer to the x-axis coordinates and y-axis coordinates, respectively. coordinate system offset angle), let the robot moving speed V=(V x , V y , V th ), V x refers to the speed along the x-axis direction, V y refers to the speed along the y-axis direction, V th refers to Robot rotation speed. Then after the dt time, the coordinates of the base_link coordinate system relative to the origin of the global coordinates are:

(x1,y1,th1)=(x0+(Vx*cos(th0)-Vy*sin(th0))*dt,y0+(Vx*sin(th0)+Vy*cos(th0))*dt,th0+Vth*dt) (5)(x 1 , y 1 , th 1 )=(x 0 +(V x *cos(th 0 )-V y *sin(th 0 ))*dt, y 0 +(V x *sin(th 0 )+ V y *cos(th 0 ))*dt, th 0 +V th *dt) (5)

根据公式(5)得到的base_link坐标系的坐标转换关系,可以进行坐标转换。由base_link坐标系的原点(x1,y1)以及偏转角th1可以计算全局坐标系下的坐标(由图4所示)。在机器人坐标系base_link下的目标乒乓球坐标(X′,Y′)转换到全局坐标系map下的坐标(X″,Y″)为:Coordinate conversion can be performed according to the coordinate conversion relationship of the base_link coordinate system obtained by formula (5). The coordinates in the global coordinate system can be calculated from the origin (x 1 , y 1 ) of the base_link coordinate system and the deflection angle th 1 (shown in FIG. 4 ). The target table tennis coordinates (X′, Y′) in the robot coordinate system base_link are converted to the coordinates (X″, Y″) in the global coordinate system map as:

(X″,Y″)=(x1+(X′*cos(th1)-Y′*sin(th1)),(X″, Y″)=(x 1 +(X′*cos(th 1 )-Y′*sin(th 1 )),

y1+(X′*sin(th1)+Y′*cos(th1)))y 1 +(X′*sin(th 1 )+Y′*cos(th 1 )))

至此完成了全部的坐标转换工作。So far, all the coordinate transformation work has been completed.

步骤5:对得到的乒乓球坐标点集使用蚁群算法进行最短遍历路径规划,得到初步的捡球顺序。Step 5: Use the ant colony algorithm to plan the shortest traversal path for the obtained table tennis coordinate point set, and obtain the preliminary order of picking up the ball.

首先按照检测乒乓球时的编号顺序,计算所有乒乓球两两之间的距离并组合成二维邻接矩阵Graph,矩阵行和列维度都为图中检测出的乒乓球个数N,用于进行最短路径的计算。矩阵中的元素即为乒乓球之间的距离,如行i和列j表示第i个球和第j个球之间的距离。有N个乒乓球,则矩阵中元素的个数为N2First, according to the numbering sequence when detecting table tennis balls, calculate the distance between all table tennis balls and combine them into a two-dimensional adjacency matrix Graph. Calculation of the shortest path. The elements in the matrix are the distances between the table tennis balls, for example, row i and column j represent the distance between the i-th ball and the j-th ball. If there are N ping-pong balls, the number of elements in the matrix is N 2 .

如图5所示,开始时先初始化蚁群算法的参数α(信息素的加权值)、β(能见度的加权值)、ρ(信息素的蒸发率)、Q(信息素增益系数)、初始化信息素τ0、迭代次数N。As shown in Figure 5, at the beginning, the parameters of the ant colony algorithm α (weighted value of pheromone), β (weighted value of visibility), ρ (evaporation rate of pheromone), Q (pheromone gain coefficient), initialization Pheromone τ 0 , number of iterations N.

然后为每个蚂蚁随机选择一个乒乓球作为出发点,并将出发点加入到已经经过的点集合C。分别计算当前点到剩下未经过的所有点(集合O)的概率P=τα*(γ)β其中τ为两点之间信息素信息素,γ为两点之间距离(距离从邻接矩阵graph中取得)的倒数。采用轮盘赌的方法,为每个蚂蚁选择下一个点。即取一个随机数q,计算到第一个点的概率,如果小于q则继续计算下一个点;如果到某个点的概率累加和大于q,则取该点。例如,q=0.4,p1=0.2,p2=0.3,p3=0.5,(pn表示选择第n个点的概率),则由于p1<0.4,且p1+p2>0.4,所以取第二个点作为下一个目标。以此类推将所有蚂蚁移动到下一个目标点,并将该点加入到已经经过的集合中(集合C)。Then randomly select a ping-pong ball as the starting point for each ant, and add the starting point to the point set C that has already passed. Calculate the probability P=τ α *(γ) β from the current point to all the remaining points (set O) that have not been passed, where τ is the pheromone pheromone between two points, and γ is the distance between two points (distance from adjacent Obtained in the matrix graph) reciprocal. Using a roulette wheel approach, the next point is chosen for each ant. That is, take a random number q, calculate the probability of the first point, if it is less than q, continue to calculate the next point; if the cumulative sum of the probability of reaching a certain point is greater than q, then take this point. For example, q=0.4, p 1 =0.2, p 2 =0.3, p 3 =0.5, (p n represents the probability of selecting the nth point), then since p 1 <0.4, and p 1 +p 2 >0.4, So take the second point as the next target. By analogy, move all ants to the next target point, and add this point to the set that has passed (set C).

重复以上步骤,直到所有的点都加入到已经经过的集合中。这样就完成一次迭代。Repeat the above steps until all the points are added to the already passed set. This completes one iteration.

按照选择的路径计算每只蚂蚁走过的路径长度,即根据路径顺序,计算乒乓球之间的距离并累加求和,例如路径顺序为2-1-3-4(序号在前面步骤已经标定),则路径长度为2号乒乓球到1号乒乓球的距离d1,加上1号球到3号球的距离d2,加上3号球到四号球的距离d3,即L=d1+d2+d3。所有蚂蚁走完之后更新每一条边的信息素:每条路径上两点之间的信息素增量与他们所在路径的长度成反比:add=Q/Lk(Q一般取50-100),其中Lk表示第k条路径的长度,add表示信息素的增加量。因此更新后的信息素为τ=(1-ρ)*τ0+Q/LkCalculate the path length of each ant according to the selected path, that is, calculate the distance between the table tennis balls according to the path sequence and accumulate the summation, for example, the path sequence is 2-1-3-4 (the serial number has been calibrated in the previous step) , then the path length is the distance d 1 from the No. 2 table tennis ball to the No. 1 table tennis ball, plus the distance d 2 from the No. 1 ball to the No. 3 ball, plus the distance d 3 from the No. 3 ball to the No. 4 ball, that is, L= d 1 +d 2 +d 3 . Update the pheromone of each edge after all ants have finished walking: the pheromone increment between two points on each path is inversely proportional to the length of their path: add=Q/L k (Q is generally 50-100), Among them, L k represents the length of the kth path, and add represents the increase amount of pheromone. Therefore, the updated pheromone is τ=(1-ρ)*τ 0 +Q/L k .

使用新的信息素继续下一轮迭代;如果(1)迭代次数达到设定值N(50次)都已经完成,或者(2)信息素增量add小于一定阈值(如0.01),则输出遍历所有点的近似最优解(路径长度最短)。Use the new pheromone to continue the next round of iteration; if (1) the number of iterations reaches the set value N (50 times) and all have been completed, or (2) the pheromone increment add is less than a certain threshold (such as 0.01), then the output traversal Approximate optimal solution (shortest path length) for all points.

步骤6:根据机器人自身形状和规划出来的路径,去除多次经过的乒乓球,进一步缩短路径长度。Step 6: According to the shape of the robot itself and the planned path, remove the ping-pong balls that have passed many times, and further shorten the path length.

如图6所示(全局坐标系map中),根据步骤5路径规划得到的顺序,假设机器人移动的第1个目标乒乓球为2号点(数字序号按照步骤2中识别的乒乓球顺序标定,0号点表示机器人在识别乒乓球时的当前坐标点,2号点即为第2个(编号在检测乒乓球时已经标定)识别出的乒乓球的坐标点,它在路径规划中作为第1个目标点),画出直线b1、b2与d1、d2,b1、b2平行于0号点和2号点两点的连线,并且与机器人在0号点的最小外接圆(由于机器人形状可能不规则,能够完全把机器人包围在内部的最小圆称为最小外接圆)相切;直线d1与两点连线方向垂直并与机器人在出发点的最小外接圆的尾部相切;直线d2与两点连线方向垂直并与机器人在2号点的最小外接圆的头部相切;这四条线构成的矩形表示机器人从0号点到2号点扫过的区域(出于对效率的考虑,对于矩形四个角未覆盖的部分忽略不计)。计算取得在四条线构成的矩形中的所有乒乓球坐标点,即图4中的点4、7、15,将这些点从坐标点集中删去,因为机器人携带吸力装置或者滚轮捡球装置,所以机器人在从0点移动到2号点的过程中,会经过这几个乒乓球,将它们都捡起来,即机器人为可将最小外接圆半径宽度范围内的球都捡起来。删掉这些点就减少冗余遍历点,提高运行效率。As shown in Figure 6 (in the global coordinate system map), according to the order obtained from the path planning in step 5, it is assumed that the first target table tennis ball moved by the robot is point 2 (the digital serial number is calibrated according to the order of table tennis balls identified in step 2, Point 0 represents the current coordinate point of the robot when it recognizes the table tennis ball, and point 2 is the coordinate point of the second recognized table tennis ball (the number has been calibrated when detecting the table tennis ball), which is used as the first coordinate point in path planning. target point), draw straight line b 1 , b 2 and d 1 , d 2 , b 1 , b 2 are parallel to the line connecting the two points of point 0 and point 2, and the minimum circumscribed line with the robot at point 0 The circle (because the shape of the robot may be irregular, the smallest circle that can completely surround the robot is called the minimum circumscribed circle) is tangent; the straight line d 1 is perpendicular to the direction connecting the two points and touches the tail of the minimum circumscribed circle of the robot at the starting point Tangent; the straight line d 2 is perpendicular to the direction connecting the two points and tangent to the head of the smallest circumscribed circle of the robot at point 2; the rectangle formed by these four lines represents the area swept by the robot from point 0 to point 2 ( For the sake of efficiency, the parts not covered by the four corners of the rectangle are ignored). Calculate and obtain all table tennis coordinate points in the rectangle formed by four lines, that is, points 4, 7, and 15 in Figure 4, and delete these points from the coordinate point set, because the robot carries a suction device or a roller picking device, so In the process of moving from point 0 to point 2, the robot will pass through these table tennis balls and pick them up, that is, the robot can pick up all the balls within the radius width of the smallest circumscribed circle. Deleting these points reduces redundant traversal points and improves operational efficiency.

然后将2号点作为起始点,从步骤5的路径规划中选取下一个目标点,对这两个点按照0号点和2号点的操作过程进行同样的操作。以此类推,重复步骤6,直到步骤5中计算得到的路径上所有的点全部处理完毕,最终得到一条没有冗余路线的路径,机器人按这条路径进行捡球工作的效率比仅用步骤5中的路径运行要高效,节省了时间。Then use point 2 as the starting point, select the next target point from the path planning in step 5, and perform the same operation on these two points according to the operation process of point 0 and point 2. By analogy, repeat step 6 until all points on the path calculated in step 5 are processed, and finally a path without redundant routes is obtained. The efficiency of the robot picking up the ball according to this path is higher than that of only step 5 The path run in is efficient and saves time.

相应的,本发明还提供了一种存储一个或多个程序的计算机可读存储介质,所述一个或多个程序包括指令,所述指令当由计算设备执行时,使得所述计算设备执行上述方法。Correspondingly, the present invention also provides a computer-readable storage medium storing one or more programs, and the one or more programs include instructions, and the instructions, when executed by a computing device, cause the computing device to perform the above-mentioned method.

相应的,本发明还提供了一种计算设备,包括,Correspondingly, the present invention also provides a computing device, including:

一个或多个处理器、存储器以及一个或多个程序,其中一个或多个程序存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序包括用于执行上述方法的指令。one or more processors, memory, and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs include Instructions for performing the methods described above.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowcharts and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.

以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明技术原理的前提下,还可以做出若干改进和变型,这些改进和变型也应视为本发明的保护范围。The above is only a preferred embodiment of the present invention, it should be pointed out that for those of ordinary skill in the art, without departing from the technical principle of the present invention, some improvements and modifications can also be made, these improvements and modifications It should also be regarded as the protection scope of the present invention.

Claims (8)

1.一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法,其特征是,包括以下过程:1. a kind of robot operation method of picking up table tennis based on binocular vision and ant colony algorithm, is characterized in that, comprises following process: 建立乒乓球训练场地的全局坐标系;Establish the global coordinate system of the table tennis training ground; 获取双目摄像机拍摄的场地中地面乒乓球散落情况的RGB图像,从RGB图像中检测出乒乓球并获得各乒乓球的坐标位置;Obtain the RGB image of the scattered situation of the ground table tennis balls in the venue captured by the binocular camera, detect the table tennis balls from the RGB image and obtain the coordinate positions of each table tennis ball; 获取双目摄像机的深度数据,得到各乒乓球距离摄像机的距离;Obtain the depth data of the binocular camera, and get the distance between each table tennis ball and the camera; 根据各乒乓球的坐标位置和距离摄像机的距离,计算得到在全局坐标系下乒乓球的坐标点集;According to the coordinate position of each table tennis ball and the distance from the camera, calculate the coordinate point set of the table tennis ball under the global coordinate system; 对坐标点集使用蚁群算法进行最短遍历路径规划,得到初步的捡球路径;Use the ant colony algorithm to plan the shortest traversal path for the coordinate point set, and get the preliminary ball picking path; 从初步的捡球路径去除多次经过的乒乓球,得到没有冗余路线的路径。Remove the ping-pong balls that have passed multiple times from the initial ball picking path to obtain a path without redundant paths. 2.根据权利要求1所述的一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法,其特征是,从RGB图像中检测出乒乓球并获得各乒乓球的坐标位置的具体过程包括:2. a kind of picking up table tennis robot operating method based on binocular vision and ant colony algorithm according to claim 1, is characterized in that, detects table tennis from RGB image and obtains the concrete process of the coordinate position of each table tennis include: 将RGB图像转换为HSV图像;Convert an RGB image to an HSV image; 将HSV图像转成灰度图,进行高斯模糊;Convert the HSV image into a grayscale image for Gaussian blurring; 使用canny算子进行轮廓检测,获得图中所有物体的轮廓;Use the canny operator for contour detection to obtain the contours of all objects in the picture; 使用霍夫圆变换检测图中的圆,即可检测出场地中的乒乓球,并计算得到所有乒乓球在图中的坐标位置。By using Hough circle transformation to detect the circles in the picture, the table tennis balls in the field can be detected, and the coordinate positions of all table tennis balls in the picture can be calculated. 3.根据权利要求1所述的一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法,其特征是,根据各乒乓球的坐标位置和距离摄像机的距离计算得到在全局坐标系下乒乓球的坐标点集包括以下过程:3. a kind of picking up table tennis robot operating method based on binocular vision and ant colony algorithm according to claim 1, is characterized in that, obtains under the global coordinate system according to the coordinate position of each table tennis and distance calculation from camera The coordinate point set of table tennis includes the following process: 将各乒乓球的坐标位置和距离摄像机的距离,转换到相机三维坐标系下,得到在相机三围坐标系下乒乓球的坐标点集;Convert the coordinate position of each table tennis ball and the distance from the camera to the three-dimensional coordinate system of the camera, and obtain the coordinate point set of the table tennis ball under the three-dimensional coordinate system of the camera; 再将乒乓球在相机三维坐标系下的坐标转换到机器人坐标系下;Then transform the coordinates of the table tennis ball in the camera's three-dimensional coordinate system to the robot coordinate system; 最后将乒乓球在机器人坐标系下的坐标转换到全局坐标系下,得到在全局坐标系下乒乓球的坐标点集。Finally, transform the coordinates of the table tennis ball in the robot coordinate system to the global coordinate system, and obtain the coordinate point set of the table tennis ball in the global coordinate system. 4.根据权利要求3所述的一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法,其特征是,将各乒乓球的坐标位置和距离摄像机的距离转换到相机三维坐标系下的过程包括:4. a kind of picking up table tennis robot operation method based on binocular vision and ant colony algorithm according to claim 3, is characterized in that, the coordinate position of each table tennis ball and the distance from camera are converted to under the camera three-dimensional coordinate system The process includes: 建立相机三维坐标系XYZ、图像平面坐标系xy;Establish camera three-dimensional coordinate system XYZ, image plane coordinate system xy; 相机三围坐标系中点P(X,Y,Z)和图像平面坐标系中点p(x,y)两者的映射关系为:The mapping relationship between the point P(X, Y, Z) in the camera’s three-dimensional coordinate system and the point p(x, y) in the image plane coordinate system is: 其中,f为相机焦距,Z为从深度数据中获取的乒乓球的深度,x表示图像平面坐标系的x轴坐标,X表示相机三维坐标系中的X轴坐标;y表示图像平面坐标系中的y轴坐标,Y表示相机三维坐标系中的Y轴坐标;cx为主点在x轴上的坐标,cy为主点在y轴上的坐标,fx为f在x轴上的像素量纲,fy为f在y轴上的像素量纲;Among them, f is the focal length of the camera, Z is the depth of the ping-pong ball obtained from the depth data, x represents the x-axis coordinate of the image plane coordinate system, X represents the X-axis coordinate of the camera's three-dimensional coordinate system; y represents the image plane coordinate system The y-axis coordinate of the camera, Y indicates the Y-axis coordinate in the camera's three-dimensional coordinate system; c x is the coordinate of the main point on the x-axis, c y is the coordinate of the main point on the y-axis, and f x is the coordinate of f on the x-axis Pixel dimension, f y is the pixel dimension of f on the y-axis; 各乒乓球的坐标位置为图像平面坐标系中坐标,距离摄像机的距离为相机坐标系中Z轴数值,根据上述公式计算得到乒乓球在相机坐标系中的三维坐标P(X,Y,Z)。The coordinate position of each table tennis ball is the coordinate in the image plane coordinate system, and the distance from the camera is the Z-axis value in the camera coordinate system. According to the above formula, the three-dimensional coordinates P(X, Y, Z) of the table tennis ball in the camera coordinate system are calculated. . 5.根据权利要求3所述的一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法,其特征是,将乒乓球在机器人坐标系下的坐标转换到全局坐标系下的过程为:5. a kind of picking up table tennis robot operating method based on binocular vision and ant colony algorithm according to claim 3, is characterized in that, the process that the coordinate conversion of table tennis under the robot coordinate system to the global coordinate system is: : 起始时机器人坐标系在全局坐标系的原点,坐标为(x0,y0,th0)=(0,0,0),设机器人移动速度V=(Vx,Vy,Vth),Vx指沿x轴方向的速度,Vy指沿着y轴方向的速度,Vth指机器人旋转速度;则经过dt时间后,机器人坐标系相对于全局坐标原点的坐标为:At the beginning, the robot coordinate system is at the origin of the global coordinate system, the coordinates are (x 0 , y 0 , th 0 )=(0, 0, 0), and the moving speed of the robot is V=(V x , V y , V th ) , V x refers to the speed along the x-axis direction, V y refers to the speed along the y-axis direction, and V th refers to the robot rotation speed; after the dt time, the coordinates of the robot coordinate system relative to the global coordinate origin are: (x1,y1,th1)=(x0+(Vx*cos(th0)-Vy*sin(th0))*dt,y0+(Vx*sin(th0)+Vy*cos(th0))*dt,th0+Vth*dt) (5)(x 1 , y 1 , th 1 )=(x 0 +(V x *cos(th 0 )-V y *sin(th 0 ))*dt, y 0 +(V x *sin(th 0 )+ V y *cos(th 0 ))*dt, th 0 +V th *dt) (5) 根据公式(5)得到的机器人坐标系的坐标转换关系,可以进行坐标转换,在机器人坐标系下的目标乒乓球坐标(X′,Y′)转换到全局坐标系下的坐标(X″,Y″)为:According to the coordinate conversion relationship of the robot coordinate system obtained by formula (5), coordinate conversion can be carried out, and the target table tennis coordinates (X', Y') under the robot coordinate system are converted to the coordinates (X ", Y) under the global coordinate system ")for: (X″,Y″)=(x1+(X′*cos(th1)-Y′*sin(th1)),(X″, Y″)=(x 1 +(X′*cos(th 1 )-Y′*sin(th 1 )), y1+(X′*sin(th1)+Y′*cos(th1)))y 1 +(X′*sin(th 1 )+Y′*cos(th 1 ))) 完成所有乒乓球的坐标转换,得到在全局坐标系下乒乓球的坐标点集。Complete the coordinate transformation of all table tennis balls, and obtain the coordinate point set of table tennis balls in the global coordinate system. 6.根据权利要求1所述的一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法,其特征是,从初步的捡球路径中去除多次经过的乒乓球,得到没有冗余路线的路径包括以下过程:6. a kind of picking up table tennis robot operating method based on binocular vision and ant colony algorithm according to claim 1, is characterized in that, removes the table tennis ball that passes through repeatedly from preliminary picking up ball path, obtains no redundancy A route's path includes the following procedures: 根据初步的捡球路径,假设机器人移动从出发点移动到第1个目标乒乓球,According to the preliminary ball picking path, assuming that the robot moves from the starting point to the first target table tennis ball, 画出直线b1、b2与d1、d2,b1、b2平行于出发点点和目标乒乓球两点的连线,并且与机器人在出发点的最小外接圆相切;直线d1与两点连线方向垂直并与机器人在出发点的最小外接圆的尾部相切;直线d2与两点连线方向垂直并与机器人在目标点的最小外接圆的头部相切;这四条线构成的矩形表示机器人从出发点到目标点扫过的区域,计算取得在四条线构成的矩形中的所有乒乓球坐标点,将这些点从坐标点集中删去,Draw straight lines b 1 , b 2 and d 1 , d 2 , b 1 , b 2 are parallel to the starting point and the target table tennis point, and are tangent to the minimum circumscribed circle of the robot at the starting point; straight line d 1 and The direction of the line connecting two points is perpendicular to and tangent to the tail of the smallest circumscribed circle of the robot at the starting point; the straight line d 2 is perpendicular to the direction of the line connecting two points and tangent to the head of the smallest circumscribed circle of the robot at the target point; these four lines constitute The rectangle represents the area swept by the robot from the starting point to the target point, calculate and obtain all the table tennis coordinate points in the rectangle formed by four lines, delete these points from the coordinate point set, 然后将此目标点作为起始点,从初步的捡球路径中选取下一个目标点,进行上述同样的操作;以此类推,直到捡球路径上所有的点全部处理完毕,最终得到一条没有冗余路线的路径。Then take this target point as the starting point, select the next target point from the preliminary ball picking path, and perform the same operation above; The path of the route. 7.一种存储一个或多个程序的计算机可读存储介质,所述一个或多个程序包括指令,所述指令当由计算设备执行时,使得所述计算设备执行权利要求1-6任一项所述一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法。7. A computer-readable storage medium storing one or more programs, the one or more programs comprising instructions which, when executed by a computing device, cause the computing device to perform any one of claims 1-6. A kind of operation method of picking table tennis robot based on binocular vision and ant colony algorithm described in the item. 8.一种计算设备,包括,8. A computing device comprising, 一个或多个处理器、存储器以及一个或多个程序,其中一个或多个程序存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序包括用于执行权利要求1-6任一项所述一种基于双目视觉和蚁群算法的捡乒乓球机器人运行方法的指令。One or more processors, memory and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs include The instruction for executing the operation method of a table tennis robot based on binocular vision and ant colony algorithm described in any one of claims 1-6.
CN201910744905.2A 2019-08-13 2019-08-13 Operation method and device of table tennis ball picking robot based on binocular vision and ant colony algorithm Active CN110433467B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910744905.2A CN110433467B (en) 2019-08-13 2019-08-13 Operation method and device of table tennis ball picking robot based on binocular vision and ant colony algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910744905.2A CN110433467B (en) 2019-08-13 2019-08-13 Operation method and device of table tennis ball picking robot based on binocular vision and ant colony algorithm

Publications (2)

Publication Number Publication Date
CN110433467A true CN110433467A (en) 2019-11-12
CN110433467B CN110433467B (en) 2021-02-12

Family

ID=68435030

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910744905.2A Active CN110433467B (en) 2019-08-13 2019-08-13 Operation method and device of table tennis ball picking robot based on binocular vision and ant colony algorithm

Country Status (1)

Country Link
CN (1) CN110433467B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111530041A (en) * 2020-04-24 2020-08-14 贵州民族大学 Robot ball picking method and system
CN111744161A (en) * 2020-07-29 2020-10-09 哈尔滨理工大学 A table tennis ball drop detection and edge ball judgment system
CN112587884A (en) * 2020-12-24 2021-04-02 烟台南山学院 Full-automatic ball picking robot ball picking method based on monocular vision
CN114879669A (en) * 2022-04-28 2022-08-09 贵州民族大学 Robot control method based on multi-objective path planning and intelligent picking
CN115421522A (en) * 2022-06-20 2022-12-02 南京信息工程大学 A UAV Coverage Path Planning Method Based on Parallel Adaptive Ant Colony Algorithm

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160105647A1 (en) * 2011-03-25 2016-04-14 Eric D. Schwartz Retrieving device
CN107137890A (en) * 2016-09-27 2017-09-08 五邑大学 A kind of intelligent tennis ball pickup robot based on image recognition
CN107767423A (en) * 2017-10-10 2018-03-06 大连理工大学 A kind of mechanical arm target positioning grasping means based on binocular vision
CN108579030A (en) * 2018-04-09 2018-09-28 宁波乔克兄弟三维科技有限公司 A kind of robot of view-based access control model picks up ball method
CN108786041A (en) * 2018-07-12 2018-11-13 贵州理工学院 Intelligent ball collecting control method and intelligent ball collecting robot
CN109333549A (en) * 2018-10-25 2019-02-15 湖南大学 A mobile robot for picking up table tennis balls based on machine vision and its control method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160105647A1 (en) * 2011-03-25 2016-04-14 Eric D. Schwartz Retrieving device
CN107137890A (en) * 2016-09-27 2017-09-08 五邑大学 A kind of intelligent tennis ball pickup robot based on image recognition
CN107767423A (en) * 2017-10-10 2018-03-06 大连理工大学 A kind of mechanical arm target positioning grasping means based on binocular vision
CN108579030A (en) * 2018-04-09 2018-09-28 宁波乔克兄弟三维科技有限公司 A kind of robot of view-based access control model picks up ball method
CN108786041A (en) * 2018-07-12 2018-11-13 贵州理工学院 Intelligent ball collecting control method and intelligent ball collecting robot
CN109333549A (en) * 2018-10-25 2019-02-15 湖南大学 A mobile robot for picking up table tennis balls based on machine vision and its control method

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111530041A (en) * 2020-04-24 2020-08-14 贵州民族大学 Robot ball picking method and system
CN111744161A (en) * 2020-07-29 2020-10-09 哈尔滨理工大学 A table tennis ball drop detection and edge ball judgment system
CN112587884A (en) * 2020-12-24 2021-04-02 烟台南山学院 Full-automatic ball picking robot ball picking method based on monocular vision
CN114879669A (en) * 2022-04-28 2022-08-09 贵州民族大学 Robot control method based on multi-objective path planning and intelligent picking
CN114879669B (en) * 2022-04-28 2024-05-28 贵州民族大学 Robot control method based on multi-objective path planning and intelligent picking
CN115421522A (en) * 2022-06-20 2022-12-02 南京信息工程大学 A UAV Coverage Path Planning Method Based on Parallel Adaptive Ant Colony Algorithm

Also Published As

Publication number Publication date
CN110433467B (en) 2021-02-12

Similar Documents

Publication Publication Date Title
CN110433467A (en) Picking up table tennis ball robot operation method and equipment based on binocular vision and ant group algorithm
CN111462200B (en) A cross-video pedestrian positioning and tracking method, system and device
CN109682381B (en) Omnidirectional vision based large-view-field scene perception method, system, medium and equipment
CN112150575B (en) Scene data acquisition method, model training method and device and computer equipment
WO2020024234A1 (en) Route navigation method, related device, and computer readable storage medium
JP6031554B2 (en) Obstacle detection method and apparatus based on monocular camera
CN103778635B (en) For the method and apparatus processing data
WO2020164092A1 (en) Image processing method and apparatus, moveable platform, unmanned aerial vehicle and storage medium
TWI467494B (en) Use a depth map for mobile camera positioning
CN106940186A (en) A kind of robot autonomous localization and air navigation aid and system
CN111665842A (en) Indoor SLAM mapping method and system based on semantic information fusion
CN106525000B (en) Roadmarking automation extracting method based on laser scanning discrete point intensity gradient
US20150138193A1 (en) Method and device for panorama-based inter-viewpoint walkthrough, and machine readable medium
CN111609852A (en) Semantic map construction method, cleaning robot and electronic device
CN109887030A (en) Image pose detection method of textureless metal parts based on CAD sparse template
CN109146990B (en) Building outline calculation method
Alizadeh Object distance measurement using a single camera for robotic applications
CN113192200B (en) Method for constructing urban real scene three-dimensional model based on space-three parallel computing algorithm
US20210304411A1 (en) Map construction method, apparatus, storage medium and electronic device
CN117367404A (en) Visual positioning mapping method and system based on SLAM (sequential localization and mapping) in dynamic scene
CN111679664A (en) 3D map construction method based on depth camera and sweeping robot
CN107860390A (en) The nonholonomic mobile robot of view-based access control model ROS systems remotely pinpoints auto-navigation method
CN108596947A (en) A kind of fast-moving target tracking method suitable for RGB-D cameras
CN111198563B (en) A terrain recognition method and system for dynamic motion of a footed robot
CN103617631A (en) Tracking method based on center detection

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
EE01 Entry into force of recordation of patent licensing contract
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20191112

Assignee: NANJING NANYOU INSTITUTE OF INFORMATION TECHNOVATION Co.,Ltd.

Assignor: NANJING University OF POSTS AND TELECOMMUNICATIONS

Contract record no.: X2021980014141

Denomination of invention: Operation method and equipment of table tennis picking robot based on binocular vision and ant colony algorithm

Granted publication date: 20210212

License type: Common License

Record date: 20211206

EC01 Cancellation of recordation of patent licensing contract
EC01 Cancellation of recordation of patent licensing contract

Assignee: NANJING NANYOU INSTITUTE OF INFORMATION TECHNOVATION Co.,Ltd.

Assignor: NANJING University OF POSTS AND TELECOMMUNICATIONS

Contract record no.: X2021980014141

Date of cancellation: 20231107