During my simulation I'm reading the distance between a dummy and a ball in each step with sim.checkDistance.
After 20 seconds of simulation I want to send the minimum value of all those distances that I've read during the simulation.
So I want to know if there's some function to obtain the minimum value of all the distances that I've calculated in the simulation.
function sysCall_init()
end
function sysCall_sensing()
local threshold=smallestDistance
if threshold==nil then
threshold=0
end
local r,dist=sim.checkDistance(dummyHandle,ballHandle,threshold)
if r>0 then
smallestDistance=dist[7]
end
if sim.getSimulationTime()>20 and smallestDistance then
-- send smallestDistance
end
end