40823122

  • Home
    • Site Map
    • reveal
    • blog
  • stage1-ag13
    • w2
      • 網頁建立以及偕同修改
    • w3
      • 分組網站
      • 產品
    • w4
    • w5
  • stage2-ag7
    • w6
    • w7
      • 整合分組網頁
      • v-rep模擬
  • w8
  • stage3-ag6
    • w10
      • task1
      • task2
    • w13
    • w14
    • w15
      • MTB_robort
      • 字幕整理
    • w16
      • 成果
    • w17
      • 籃框移動控制
      • 程式
      • 導入w16的機械手臂
    • w18
task1 << Previous Next >> w13

task2

bubble

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,left_motor_handle=vrep.simxGetObjectHandle(clientID,'bubbleRob_leftMotor',vrep.simx_opmode_oneshot_wait)
 
errorCode,right_motor_handle=vrep.simxGetObjectHandle(clientID,'bubbleRob_rightMotor',vrep.simx_opmode_oneshot_wait)
 
if errorCode == -1:
    print('Can not find left or right motor')
    sys.exit()
 
errorCode=vrep.simxSetJointTargetVelocity(clientID,left_motor_handle,10, vrep.simx_opmode_oneshot_wait)
errorCode=vrep.simxSetJointTargetVelocity(clientID,right_motor_handle,30, vrep.simx_opmode_oneshot_wait)

下列兩行為左右輪的轉數

STAGE1   API

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,main_handle=vrep.simxGetObjectHandle(clientID,'main',vrep.simx_opmode_oneshot_wait)

 
if errorCode == -1:
    print('Can not find main')
    sys.exit()
 
errorCode=vrep.simxSetJointTargetVelocity(clientID,main_handle,10, vrep.simx_opmode_oneshot_wait)


模擬情況

STAGE2   API

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,main01_handle=vrep.simxGetObjectHandle(clientID,'main01',vrep.simx_opmode_oneshot_wait)

 
if errorCode == -1:
    print('Can not find main01')
    sys.exit()
 
errorCode=vrep.simxSetJointTargetVelocity(clientID,main01_handle,10, vrep.simx_opmode_oneshot_wait)


模擬情況


task1 << Previous Next >> w13

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