Interrupt handling

Typically: "How do I... ", "How can I... " questions
Post Reply
spinang
Posts: 22
Joined: 05 Dec 2016, 22:02

Interrupt handling

Post by spinang »

Good evening,
I'm developing an application in which a robot moves inside a maze, where the information thanks to which it "decides" which is the right steering direction is what a vision sensor captures. At the moment, I don't have any kind of interrupt handling procedure, so my remote application sends queries each time step to check if the visual information is available or not. I would like to improve the algorithm by introducing an interrupt handler in such a way whenever the visual information I'm interested in is available V-REP "wakes" a C++ routine for handling and processing it.

In other words, the flow is something like this: the robot moves continuously, where a simple obstacle avoidance algorithm guides each maneuvre. Asynchronously, it should be able to receive an external signal that indicates the availability of a visual data, starting from the decision making task can be done (and thanks to which my robot can decide where to go).

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

Re: Interrupt handling

Post by coppelia »

Hello,

if I understood you correctly, you have following possibilities:

The best would be to have a plugin that exports a new API command, e.g. simExtMyPlugin_somethingDetected. Then have a script call that function everytime an interrupt situation occured. The call to simExtMyPlugin_somethingDetected will result to a call inside of your plugin, where you can then handle the situation (e.g. processing the image data in C/C++) for instance. While in the plugin call, then whole simulation will halt until the call returns to the calling script.

If you do not use a plugin, but an external application (e.g. a ros node or a remote API client), then it is less elegant and obvious: you will have to run V-REP in synchronous mode, and have your external application trigger each simulation step. When an interrupt situation occurs, then V-REP can indicate this with a signal, that the external application will interpret as: stop triggering next simulation steps until the situation was handled.

Cheers

Post Reply