## Path planning for Pioneer P3DX

Typically: "How do I... ", "How can I... " questions
Posts: 9
Joined: 05 Apr 2021, 16:26

### Path planning for Pioneer P3DX

Hello

In this tutorial he calculated the Path using the calculation module. In the newer versions we have to use the OMPL plugin.
I tried to implement the second method he showed in the tutorial which sets the velocity of the wheels.
Now in the tutorial he got the Path handle, position in the path, etc. with API functions such as simGetPathPlanningHandle(), simSearchPath(), simGetPositionOnPath() .
These API functions are not available now and I do not know how to use that method for making the Pioneer P3DX follow the path. Is there any alternative functions or method for this in the Legacy API or the OMPL plugin?

coppelia
Posts: 8531
Joined: 14 Dec 2012, 00:25

### Re: Path planning for Pioneer P3DX

Hello,

there is a clear distinction between doing path planning for finding a collision-free path for your robot, and driving your robot along that path, i.e. planning and execution.
The simplest is to do the path planning via the OMPL module, using a cylinder or sphere to represent your robot's position (i.e. no orientation). This will result in a path, that you could visualize too (e.g. using sim.addDrawingObject and sim.addDrawingObjectItem).
Then, phase two would be to have the robot follow that path, by correctly actuating each of the motor. You'll have to decide of a path tracking or following strategy.

Cheers

fferri
Posts: 728
Joined: 09 Sep 2013, 19:28

### Re: Path planning for Pioneer P3DX

You can use also simOMPL.drawPath to draw an OMPL path, e.g.:

Code: Select all

drawingObjects=simOMPL.drawPath(taskHandle,thePath,lineSize,color,extraAttributes)

later remove the drawing objects with:

Code: Select all

simOMPL.removeDrawingObjects(taskHandle,drawingObjects)

however this will work only if your task defines a 3D euclidean projection, e.g. you pass useForProjection=1 to simOMPL.createStateSpace wherever appropriate to achieve a 3D projection, or otherwise use simOMPL.setProjectionEvaluationCallback to specify a custom projection that maps the path state to a 3D point.

For instance, if your state space is N revolute joints of a robot arm, you may want to use a projection evaluation callback, to compute the end-effector position via FK, and return that as the projection of the state.