W15 <<
Previous Next >> MTB_robot_pick_and_place delete GUI
MTB_robot_pick_and_place
觀摩老師的程式,做出鍵盤控制轉動的機構。
ttt
function sysCall_init()
-- do some initialization here
axis1=sim.getObjectHandle('MTB_axis1')
axis1=sim.getObjectHandle('MTB_axis1')
rotation1 = 0
deg = math.pi/180
--sim.sJointTargetVelocity(joint,5.5)
end
function sysCall_actuation()
message,auxiliaryData=sim.getSimulatorMessage()
if (message==sim.message_keypress) then
if (auxiliaryData[1]==2010) then
rotation1 = rotation1 + 5*deg
sim.setJointPosition(axis1, rotation1)
end
if (auxiliaryData[1]==2009) then
rotation1 = rotation1 - 5*deg
sim.setJointPosition(axis1, rotation1)
end
if (auxiliaryData[1]==2008) then
sim.setJointTargetVelocity(joint,1)
end
end
end
function sysCall_sensing()
-- put your sensing code here
end
function sysCall_cleanup()
-- do some clean-up here
end
-- See the user manual or the available code snippets for additional callback functions and details
W15 <<
Previous Next >> MTB_robot_pick_and_place delete GUI