1 mechArm 270
2 mycobot 280
3 mypalletizer 260
4 AI kit
今天的文章的主题主要介绍一下跟aikit 套件搭配的三款机械臂,它们之间分别有什么不一样的地方。
假如说你有一台机械臂的话,你会用它来干什么呢?简单的控制机械臂动一动;让它重复执行某个轨迹;还是让它能够在工业上代替人类去工作。在随着时代的进步,机器人频繁的出现在我们的周围,它们代替我们从事危险的工作,服务人类等。今天我们一起来看一下,机械臂是如何在一个放工业场景中进行工作的。
人工智能套装是集视觉、定位抓取、自动分拣模块为一体的入门级人工智能套装。
基于Linux系统,在ROS搭建1:1仿真模型,可通过开发软件实现机械臂的控制,能够快速入门学习人工智能基础知识。
目前我们的人工智能套装可以实现对颜色识别和抓取,对图像识别和抓取。
该套件对于刚入门机械臂,机器视觉的用户来说是非常有帮助的,能够带你快速的了解人工智能项目是如何搭建起来的,进一步的了解机器视觉是如何跟机械臂进行联动的。
接下来我们简单了解一下,能够与aikit套装适配的三款机械臂
myPalletizer260是一款四轴的码垛机械臂,全包裹轻量级四轴码垛机械臂,整体去鳍设计,小巧紧凑,便于携带。myPalletizer本体重量960g,负载250g,工作半径260mm,专为创客,教育设计,有丰富的扩展接口,ai套件模拟工业场景,可以进行机器视觉的学习。t 套装适配的三款机械臂
mechArm 270 是一款小六轴机械臂,结构是中心对称结构(仿工业结构)。mechArm 270本体重量1kg, 负载250g,工作半径270mm,设计紧凑便携,小巧但功能强大,操作简单,能与人协同、安全工作。
myCobot 280 是世界上最小最轻的六轴协作机械臂(UR结构),可以根据用户需求进行二次开发,实现用户个性化定制。myCobot 本体自重850g,有效负载250g,有效工作半径280mm,体积小巧但功能强大,既可搭配多种末端执行器适配多种应用场景,也可支持多平台软件的二次开发,满足科研教育、智能家居,商业探索等各种场景需求。
我们先来看个视频aikit 是如何跟这三款机械臂运行的。
视频地址:https://youtu.be/9J2reiPYNxg
视频内容展现了,颜色识别和智能分拣功能,还有图像识别和智能分拣功能。
我们简单介绍一下 aikit 是如何实现的。(以颜色识别和智能分拣功能为例)
该人工智能项目主要运用到了两个模块
● 视觉处理模块
● 计算模块(处理eye to hand的之间的换算)
OpenCV (Open Source Computer Vision) 是一个开源的计算机视觉库,用于开发计算机视觉应用程序。OpenCV 包含了大量用于图像处理、视频分析、基于深度学习的目标检测和识别等功能的函数和算法。
我们使用了OpenCV来对图像进行处理。从摄像头得到的视频进行处理,从而获取视频中的信息例如颜色,图像,视频中的平面坐标(x,y)等。将获取到的信息传递给处理器进行下一步的处理。
下面是处理图像的部分代码(颜色识别)
# detect cube color
def color_detect(self, img):
# set the arrangement of color'HSV
x = y = 0
gs_img = cv2.GaussianBlur(img, (3, 3), 0) # Gaussian blur
# transfrom the img to model of gray
hsv = cv2.cvtColor(gs_img, cv2.COLOR_BGR2HSV)
for mycolor, item in self.HSV.items():
redLower = np.array(item[0])
redUpper = np.array(item[1])
# wipe off all color expect color in range
mask = cv2.inRange(hsv, item[0], item[1])
# a etching operation on a picture to remove edge roughness
erosion = cv2.erode(mask, np.ones((1, 1), np.uint8), iterations=2)
# the image for expansion operation, its role is to deepen the color depth in the picture
dilation = cv2.dilate(erosion, np.ones(
(1, 1), np.uint8), iterations=2)
# adds pixels to the image
target = cv2.bitwise_and(img, img, mask=dilation)
# the filtered image is transformed into a binary image and placed in binary
ret, binary = cv2.threshold(dilation, 127, 255, cv2.THRESH_BINARY)
# get the contour coordinates of the image, where contours is the coordinate value, here only the contour is detected
contours, hierarchy = cv2.findContours(
dilation, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
if len(contours) > 0:
# do something about misidentification
boxes = [
box
for box in [cv2.boundingRect(c) for c in contours]
if min(img.shape[0], img.shape[1]) / 10
< min(box[2], box[3])
< min(img.shape[0], img.shape[1]) / 1
]
if boxes:
for box in boxes:
x, y, w, h = box
# find the largest object that fits the requirements
c = max(contours, key=cv2.contourArea)
# get the lower left and upper right points of the positioning object
x, y, w, h = cv2.boundingRect(c)
# locate the target by drawing rectangle
cv2.rectangle(img, (x, y), (x+w, y+h), (153, 153, 0), 2)
# calculate the rectangle center
x, y = (x*2+w)/2, (y*2+h)/2
# calculate the real coordinates of mycobot relative to the target
if mycolor == "red":
self.color = 0
elif mycolor == "green":
self.color = 1
elif mycolor == "cyan" or mycolor == "blue":
self.color = 2
else:
self.color = 3
if abs(x) + abs(y) > 0:
return x, y
else:
return None
只是获取我们的图像信息还不够,得处理得到的信息,传递给机械臂去执行命令。这里就运用到了计算模块。
NumPy (Numerical Python) 是一个开源的 Python 库,主要用于数学计算。NumPy 提供了大量用于科学计算的函数和算法,包括矩阵运算、线性代数、随机数生成、傅里叶变换等。
我们要处理图像上的坐标,换算成真实的坐标,这有一个专业名词就是eye to hand。我们用python通过numpy计算库来计算我们的坐标,最后发送给机械臂去执行分拣。
下面是计算的部分代码
while cv2.waitKey(1) < 0:
# read camera
_, frame = cap.read()
# deal img
frame = detect.transform_frame(frame)
if _init_ > 0:
_init_ -= 1
continue
# calculate the parameters of camera clipping
if init_num < 20:
if detect.get_calculate_params(frame) is None:
cv2.imshow("figure", frame)
continue
else:
x1, x2, y1, y2 = detect.get_calculate_params(frame)
detect.draw_marker(frame, x1, y1)
detect.draw_marker(frame, x2, y2)
detect.sum_x1 += x1
detect.sum_x2 += x2
detect.sum_y1 += y1
detect.sum_y2 += y2
init_num += 1
continue
elif init_num == 20:
detect.set_cut_params(
(detect.sum_x1)/20.0,
(detect.sum_y1)/20.0,
(detect.sum_x2)/20.0,
(detect.sum_y2)/20.0,
)
detect.sum_x1 = detect.sum_x2 = detect.sum_y1 = detect.sum_y2 = 0
init_num += 1
continue
# calculate params of the coords between cube and mycobot
if nparams < 10:
if detect.get_calculate_params(frame) is None:
cv2.imshow("figure", frame)
continue
else:
x1, x2, y1, y2 = detect.get_calculate_params(frame)
detect.draw_marker(frame, x1, y1)
detect.draw_marker(frame, x2, y2)
detect.sum_x1 += x1
detect.sum_x2 += x2
detect.sum_y1 += y1
detect.sum_y2 += y2
nparams += 1
continue
elif nparams == 10:
nparams += 1
# calculate and set params of calculating real coord between cube and mycobot
detect.set_params(
(detect.sum_x1+detect.sum_x2)/20.0,
(detect.sum_y1+detect.sum_y2)/20.0,
abs(detect.sum_x1-detect.sum_x2)/10.0 +
abs(detect.sum_y1-detect.sum_y2)/10.0
)
print ("ok")
continue
# get detect result
detect_result = detect.color_detect(frame)
if detect_result is None:
cv2.imshow("figure", frame)
continue
else:
x, y = detect_result
# calculate real coord between cube and mycobot
real_x, real_y = detect.get_position(x, y)
if num == 20:
detect.pub_marker(real_sx/20.0/1000.0, real_sy/20.0/1000.0)
detect.decide_move(real_sx/20.0, real_sy/20.0, detect.color)
num = real_sx = real_sy = 0
else:
num += 1
real_sy += real_y
real_sx += real_x
我们的项目是开源的可以在GitHub上找到
在比较了视频和内容还有程序的代码,这三款机械臂的框架是一样的,只需要在数据上稍微作以修改就能够运行成功。
比较这三款机械臂有什么不同,大致有两点。
其一本质上就是来比较四轴和六轴的机械臂在实际的运用中有什么不同点。(myPalletizer 和mechArm/myCobot之间的对比)
我们来看一下四轴机械臂和六轴机械臂之间粗略的对比
从视频中可以看出,不论是四轴机械臂还是六轴机械臂在AI Kit 所工作的范围都是足够的,它们两者最大的区别就是在程序启动的过程中,myPalletizer的动作简单快捷,只有四个关节在运动,能够高效且稳定的执行任务;myCobot需要调动六个关节,比myPalletizer多两个关节,在程序中的计算量是比myPalletizer的计算量要大,所花费的时间要长一些(小型场景)。
我们简单总结一下,在场景固定的情况下,我们在考虑如何选择机械臂的时候可以优先考虑机械臂的工作范围。在符合工作范围的机械臂的情况下,高效和稳定将是必要的条件。假如说现在有一个工业场景类似于我们的AI kit的话,四轴机械臂将会是优先选择。当然六轴机械臂可以在更大的空间范围内操作,并且可以实现更复杂的运动。它们可以在空间内进行回转运动,而四轴机械臂则无法做到这一点。因此,六轴机械臂通常更适合用于需要精确操作、复杂运动的工业应用。
其二两款都是六轴机械臂,他们最主要的不同是结构的不同。mechArm是中心对称结构的机械臂,myCobot是UR结构的协作型机械臂。我们可以比较这两种结构在实际运用场景中有何不同。
这里是这两款机械臂的参数规格
这两者的结构不同导致了它们运动的范围不一样。以mechArm为例,中心对称结构的机械臂是由三对相对的关节组成的,每对关节的运动方向相反。这种结构的机械臂具有较好的平衡性,能够抵消关节间的力矩,使机械臂保持稳定。
在视频中展示,mechArm在运行中也是比较稳定的。
看到这你可能就会产生疑问,那myCobot不就一无是处了嘛?当然不是,UR结构的机械臂更加灵活,能够实现更大范围的运动,适用于较大的应用场合。myCobot更重要的一点它是协作型机械臂,它具有较好的人机交互能力,能够与人类协作进行工作。六轴协作型机械臂通常用于生产线上的物流和装配工作,以及医疗、研究和教育等领域。
就如开头所说,AI kit套装搭载三款机械臂的不同本质上是如何选择一款合适的机械臂来使用。如果你是出于某个特定的场景去选择机械臂的话,就需要根据场景的需求,例如确定机械臂的工作半径,使用的环境,机械臂的负载等方面。
如果你是想要学习机械臂相关知识的话,就可以选择一款目前市面上主流的机械臂从而开展学习。myPalletizer是以码垛机械臂为原型设计的,主要用于实现货物的码垛和托盘装卸工作;mechArm 是以主流的工业型机械臂为原型设计的,因为它的结构特殊在运行的时候可以保持机械臂的稳定;myCobot是以协作型机械臂为原型设计的,该结构是近年来热门的机械臂,能够与人类协同工作,可以提供人类的力量和精度。
以上就是本篇文章的全部内容了,未来,机械臂技术将继续发展,为人类生产、工作、生活带来更多的便利。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。