40823136

  • Home
    • Site Map
    • reveal
    • blog
  • First
  • About
  • stage1
    • w1
      • 建立網頁
      • 編輯leo
    • w2
      • 討論與影片
      • 圖檔
    • w3
      • 投石機(1)
      • 投石機(2)
      • 投石機(3)
      • 簡報-1
  • stage2
    • w5
      • stage2組員
    • w6
      • heroku
      • 選訂題目
    • w7
      • 自動化生產線(1)-用程式控制機械手臂與調整
    • w8
      • 自動化生產線(2)
    • w9
      • 自動化生產線(3)最終版
    • 簡報-2
  • stage3
    • w10
      • task1
      • task2-1
      • task2-2-python Remote API程式控制機械手臂
      • task2-3
    • w13
      • 第一組線上直播
      • RoboDK
    • w15
      • Video and subtitle translation-1
      • Video and subtitle translation-2
    • w16
      • Onshape 零組件繪製
      • 建立 CoppeliaSim 4.1.0 MTB robot 場景
      • 手臂末端加入 components-gripper-suction pad 吸盤跟鍵盤控制
      • 逆向運動學函式-鍵盤控制與程式迴圈方式
      • Python remote API 逆向運動學函式
  • stage3 專案
    • 自動化(1)
    • 自動化(2)
    • 自動化(3)
    • 心得
  • W18
    • 期末影片
task1 << Previous Next >> task2-2-python Remote API程式控制機械手臂

task2-1

import sim as vrep
import sys
# child threaded script: 
#simExtRemoteApiStart(19999)
 
vrep.simxFinish(-1)
 
clientID = vrep.simxStart('127.0.0.1', 19999, True, True, 5000, 5)
 
if clientID!= -1:
    print("Connected to remote server")
else:
    print('Connection not successful')
    sys.exit('Could not connect')
 
errorCode, handle1=vrep.simxGetObjectHandle(clientID,'cd1',vrep.simx_opmode_oneshot_wait)
error_Code,handle2=vrep.simxGetObjectHandle(clientID,'cd2',vrep.simx_opmode_oneshot_wait) 
errorCode,handle3=vrep.simxGetObjectHandle(clientID,'cd3',vrep.simx_opmode_oneshot_wait)
errorCode,handle4=vrep .simxGetObjectHandle(clientID,'cd4',vrep.simx_opmode_oneshot_wait)
errorCode,handle5=vrep.simxGetObjectHandle(clientID,'cd5',vrep.simx_opmode_oneshot_wait)

if errorCode == -1:
    print('Can not find left or right motor')
    sys.exit()
 
errorCode=vrep.simxSetJointTargetVelocity(clientID,handle1,1, vrep.simx_opmode_oneshot_wait)
errorCode=vrep.simxSetJointTargetVelocity(clientID,handle2,0, vrep.simx_opmode_oneshot_wait)
errorCode=vrep.simxSetJointTargetVelocity(clientID,handle3,1, vrep.simx_opmode_oneshot_wait)
errorCode=vrep.simxSetJointTargetVelocity(clientID,handle4,0, vrep.simx_opmode_oneshot_wait)
errorCode=vrep.simxSetJointTargetVelocity(clientID,handle5,0.02, vrep.simx_opmode_oneshot_wait)

task1 << Previous Next >> task2-2-python Remote API程式控制機械手臂

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