Professional Documents
Culture Documents
Trabajo Semana 5
Trabajo Semana 5
function sysCall_actuation()
-- put your actuation code here
tiempoactual=sim.getSimulationTime()
if (((tiempoactual-tiempoanterior)>= 20) and (cantidadProductos<16)) then
cubo=sim.createPrimitiveShape(sim.primitiveshape_cuboid,{0.1,0.1,0.05})
sim.setObjectPosition(cubo,sim.handle_world,{-0.7250,-0.1250,1})
sim.setObjectInt32Param(cubo,sim.shapeintparam_static,0)
sim.setObjectInt32Param(cubo,sim.shapeintparam_respondable,1)
cantidadProductos=cantidadProductos+1
tiempoanterior=tiempoactual
end
if detecta == true then
sim.writeCustomTableData(cinta,'__ctrl__',{vel=0})
else
sim.writeCustomTableData(cinta,'__ctrl__',{vel=0.07})
end
end
function sysCall_sensing()
-- put your sensing code here
if sim.readProximitySensor(sensor) == 1 then
detecta = true
else
detecta = false
end
end
function sysCall_cleanup()
-- do some clean-up here