task1 <<
Previous Next >> W11
task2-1
將個人在 stage1 與 stage2 所完成的 coppeliasim 場景, 採 Python remote API 進行操控.
Python remote API程式:
import sim as vrep
import sys
# child threaded script:
#simExtRemoteApiStart(19997)
vrep.simxFinish(-1)
clientID = vrep.simxStart('192.168.50.154', 19997, True, True, 5000, 5)
if clientID!= -1:
print("Connected to remote server")
else:
print('Connection not successful')
sys.exit('Could not connect')
errorCode,U_motor_handle=vrep.simxGetObjectHandle(clientID,'U',vrep.simx_opmode_oneshot_wait)
errorCode,D_motor_handle=vrep.simxGetObjectHandle(clientID,'D',vrep.simx_opmode_oneshot_wait)
if errorCode == -1:
print('Can not find U or D motor')
sys.exit()
errorCode=vrep.simxSetJointTargetVelocity(clientID,U_motor_handle,0, vrep.simx_opmode_oneshot_wait)
errorCode=vrep.simxSetJointTargetVelocity(clientID,D_motor_handle,0, vrep.simx_opmode_oneshot_wait)
task1 <<
Previous Next >> W11