NFU-MDE-40823108-KAO,YU-CHE-cd2021

  • Home
    • Site Map
    • reveal
    • blog
  • Introduction
  • KMOLab basis
    • Cmsimde create
    • Python program
    • SSH key produce
    • SSH putty settings
    • Leo Edit Blog
    • Leo Edit Reveal
    • Synergy
  • Coppeliasim basic
    • Import objects
    • Divide object
    • Appearance setting
    • Joint settings
    • Orchestration objects
    • Proximity sensor
  • Midterm
    • W1
    • W2
    • W3
      • work
    • W4
    • W5
    • W6
    • W7
    • W8
    • W9
  • Final
    • W10-task1
    • W11-task2
    • W12-task3
    • W13
    • W14
    • W15
    • W16
    • W17
    • W18
  • Stage1-ag1
  • Stage2-ag1
  • Stage3-ag1
  • phone webcam
    • ios for Webcam
    • Android for Webcam
  • Github sever issue
W4 << Previous Next >> W6

W5

第五週分組專案開始,分組以第一次分組兩兩合併為主。

組別為:stage2-ag1

組員:

40823108-cd2021

40823109-cd2021

40823112-cd2021

40823145-cd2021

本次專案沿用stage1-ag1之專案,為了讓模型能夠按照我們的意思做動,我們嘗試編寫Lua程式並以方向鍵進行控制。

下方為第一次測試程式與模擬圖

Lua程式:

threadFunction=function()
    -- put your actuation code here
 while sim.getSimulationState()~=sim.simulation_advancing_abouttostop do
    -- Read the keyboard messages (make sure the focus is on the main window, scene view):
        message,auxiliaryData=sim.getSimulatorMessage()
        while message~=-1 do
            if (message==sim.message_keypress) then
if (auxiliaryData[1]==2007) then
                -- up key
                velocity=1000
                torque=10000
                Shape4 = 1000
                Shape7 = 1000
            end
            if (auxiliaryData[1]==2008) then
                -- down key
                velocity=1000
                torque=10000
                Shape4 = 1000
                Shape7 = 1000
            end
            if (auxiliaryData[1]==2009) then
                -- left key
                velocity=1000
                torque=10000
                Shape4 = 1000
                Shape7 = 1000
            end
            if (auxiliaryData[1]==2010) then
                -- right key
                velocity=1000
                torque=10000
                Shape4 = 1000
                Shape7 = 1000
            end
        end
        message,auxiliaryData=sim.getSimulatorMessage()
    end
    if Shape4 == 1
        then sim.setJointPosition(joint_1, 1000, orientation)
    if Shape7 == 1
        then sim.setJointPosition(joint_2, 1000, orientation)
    end
        sim.setJointTargetVelocity(joint,velocity)
    end
        joint_1=sim.getObjectHandle('joint_1')
        joint_2=sim.getObjectHandle('joint_2')
        Shape4=sim.getObjectHandle('Shape4')
        Shape7=sim.getObjectHandle('Shape7')
        velocity=0
        torque=0
        Shape4 = 0
        Shape7 = 0
end

因部分語法有誤,日後待除錯。


W4 << Previous Next >> W6

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