40823203 cd2021

  • Home
    • Site Map
    • reveal
    • blog
  • About
  • Develop
  • STAGE1
    • W2-W3
    • W4
  • 問題
    • 問題1
  • W5
    • 乙班協同影片
    • BG12影片
  • STAGE2
    • W6-W8
    • W9
  • STAGE3
    • 組別分工
    • W10
      • task1
      • task2
    • W12
    • W13
      • gitlab
    • W15
      • fossil
  • W16
    • Onshape 零組件繪製
    • CoppeliaSim 4.1.0 MTB robot 場景
    • 手臂末端加入 components-gripper-suction pad 吸盤
      • 鍵盤控制
    • Python remote API 逆向運動學函式
    • 逆向運動學函式
手臂末端加入 components-gripper-suction pad 吸盤 << Previous Next >> Python remote API 逆向運動學函式

鍵盤控制

我設定a(代碼97)為joint1往左向,d(代碼100)為joint1往右向

q(代碼113)為joint2往左向,e(代碼101)為joint1往左向

往上方向鍵(代碼2007)為jointz往上方

往下方向鍵(代碼2008)為jointz往下方

空白鍵(代碼32)為放開

影片連結:

function sysCall_init()
    joint01=sim.getObjectHandle('joint1')
    joint02=sim.getObjectHandle('joint2')
    joint03=sim.getObjectHandle('joint3')
    jointz=sim.getObjectHandle('jointz')
    sim.setJointTargetPosition(joint01,0)
    sim.setJointTargetPosition(joint02,0)
    sim.setJointTargetPosition(joint03,0)
    sim.setJointTargetPosition(jointz,0)
    deg1=0
    deg2=0
end
function sysCall_actuation()
     message,auxiliaryData=sim.getSimulatorMessage()
    while message~=-1 do
        if (message==sim.message_keypress) then
            if (auxiliaryData[1]==97) then
            deg1=deg1+1
            sim.setJointTargetPosition(joint01,deg1*math.pi/180)
            end
            if (auxiliaryData[1]==100) then
            deg1=deg1-1
            sim.setJointTargetPosition(joint01,deg1*math.pi/180)
            end
            if (auxiliaryData[1]==113) then
            deg2=deg2+1
            sim.setJointTargetPosition(joint02,deg2*math.pi/180)
            end
            if (auxiliaryData[1]==101) then
            deg2=deg2-1
            sim.setJointTargetPosition(joint02,deg2*math.pi/180)
            end
            if (auxiliaryData[1]==2008 ) then
                sim.setJointTargetPosition(jointz,-0.039)
                sim.setIntegerSignal("pad_switch",1)
            end
            if (auxiliaryData[1]==2007 ) then
                sim.setJointTargetPosition(jointz,0)
                sim.setIntegerSignal("pad_switch",1)
            end
            if (auxiliaryData[1]==32) then
                sim.setIntegerSignal("pad_switch",0)
            end
            sim.setJointTargetPosition(joint03,(deg2-deg1)*math.pi/180)    
        end
    message,auxiliaryData=sim.getSimulatorMessage()
    end
end




手臂末端加入 components-gripper-suction pad 吸盤 << Previous Next >> Python remote API 逆向運動學函式

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