40823242 cd2021

  • Home
    • Site Map
    • reveal
    • blog
  • stage1
    • About(兩人)
    • 每周進度-1
      • W1
      • W2
      • W3
      • W4
      • PDF報告
    • 初稿零件及模擬
    • 成品零件及模擬
    • 四人小組願景
  • stage2-1
    • About(四人)
    • 每周進度-2
      • 專題動機
      • W5.
      • W6-7
      • W8
      • W9
      • PDF專題報告
    • Solidworks 模擬
    • Inventor 模擬
    • 應力分析
  • stage3
    • About(八人)
    • 每周進度-3
      • W10
      • W11
      • W12
      • W13
      • W14
      • W15
      • W16
      • W17
    • 直播影片
    • task1
    • task2
      • stag1
      • stage2-2
  • RoboDK
  • 筆記
    • 開啟動態(9443)
    • 上傳
    • Proxy 設定
  • W5
stag1 << Previous Next >> RoboDK

stage2-2

stage2-bg12

stage2-bg14

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.50.217', 19997, True, True, 5000, 5)
  
if clientID !=-1:
    print ('Connected to remote API server')
   
    res = vrep.simxAddStatusbarMessage(
        clientID, "40823204",
        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
    STREAMING = vrep.simx_opmode_streaming
     
    vrep.simxStartSimulation(clientID, opmode)
    
    
    ret,fwheel_handle=vrep.simxGetObjectHandle(clientID,"joint0",opmode)
    ret,bwheel_handle=vrep.simxGetObjectHandle(clientID,"joint2",opmode)
    ret,pole1_handle=vrep.simxGetObjectHandle(clientID,"joint3",opmode)
    ret,pole2_handle=vrep.simxGetObjectHandle(clientID,"joint4",opmode)
    ds=0
    dy=0
    df=0
    db=0
    vrep.simxSetJointTargetPosition(clientID,fwheel_handle,df,opmode)
    vrep.simxSetJointTargetPosition(clientID,bwheel_handle,db,opmode)
    vrep.simxSetJointTargetPosition(clientID,pole1_handle,ds,opmode)
    vrep.simxSetJointTargetPosition(clientID,pole2_handle,dy,opmode)
    
    
    while True:
        #Clockwise
        if keyboard.is_pressed("2"):
            ds=ds-0.01
            dy=dy-0.01
            vrep.simxSetJointTargetPosition(clientID,pole1_handle,ds,opmode)
            vrep.simxSetJointTargetPosition(clientID,pole2_handle,dy,opmode)
            print("up")
        if keyboard.is_pressed("4"):
            ds=ds+0.01
            dy=dy+0.01
            vrep.simxSetJointTargetPosition(clientID,pole1_handle,ds,opmode)
            vrep.simxSetJointTargetPosition(clientID,pole2_handle,dy,opmode)
            print("down")
        if keyboard.is_pressed("6"):
            df=df+0.2
            db=db+0.2
            vrep.simxSetJointTargetPosition(clientID,fwheel_handle,df,opmode)
            vrep.simxSetJointTargetPosition(clientID,bwheel_handle,db,opmode)
            print("left")
        if keyboard.is_pressed("8"):
            df=df-0.2
            db=db-0.2
            vrep.simxSetJointTargetPosition(clientID,fwheel_handle,df,opmode)
            vrep.simxSetJointTargetPosition(clientID,bwheel_handle,db,opmode)
            print("right")


             
else:
    print ('Failed connecting to  remote API server')
    print ('End')

各組員的模擬檔:

28、42-2842模擬

控制方式:

QA上下 Z停止
WS後輪正反轉 X停止
ED前輪正反轉 C停止

前正後反 左轉
前反後正 右轉

37-37模擬

控制方式:

上下控制角度 左右控制前後

4-04模擬

控制方式:

同上37

進度:coppelia模擬+lua控制

成果:他可以用方件來控制動作

接下來就會讓產品來攀爬各種地形


stag1 << Previous Next >> RoboDK

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