40823202 cd2021

  • Home
    • Site Map
    • reveal
    • blog
  • About
  • Develop
  • HW
    • W2~W4
      • 第一版
      • 第二版
      • ppt和影片
    • w6~w8
      • 模擬
      • 檔案下載
    • w9~w18
      • w10
      • W11
      • W12
      • W13
      • W14
      • W15
      • W16
      • w17
  • W5
  • 問題
    • 救回commit
    • 沒辦法開python
    • PUSH 不了
  • 筆記
    • 協同推送
    • CoppeliaSim基本操作
W14 << Previous Next >> W16

W15

1程式:

function sysCall_init()
    -- do some initialization here
    joint=sim.getObjectHandle('joint')
end
function sysCall_actuation()
    -- put your actuation code here
    sim.setJointTargetPosition(joint,30*math.pi/180)
end

2程式:

function sysCall_init()
    -- do some initialization here
    joint=sim.getObjectHandle('joint')
    set=0
    degset=10
end
  
function sysCall_actuation()
    -- put your actuation code here
    message,auxiliaryData=sim.getSimulatorMessage()
    while message~=-1 do
        if (message==sim.message_keypress) then
            if (auxiliaryData[1]==97) then
            set1=set+degset
            sim.setJointTargetPosition(joint,set1*math.pi/180)
            end
            if (auxiliaryData[1]==100) then
            set2=set-degset
            sim.setJointTargetPosition(joint,set2*math.pi/180)
            end
            if (auxiliaryData[1]==119) then
                degset=degset+10
                print(degset)
            end
            if (auxiliaryData[1]==115) then
                degset=degset-10
                if(degset<1) then
                    degset=1
                end
                print(degset)
            end
        end
    message,auxiliaryData=sim.getSimulatorMessage()
    end
end




W14 << Previous Next >> W16

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