Path planning using remote API and synchronous mode

Typically: "How do I... ", "How can I... " questions
Post Reply
xli4217
Posts: 11
Joined: 13 Oct 2015, 21:08

Path planning using remote API and synchronous mode

Post by xli4217 » 26 Aug 2016, 05:37

Hi, I saw this statement in one of the earlier posts

"What takes long, is not the collision checking in itself, it is the way you use the remote API. Also, doing path planning via the remote API is probably not a good idea, since you don't have fast synchronization, and always suffer from the lag of the communication."

I was wondering if I use synchronous mode and simSynchronousTrigger function would I still have the slow synchronization and communication lag problem?

Thanks.

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

Re: Path planning using remote API and synchronous mode

Post by coppelia » 26 Aug 2016, 07:59

Hello,

you can trigger path planning searches or tasks from a remote location (e.g. remote API client) like in following pseudocode:

Code: Select all

result,path=simxCallScriptFunction(startPosition,goalPosition,etc.)
Above works fine and you can find an example of how to do this in programming/remoteApiBindings/python/python/pathPlanningTest.py

But doing actual path planning from a remote location is always problematic, also in synchronous mode. The problem is that most path planning algorithms work like this (in a very very simplified pseudo code):
  • a) find a configuration that does not collide. This gives us one new node.
  • b) try to link the new node to already existing nodes.
  • c) can we go from start to goal via existing nodes? If no, go to a)
If you run above code on a remote location, a) would need to be executed in V-REP, the rest you would do it in the remote location. But a) is usually called several thousands of times, and since you are in a remote location, you have several thousands of time the communication delay. This makes it super slow.

So try to go with the first mentioned solution above.

Cheers

xli4217
Posts: 11
Joined: 13 Oct 2015, 21:08

Re: Path planning using remote API and synchronous mode

Post by xli4217 » 26 Aug 2016, 16:25

Thanks for your reply. What you suggested works well in pure simulation, but I want to construct the code so that transferring to actual hardware will be trivial. Therefore I guess I should write as little lua code as possible. Is it possible to write the planning part in C++ or python (a plugin maybe?) and trigger using remoteAPI or ROS without losing speed? It is important that I can trigger the process step by step because I need to collect execution data in the form [current state, current action, resulting state]. I'm a little confused on what the best way would be to structure my code so any suggestion would be greatly appreciated.

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

Re: Path planning using remote API and synchronous mode

Post by coppelia » 29 Aug 2016, 07:39

Of course you can write your own path planning algorithm and have it located in the remote API client. But depending on the type of path planning algorithm that you use, you might have to perform many collision checking. If you have to do them on the V-REP side, you get the same problem again.

But imagine a situation when on your remote API client you know where all objects and obstacles are located, then you can perform your own collision checking on the remote API server and won't have any problem.

So my question is: when you have your code working exclusively on the actual robot, what kind of path planning algorithm will you use?

Cheers

Post Reply