I'm using VREP with QT to control the walking of robot NAO with reinforcement learning. This method demands a lot of trials to converge, so I'm trying 10000 trials. But, when the program is about 2000 trials (18 hours), VREP crashes. I tried a lot of times, in different computers, with the most actual version, and I don't have any ideia what is the problem. In the screen of VREp don't appears any error or something like this. Is this a bug or am I doing something wrong?
This is the main script that I'm using to simulate and communicate with QT.
Code: Select all
-- Initialization part (executed just once, at simulation start) ---------
if (simGetSimulationState()==sim_simulation_advancing_firstafterstop) then
newPortNb = 25000
simExtRemoteApiStart(newPortNb,250,true)
simOpenModule(sim_handle_all)
simHandleMechanism(sim_handle_all_except_explicit)
simHandleIkGroup(sim_handle_all_except_explicit)
simHandleMill(sim_handle_all_except_explicit)
simHandleCollision(sim_handle_all_except_explicit)
simHandleDistance(sim_handle_all_except_explicit)
simHandleProximitySensor(sim_handle_all_except_explicit)
simHandleVisionSensor(sim_handle_all_except_explicit)
simHandleGraph(sim_handle_all_except_explicit,simGetSimulationTime())
end
--------------------------------------------------------------------------
-- "Actuation"-part ------------------------------------------------------
simResumeThreads(1)
-- Following code line will execute all "regular" child scripts that
-- appear as first child scripts in the scene hierarchy, and only those
-- that are not marked as "explicit handling":
simHandleChildScript(sim_handle_all_except_explicit)
simHandleModule(sim_handle_all,false)
simResumeThreads(2)
simHandleJoint(sim_handle_all_except_explicit,simGetSimulationTimeStep())
simHandlePath(sim_handle_all_except_explicit,simGetSimulationTimeStep())
simHandleMechanism(sim_handle_all_except_explicit)
simHandleIkGroup(sim_handle_all_except_explicit)
simHandleDynamics(simGetSimulationTimeStep())
simHandleVarious()
simHandleMill(sim_handle_all_except_explicit)
--------------------------------------------------------------------------
-- "Sensing"-part --------------------------------------------------------
workThreadCount=simGetIntegerParameter(sim_intparam_work_thread_count)
coreCount=simGetIntegerParameter(sim_intparam_core_count)
if (workThreadCount<0) then
workThreadCount=coreCount -- auto setting: thread count=core count
if (workThreadCount<2) then
workThreadCount=0 -- turn work threads off if less than 2 cores
end
end
simEnableWorkThreads(workThreadCount) -- thread count can be changed on-the-fly.
startTime1=simGetSystemTimeInMilliseconds()
simHandleCollision(sim_handle_all_except_explicit)
simHandleDistance(sim_handle_all_except_explicit)
simHandleProximitySensor(sim_handle_all_except_explicit)
startTime2=simGetSystemTimeInMilliseconds()
simHandleVisionSensor(sim_handle_all_except_explicit)
timeDiff2=simGetSystemTimeInMilliseconds(startTime2)
simWaitForWorkThreads()
timeDiff=simGetSystemTimeInMilliseconds(startTime1)-timeDiff2
if (workThreadCount==0) then
timeDiff=0
end
simSetIntegerParameter(sim_intparam_work_thread_calc_time_ms,timeDiff)
simResumeThreads(3)
-- Following code line will execute all "sensing" child scripts that
-- appear as first child scripts in the scene hierarchy, and only those
-- that are not marked as "explicit handling":
simHandleSensingChildScripts()
simHandleModule(sim_handle_all,true)
simResumeThreads(4)
simHandleGraph(sim_handle_all_except_explicit,simGetSimulationTime()+simGetSimulationTimeStep())
--------------------------------------------------------------------------
-- Clean-up part (executed just once, before simulation ends) ------------
if (simGetSimulationState()==sim_simulation_advancing_lastbeforestop) then
simEnableWorkThreads(0)
simResetMilling(sim_handle_all)
simResetMill(sim_handle_all)
simResetCollision(sim_handle_all)
simResetDistance(sim_handle_all)
simResetProximitySensor(sim_handle_all)
simResetVisionSensor(sim_handle_all)
simCloseModule(sim_handle_all)
end