Stop Conveyor
Posted: 13 Jun 2024, 18:31
Hi,
I am student and complety new with CoppliaSim(4.6.0)
I am having trouble stopping the conveyor when proximity sensor detect box. When I drag the conveyor into the workspace, the conveyor's icon in the scene hierarchy only attaches the customization script. I have tried uncommenting a few lines of code in customization script like this:
and customization script is error.
I also try to put this code(1) in customization script when I have re-commented those line of code above:
between two line of code is: and:
so the script does not have any errors but conveyor doesn't stop.
I also try put those code(1) in child script but seem compiler don't understand or similar API like this.
What should i do for stop conveyor when proximity sensor detect box?
Thank you!
I am student and complety new with CoppliaSim(4.6.0)
I am having trouble stopping the conveyor when proximity sensor detect box. When I drag the conveyor into the workspace, the conveyor's icon in the scene hierarchy only attaches the customization script. I have tried uncommenting a few lines of code in customization script like this:
Code: Select all
--lua
sim=require'sim'
conveyor=require('conveyor_customization-2')
-- To command the conveyor externally or from another script, simply do:
--
sim.writeCustomTableData(conveyorHandle,'__ctrl__',{vel=0.1}) -- vel. ctrl
--
-- or:
--
sim.writeCustomTableData(conveyorHandle,'__ctrl__',{pos=0.1}) -- pos. ctrl
--
-- Its current state can be read with:
local data=sim.readCustomTableData(conveyorHandle,'__state__')
I also try to put this code(1) in customization script when I have re-commented those line of code above:
Code: Select all
function sysCall_init()
sensor=sim.getObject('Proximity_sensor')
end
function sysCall_actuation()
beltVelocity=0.3
if sim.readProximitySensor(sensor) > 0 then
beltVelocity=0
end
sim.writeCustomTableData(sensor,'__ctrl__',{vel=beltVelocity})
end
Code: Select all
sim=require'sim'
Code: Select all
conveyor=require('conveyor_customization-2')
I also try put those code(1) in child script but seem compiler don't understand
Code: Select all
sim.getObject('Proximity_sensor')
What should i do for stop conveyor when proximity sensor detect box?
Thank you!