40823131 cd2021

  • Home
    • Site Map
    • reveal
    • blog
  • about
  • Stage1
    • W1
      • 建立網頁
      • Blog建立
    • W2
      • 分組(二人專案小組)
      • 利用Hamachi建立虛擬區域網路
      • 利用虛擬主機建立Ethercalc伺服器
    • W3
      • 初代機(version 1.0.0) ฅ^•ω•^ฅ
      • 貳代機(version 2.0.0) ^ↀᴥↀ^
      • 参代機(version 3.0.0) ଲ(^ⓛ ω ⓛ^)ଲ
      • 肆代機(version 4.0.0) V(=^・ω・^=)v
    • W4
      • 利用程式方法更改影片檔名
  • Stage2
    • W5
      • 分組組員
    • W6
      • Heroku小組網站
      • 運輸小車繪製
    • W7
      • push more easily
      • 程式控制
    • W8
      • 使用鍵盤程式控制小車移動
    • W9
      • 成果(自動化生產線速率程式控制小車ver.)
      • 成果(自動化生產線鍵盤程式控制小車ver.)
      • 心得
  • Stage3
    • W10
      • task1
      • task2-1
    • W11
      • task2-2
    • W12
      • 直播教學影片
    • W13
      • task3-About OBS setting videos
      • Use aegisub to edit and generate subtitles
    • Final專案進度
  • W14
    • 使用QT based GUI介面改寫 legacy GUI介面
    • 改用 CoppeliaSim 制式的 Lua Script 編寫與原先取放方塊零件相同的操控流程
  • Basic teaching
    • Create SSH KEY
    • Setting up putty for ssh
    • Use Leo Editor to create a web blog
    • Android phone camera instead of webcam teaching
  • W15
  • W16
  • Github帳號解除Flagged過程分享
  • Python grammar sort out
W11 << Previous Next >> W12

task2-2

利用Python Remote API,控制機械手臂。

程式:

import sim as vrep
import sys
import math
# 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')

vrep.simxStartSimulation(clientID, vrep.simx_opmode_oneshot)

RC1, UR5_joint1_Handle = vrep.simxGetObjectHandle(clientID, 'Dobot_motor1', vrep.simx_opmode_blocking)
RC2, UR5_joint2_Handle = vrep.simxGetObjectHandle(clientID, 'Dobot_motor2', vrep.simx_opmode_blocking)
RC3, UR5_joint3_Handle = vrep.simxGetObjectHandle(clientID, 'Dobot_motor3', vrep.simx_opmode_blocking)
RC4, UR5_joint4_Handle = vrep.simxGetObjectHandle(clientID, 'Dobot_motor4', vrep.simx_opmode_blocking)

vrep.simxSetJointTargetPosition(clientID,UR5_joint1_Handle,0*math.pi/180,vrep.simx_opmode_oneshot)
vrep.simxSetJointTargetPosition(clientID,UR5_joint2_Handle,0*math.pi/180,vrep.simx_opmode_oneshot)
vrep.simxSetJointTargetPosition(clientID,UR5_joint3_Handle,0*math.pi/180,vrep.simx_opmode_oneshot)
vrep.simxSetJointTargetPosition(clientID,UR5_joint4_Handle,0*math.pi/180,vrep.simx_opmode_oneshot)

影片:


W11 << Previous Next >> W12

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