simsetIntegerSignaloccupy21 simsetJointTargetVelocityleftmotor0 simsetJointTargetVelocityrightmotor0 simsetIntegerSignalarrive21 simwaitForSignalfinish2 simclearIntegerSignalfinish2
sim.setIntegerSignal('occupy2',1):设置整数信号"occupy2"的值为1。sim.setJointTargetVelocity(leftmotor,0):设置左电机的目标速度为0。sim.setJointTargetVelocity(rightmotor,0):设置右电机的目标速度为0。sim.setIntegerSignal('arrive2',1):设置整数信号"arrive2"的值为1。sim.waitForSignal('finish2'):等待信号"finish2"的到来。sim.clearIntegerSignal('finish2'):清除整数信号"finish2"。while true do:无限循环。if(sim.getIntegerSignal('occupy3')==nil) then:如果整数信号"occupy3"的值为nil(空),则执行以下语句。break:跳出循环。sim.clearIntegerSignal('occupy2'):清除整数信号"occupy2"。flag={0,1,0,0,0,0,0,0}:定义一个名为flag的数组,包含8个元素,分别为0、1、0、0、0、0、0、0
原文地址: https://www.cveoy.top/t/topic/hJCX 著作权归作者所有。请勿转载和采集!