mirror of
https://github.com/elephantrobotics/mycobot_ros.git
synced 2026-07-14 09:00:53 +00:00
update aikit_shape.py
This commit is contained in:
parent
69912d2ceb
commit
768835570a
1 changed files with 4 additions and 13 deletions
|
|
@ -68,15 +68,6 @@ class Object_detect():
|
||||||
self.x1 = self.x2 = self.y1 = self.y2 = 0
|
self.x1 = self.x2 = self.y1 = self.y2 = 0
|
||||||
# set cache of real coord
|
# set cache of real coord
|
||||||
self.cache_x = self.cache_y = 0
|
self.cache_x = self.cache_y = 0
|
||||||
# set color HSV
|
|
||||||
self.HSV = {
|
|
||||||
# "yellow": [np.array([11, 85, 70]), np.array([59, 255, 245])],
|
|
||||||
"yellow": [np.array([22, 93, 0]), np.array([45, 255, 245])],
|
|
||||||
"red": [np.array([0, 43, 46]), np.array([8, 255, 255])],
|
|
||||||
"green": [np.array([35, 43, 35]), np.array([90, 255, 255])],
|
|
||||||
"blue": [np.array([100, 43, 46]), np.array([124, 255, 255])],
|
|
||||||
"cyan": [np.array([78, 43, 46]), np.array([99, 255, 255])],
|
|
||||||
}
|
|
||||||
|
|
||||||
# use to calculate coord between cube and mycobot
|
# use to calculate coord between cube and mycobot
|
||||||
self.sum_x1 = self.sum_x2 = self.sum_y2 = self.sum_y1 = 0
|
self.sum_x1 = self.sum_x2 = self.sum_y2 = self.sum_y1 = 0
|
||||||
|
|
@ -125,7 +116,7 @@ class Object_detect():
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
# send coordinates to move mycobot
|
# send coordinates to move mycobot
|
||||||
self.mc.send_coords([x, y, 190.6, 179.87, -3.78, -62.75], 25, 1) # usb :rx,ry,rz -173.3, -5.48, -57.9
|
self.mc.send_coords([x, y, 170.6, 179.87, -3.78, -62.75], 25, 1) # usb :rx,ry,rz -173.3, -5.48, -57.9
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
# self.mc.send_coords([x, y, 150, 179.87, -3.78, -62.75], 25, 0)
|
# self.mc.send_coords([x, y, 150, 179.87, -3.78, -62.75], 25, 0)
|
||||||
|
|
@ -151,7 +142,7 @@ class Object_detect():
|
||||||
|
|
||||||
# print(tmp)
|
# print(tmp)
|
||||||
self.mc.send_angles([tmp[0], -0.71, -54.49, -23.02, -0.79, tmp[5]],25) # [18.8, -7.91, -54.49, -23.02, -0.79, -14.76]
|
self.mc.send_angles([tmp[0], -0.71, -54.49, -23.02, -0.79, tmp[5]],25) # [18.8, -7.91, -54.49, -23.02, -0.79, -14.76]
|
||||||
time.sleep(2.5)
|
time.sleep(3)
|
||||||
|
|
||||||
self.mc.send_coords(self.move_coords[color], 25, 1)
|
self.mc.send_coords(self.move_coords[color], 25, 1)
|
||||||
|
|
||||||
|
|
@ -269,7 +260,7 @@ class Object_detect():
|
||||||
if self.x1 != self.x2:
|
if self.x1 != self.x2:
|
||||||
# the cutting ratio here is adjusted according to the actual situation
|
# the cutting ratio here is adjusted according to the actual situation
|
||||||
frame = frame[int(self.y2*0.78):int(self.y1*1.1),
|
frame = frame[int(self.y2*0.78):int(self.y1*1.1),
|
||||||
int(self.x1*0.88):int(self.x2*1.06)]
|
int(self.x1*0.86):int(self.x2*1.08)]
|
||||||
return frame
|
return frame
|
||||||
|
|
||||||
# 检测物体的形状
|
# 检测物体的形状
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue