## Probabilistic Road Map motion planing

Typically: "How do I... ", "How can I... " questions
max15s
Posts: 1
Joined: 05 Mar 2014, 07:22

### Probabilistic Road Map motion planing

I want to use Probabilistic Road Map'' (PRM) algorithm for motion planing.
(This algorithm works with random samples, it means for a 4DOF robot, we generate a random value for each joint and check if that random configuration is collision free. With enough samples we can find a path (Randomly) from a goal to target)
How can I check if a random robot configuration (a random position for each joint) is collision free?
If I set Joint values and run the simulation, robot starts to move from one configuration to another but I don't want actual movement, I need to know if only the final position of the robot for each configuration is collision free for not.

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

### Re: Probabilistic Road Map motion planing

Hello,

first of all: what you are describing is already implemented in the motion planning module. Unfortunately the documentation is not completed. In next release of V-REP (V3.1.1, due for the end of March 2014) the documentation will be finished, and additional motion planning commands added for more control of the motion planning task. Additionally, there will be a demo scene illustrating the usage of the motion planning functionality: motionPlanningAndGraspingDemo.ttt (which is basically the scene corresponding to this simulation). So if you can wait 2 weeks, this is easiest.

Otherwise, if you wish to implement your own motion planning algorithm, then you better use a plugin, which will allow you to have most control over V-REP (and also to run while simulation is not running!). The idea is to set a random position for each joint, then do a collision detection:
• set all joints to the desired position with simSetJointPosition. Make sure the joints are not in motion or dynamic mode (you might have to temporarily change the joint mode with simSetJointMode)
• check for collisions with: simCheckCollision. The easiest is to specify a collection entity (for the robot), and sim_handle_all for the environment entity.
• make sure above steps happen without interruption (i.e. in the same calculation sequence). If you do it from a threaded child script, you should call simSetThreadAutomaticSwitch(false) before the calculations, and simSetThreadAutomaticSwitch(true) after the calculations (so that you don't get interrupted).
Cheers