40823235

  • Home
    • Site Map
    • reveal
    • blog
  • About
  • stage1-bg2
    • 圖檔
    • w2
    • w4
    • 問題與討論
  • stage2-bg2
    • W5
    • 問題
    • 凸輪繪製
    • W7
      • 模擬一
      • 模擬二
    • W8
      • 模擬三
    • W9
  • stage3-bg1
    • TASK1
    • TASK2
      • 分球機
      • 夾爪
      • 掃地機器人
  • W15
    • 影片一
    • 影片二
  • W16
    • coppelisim
    • onshape
  • 期末報告
TASK2 << Previous Next >> 夾爪

分球機

測試人員:40823208    

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')


TASK2 << Previous Next >> 夾爪

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