Error during multiple processes calculation with v-rep

Typically: "How do I... ", "How can I... " questions
Post Reply
Maria
Posts: 4
Joined: 19 Oct 2013, 18:48

Error during multiple processes calculation with v-rep

Post by Maria »

Hi all,

My situation:
I try to realize evolutionary calculations with v-rep. I have a main program which control all calculations and start several v-rep processes (to speed up calculations). These processes load my plugin to control some(one or more) robots and exchange the data between plugin and my main application (through the winapi). Everything is going well until one (or some) v-rep processes stops with error. It is not the error in my plugin because in this case i could try to debug it with source code of my plugin and fix it. From my attempts to debug it with my code i found that this error occurs in one of v-reps dll-s. Visual Studio only can show the callstack and disassembly (you can see it on screenshot). So i can't determine the reasons of this error. It occurs independently from the params of my evolutionary calculations, but on about the same generation num (at fixed num of processes). At other machine it happens on the other generation num, but regularly and reproducibly.
I haven't a big expirience in programming, so i don't see any way to fix this problem.
Thanks for your help.

Image

coppelia
Site Admin
Posts: 10362
Joined: 14 Dec 2012, 00:25

Re: Error during multiple processes calculation with v-rep

Post by coppelia »

Hello Maria,

how do you start your processes? Are those processes or threads?

Does V-REP continue executing after one process stops?

Just a few clarifications:
  • if you started another process, and that process crashes or stops, then V-REP can continue functioning
  • if you started another thread, and that thread causes a crash, then the whole application stops working
  • if you access the regular API from a plugin, you should only do this if you are in the main thread (or application thread), otherwise you might crash everything. The regular API is not thread-safe, except if you are calling it from child scripts (threaded or non-threaded)
Cheers

Maria
Posts: 4
Joined: 19 Oct 2013, 18:48

Re: Error during multiple processes calculation with v-rep

Post by Maria »

coppelia wrote:Hello Maria,

how do you start your processes? Are those processes or threads?

Does V-REP continue executing after one process stops?

Just a few clarifications:
  • if you started another process, and that process crashes or stops, then V-REP can continue functioning
  • if you started another thread, and that thread causes a crash, then the whole application stops working
  • if you access the regular API from a plugin, you should only do this if you are in the main thread (or application thread), otherwise you might crash everything. The regular API is not thread-safe, except if you are calling it from child scripts (threaded or non-threaded)
Cheers
Thanks,
I understand these points.

I create v-rep processes by using winapi function CreateProcess.

After a long search, I create a simple plugin that just download the model of the robot (Nao) and then start and stop the simulation after a certain period of time. The robot are not managed, just stand. After some of these restarts vrep crashes. Then I tried another robot - Atsi and in this case all was good. I adapted my calculations under this robot and now it continue to the end without errors. And, by the way, it is much faster than with Nao. So, I think the problem was in model of a robot Nao..

coppelia
Site Admin
Posts: 10362
Joined: 14 Dec 2012, 00:25

Re: Error during multiple processes calculation with v-rep

Post by coppelia »

The NAO robot model is much more complex than the Asti robot model, that's why is is slower (e.g. it has 4 force sensors for each foot, etc.).

Your test plugin is simply loading the NAO model, and starting the simulation? And that doesn't work? This means that you do something wrong in the plugin. Could you show us some code for that plugin?

V-REP's API functions are not thread safe, but that doesn't mean that it will not work all the time. So sometimes it might look as if some functions are thread safe, but you should anyways avoid this at all costs.

Cheers

Maria
Posts: 4
Joined: 19 Oct 2013, 18:48

Re: Error during multiple processes calculation with v-rep

Post by Maria »

coppelia wrote: Your test plugin is simply loading the NAO model, and starting the simulation? And that doesn't work? This means that you do something wrong in the plugin. Could you show us some code for that plugin?
No, from my test plugin i simply restarted the simulations after some period of time (start, after period stop, then again start and so on). I wanted to know how many runs I can do without errors. In the case of NAO after about 15-20 launches the v-rep crashed. With Asti all was ok.
Last edited by Maria on 01 Nov 2013, 09:55, edited 1 time in total.

coppelia
Site Admin
Posts: 10362
Joined: 14 Dec 2012, 00:25

Re: Error during multiple processes calculation with v-rep

Post by coppelia »

please show us your test plugin, otherwise we cannot say what is going on.

Cheers

Maria
Posts: 4
Joined: 19 Oct 2013, 18:48

Re: Error during multiple processes calculation with v-rep

Post by Maria »

coppelia wrote:please show us your test plugin, otherwise we cannot say what is going on.

http://www42.zippyshare.com/v/42191382/file.html

In this archive scene with nao, dll of plugin and cpp file of code.
coppelia wrote:
V-REP's API functions are not thread safe, but that doesn't mean that it will not work all the time. So sometimes it might look as if some functions are thread safe, but you should anyways avoid this at all costs.
I don't create additional threads from plugin. It is written in c++ and uses regular api.

My "main application" (which manages all evolutionary calculations, creates data for new generation and so on) creates several proccesses of v-rep. I thought it can be connected with crashes, but, as i wrote above, these errors doesn't bound with count of v-rep processes and my application at all.

Post Reply