stage3-bg2

  • Home
    • Site Map
    • reveal
    • blog
  • about
  • stage1
    • stage1-bg3
    • stage1-bg9
      • bg9設計概念
      • bg9設計草圖
      • bg9產品展示
    • stage1-bg13
      • bg13設計概念
      • bg13設計草圖
      • bg13產品展示
    • stage1-bg18
      • bg18零件組合圖
      • bg18組合零件爆炸
      • bg18Invnetor模擬
      • bg18產品報告
      • bg18PDF
      • bg18報告
  • stage2
    • stage2-bg3
      • bg3-模擬結果
      • bg3-PDF檔案
      • bg3-參考資料
      • bg3-圖檔
      • bg3-討論
    • stage2-bg11
      • bg11模擬結果
  • stage3
    • W9 網頁操作
      • ipv4操作
      • task1測試
      • 範例task2
      • task3
    • W10 討論主題
    • W11 直播處理
    • W12 使用remote api
    • W13 小組遠距討論
    • W14 stage3進度
    • W15 stage3進度
    • W15 MTB Robot 練習
    • W16
    • W17
    • W18
  • task2
    • S1-B18
    • S2-B11
  • 直播影片
  • Youtube影片
  • 筆記
    • 更新網站
    • reveal的頁面問題
    • coppeliasim 教學
    • CoppeliaSim碰撞&動態
    • CoppeliaSim物體顏色、透明度
    • 當git pull有狀況時該如何解決
    • SSH快速版(簡單化)
    • 如何開啟leo及reveal
    • OBS黑頻問題
S1-B18 << Previous Next >> 直播影片

S2-B11

本人是stage2-bg11成員

stage2 所完成的 coppeliasim 場景, 採 Python remote API 進行操控。

----------

(按鍵指令)

1~9..........控制螺旋鉤子
"空白建".....停止螺旋鉤子
Z............關門
X............暫停開/關門
C............開門
O............控制滾輪
W............平台上升
E............暫停平台
S............下降平台
esc..........結束

◾實際操作影片

----------
(程式碼)

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.0.12', 19997, True, True, 5000, 5)

if clientID != -1:
    print ('Connected to remote API server')
    
    res = vrep.simxAddStatusbarMessage(
        clientID, "40823210",
        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,DOOR_handle=vrep.simxGetObjectHandle(clientID,"joint4",opmode)
    ret,C1_handle=vrep.simxGetObjectHandle(clientID,"joint2",opmode)
    ret,B1_handle=vrep.simxGetObjectHandle(clientID,"joint1",opmode)
    ret,SP5_handle=vrep.simxGetObjectHandle(clientID,"joint",opmode)
    ret,S1_1_handle=vrep.simxGetObjectHandle(clientID,"S1_1",opmode)
    ret,S2_1_handle=vrep.simxGetObjectHandle(clientID,"S2_1",opmode)
    ret,S3_1_handle=vrep.simxGetObjectHandle(clientID,"S3_1",opmode)
    ret,S4_1_handle=vrep.simxGetObjectHandle(clientID,"S4_1",opmode)
    ret,S5_1_handle=vrep.simxGetObjectHandle(clientID,"S5_1",opmode)
    ret,S6_1_handle=vrep.simxGetObjectHandle(clientID,"S6_1",opmode)
    ret,S7_1_handle=vrep.simxGetObjectHandle(clientID,"S7_1",opmode)
    ret,S8_1_handle=vrep.simxGetObjectHandle(clientID,"S8_1",opmode)
    ret,S9_1_handle=vrep.simxGetObjectHandle(clientID,"S9_1",opmode)
    ret,S10_1_handle=vrep.simxGetObjectHandle(clientID,"S10_1",opmode)
    #ret,main = vrep.simxGetObjectHandle(clientID, "main", opmode)
    while True:
    
        #keyboard "5" 
        if keyboard.is_pressed("5"):
            vrep.simxSetJointTargetVelocity(clientID,SP5_handle,1,opmode)
        
        #keyboard "space" 
        if keyboard.is_pressed("space"):
            vrep.simxSetJointTargetVelocity(clientID,SP5_handle,0,opmode)
        #keyboard "O" 
        if keyboard.is_pressed("O"):
            vrep.simxSetJointTargetVelocity(clientID,S1_1_handle,100,opmode)
            vrep.simxSetJointTargetVelocity(clientID,S2_1_handle,100,opmode)
            vrep.simxSetJointTargetVelocity(clientID,S3_1_handle,100,opmode)
            vrep.simxSetJointTargetVelocity(clientID,S4_1_handle,100,opmode)
            vrep.simxSetJointTargetVelocity(clientID,S5_1_handle,100,opmode)
            vrep.simxSetJointTargetVelocity(clientID,S6_1_handle,100,opmode)
            vrep.simxSetJointTargetVelocity(clientID,S7_1_handle,100,opmode)
            vrep.simxSetJointTargetVelocity(clientID,S8_1_handle,100,opmode)
            vrep.simxSetJointTargetVelocity(clientID,S9_1_handle,100,opmode)
            vrep.simxSetJointTargetVelocity(clientID,S10_1_handle,100,opmode)
        #keyboard "W" 
        if keyboard.is_pressed("W"):
            vrep.simxSetJointTargetVelocity(clientID,C1_handle,1,opmode)
            vrep.simxSetJointTargetVelocity(clientID,B1_handle,2,opmode)
         #keyboard "E" 
        if keyboard.is_pressed("E"):
            vrep.simxSetJointTargetVelocity(clientID,C1_handle,0,opmode)
            vrep.simxSetJointTargetVelocity(clientID,B1_handle,0,opmode)   
        #keyboard "S" 
        if keyboard.is_pressed("S"):
            vrep.simxSetJointTargetVelocity(clientID,C1_handle,-1,opmode)
            vrep.simxSetJointTargetVelocity(clientID,B1_handle,-2,opmode)
        #keyboard "Z" 
        if keyboard.is_pressed("Z"):
            vrep.simxSetJointTargetVelocity(clientID,DOOR_handle,1000,opmode)
       #keyboard "X" 
        if keyboard.is_pressed("X"):
            vrep.simxSetJointTargetVelocity(clientID,DOOR_handle,0,opmode)
        #keyboard "C" 
        if keyboard.is_pressed("C"):
            vrep.simxSetJointTargetVelocity(clientID,DOOR_handle,-1.5,opmode)              
        #keyboard "esc" 
        if  keyboard.is_pressed("esc"):
            vrep.simxStopSimulation(clientID, opmode)
            break
        
else:
    print ('Failed connecting to remote API server')
    print ('End')

---------

影片場景之ttt檔及其他相關檔案,可至本人的個人倉儲下載:

https://github.com/40823210/cd2021

(檔案位置:task2 ➝販賣機)


S1-B18 << Previous Next >> 直播影片

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