stage3-bg1

  • Home
    • Site Map
    • reveal
    • blog
  • About
  • 小組作業
    • W9 統整各組資料
    • W10 stage3討論
      • ipv4操作
      • task1測試
    • W11 OBS使用教學
    • W12 上課直播
    • W13 Gitlab建立
      • gitlab-ssh
    • W14 robotDK測試
    • W15 影片翻譯
    • W16 取分項目
  • Gogs建立教學
    • fossil
  • TASK2測試區
    • 整體生產線
    • 掃地機器人
    • 分球機
    • 堆高機
    • 夾爪機構
    • 遊樂設施
  • 小組影片
  • 直播影片
掃地機器人 << Previous Next >> 堆高機

分球機

分球機模擬檔

測試人員:40823208     日期:2021/05/04

利用remoteApi控制stage1小組作業(分球機)旋轉軸速度

第一版

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sim as vrep
import math
import random
import time
  
print ('Start')
  
# Close eventual old connections
vrep.simxFinish(-1)
# Connect to V-REP remote server
clientID = vrep.simxStart('172.20.10.2', 19997, True, True, 5000, 5)
if clientID !=-1:
    print ('Connected to remote API server')
  
    res = vrep.simxAddStatusbarMessage(
        clientID, "40823208",
        vrep.simx_opmode_oneshot)
         
    if res not in (vrep.simx_return_ok, vrep.simx_return_novalue_flag):
        print("Could not add a message to the status bar.")
         
    opmode = vrep.simx_opmode_oneshot_wait
    vrep.simxStartSimulation(clientID, opmode)
    ret, wristHandle = vrep.simxGetObjectHandle(clientID, "joint",opmode)
     
    vrep.simxSetJointTargetVelocity(clientID,wristHandle,5,opmode)
     
else:
    print ('Failed connecting to  remote API server')
print ('End')

日期:2021/05/12

新增鍵盤控制分球機轉速

第二版

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import sim as vrep
import math
import random
import time
import keyboard
 
print ('Start')
  
# Close eventual old connections
vrep.simxFinish(-1)
# Connect to V-REP remote server
clientID = vrep.simxStart('192.168.1.83', 19997, True, True, 5000, 5)
if clientID !=-1:
    print ('Connected to remote API server')
  
    res = vrep.simxAddStatusbarMessage(
        clientID, "40823208",
        vrep.simx_opmode_oneshot)
         
    if res not in (vrep.simx_return_ok, vrep.simx_return_novalue_flag):
        print("Could not add a message to the status bar.")
         
    opmode = vrep.simx_opmode_oneshot_wait
    vrep.simxStartSimulation(clientID, opmode)
    ret, wristHandle = vrep.simxGetObjectHandle(clientID, "joint",opmode)
while True:
     if keyboard.is_pressed("Q"):
            print("Velocity=5")
            vrep.simxSetJointTargetVelocity(clientID,wristHandle,5,opmode)
            #Q可以讓轉速=5
     if keyboard.is_pressed("W"):
            print("Velocity=10")
            vrep.simxSetJointTargetVelocity(clientID,wristHandle,10,opmode)
            #W可以讓轉速=10
     if keyboard.is_pressed("E"):
            print("Velocity=0")
            vrep.simxSetJointTargetVelocity(clientID,wristHandle,0,opmode)      
            #E可以讓轉速=0
else:
    print ('Failed connecting to  remote API server')
print ('End')

掃地機器人 << Previous Next >> 堆高機

Copyright © All rights reserved | This template is made with by Colorlib