TASK2測試區 <<
Previous Next >> 掃地機器人
整體生產線
測試人員:40823246
日期:20210505
新增控制插鏟功能

日期:20210506
新增控制推高機前後左右功能

日期:20210512
巡路小車
日期:20210513
凸輪stage2,爬不上去,待改善
日期:20210514
來回走直線
日期:20210520
堆高機搬運測試A to B
日期:20210524
內容:將機械手臂改成改成一鍵往前 > 抓取 >往後 >放開,增加抓取成功機率。
主要程式碼:
1
2
3
4
5
6
7
8
9
10
11
|
if keyboard.is_pressed( "t" ):
print ( "You pressed t" )
vrep.simxSetJointTargetPosition(clientID,vertical_handle, 0.5 ,opmode)
time.sleep( 0.5 )
vrep.simxSetJointTargetPosition(clientID,cam_handle,angle * 90 ,opmode)
time.sleep( 0.5 )
vrep.simxSetJointTargetPosition(clientID,vertical_handle, 0.1 ,opmode)
time.sleep( 5 )
vrep.simxSetJointTargetPosition(clientID,cam_handle,angle * 0 ,opmode)
|
日期:20210604
加入rgb偵測啟動夾爪。
downloads
主要程式碼:
#rgb辨識-----
returnCode,resolution,image=vrep.simxGetVisionSensorImage(clientID,vision_handle,0,opmode)#取得圖片
color = np.asarray(image)#將圖片數據轉成矩陣形式
color.shape = (resolution[1], resolution[0], 3)
color = color.astype(np.float)#-1~1
color[color < 0] += 255
color = np.fliplr(color)#因為得到得圖片數據是上下左右顛倒的,所以要將數據在顛倒一次才能轉正
color = color.astype(np.uint8)#0~255
rgb=color[1]
rgb2=rgb[1]
print(rgb2)
rgb3=[139,139,163]#掃地機器人的顏色
rgb4=[0,0,147]
#rgb辨識-----
#夾爪程式(rgb作動)-----
if all(rgb2==rgb3):
vrep.simxSetJointTargetPosition(clientID,vertical_handle,0.5,opmode)
time.sleep(0.5)
vrep.simxSetJointTargetPosition(clientID,cam_handle,angle*90,opmode)
time.sleep(0.5)
vrep.simxSetJointTargetPosition(clientID,vertical_handle,0.1,opmode)
time.sleep(5)
vrep.simxSetJointTargetPosition(clientID,cam_handle,angle*0,opmode)
#夾爪程式(rgb作動)-----
日期:20210618
更新RGB辨識程式,因為每個產品顏色多少有一點點的差異,所以把條件設置在一定範圍內。
#rgb辨識-----
returnCode,resolution,image=vrep.simxGetVisionSensorImage(clientID,vision_handle,0,opmode)#取得圖片
color = np.asarray(image)#將圖片數據轉成矩陣形式
color.shape = (resolution[1], resolution[0], 3)
color = color.astype(np.float)#-1~1
color[color < 0] += 255
color = np.fliplr(color)#因為得到得圖片數據是上下左右顛倒的,所以要將數據在顛倒一次才能轉正
color = color.astype(np.uint8)#0~255
rgb=color[1]
rgb2=rgb[1]
r=rgb2[0]
g=rgb2[1]
b=rgb2[2]
print(rgb2)
rgb3=[139,139,163]#掃地機器人的顏色
rgb4=[0,0,147]
#rgb辨識-----
#夾爪程式(rgb作動)-----
if 167>b>161 and 142>r>136 and 142>g>136:#設置一定範圍
vrep.simxSetJointTargetPosition(clientID,vertical_handle,0.5,opmode)
time.sleep(0.5)
vrep.simxSetJointTargetPosition(clientID,cam_handle,angle*90,opmode)
time.sleep(0.5)
vrep.simxSetJointTargetPosition(clientID,vertical_handle,0.1,opmode)
time.sleep(5)
vrep.simxSetJointTargetPosition(clientID,cam_handle,angle*0,opmode)
#夾爪程式(rgb作動)-----
檔案下載
TASK2測試區 <<
Previous Next >> 掃地機器人