MATLAB Answers

How to obtain optimal path between start and goal pose using pathPlannerRRT() and plan()?

2 views (last 30 days)
Tarun Santosh
Tarun Santosh on 22 Jun 2021
Commented: Qu Cao on 4 Jul 2021
I am currently working on path planning of a vehicle for an automatic parking system.
I am currently using pathPlannerRRT() and plan() to generate a path between start and goal pose. The problem that i am facing is, with the same start and goal pose each time i re-run my program, i am getting a different path. Different results each time I re-run indicates that the path being generated is not optimal. Sometimes it is close to optimal, sometimes its very wavy and sub optimal.
How can i better control the path being generated and how can i ensure that the path being generated is optimal?
This is the part of code where i am configuring the path planner:
motion_planner = pathPlannerRRT(cstmp,'MinIterations',2000,'ConnectionDistance',5,'MinTurningRadius',4,'ConnectionMethod','Reeds-Shepp','ApproximateSearch',false);
path = plan(motion_planner,curr_pose,goal_pose);

Accepted Answer

Qu Cao
Qu Cao on 30 Jun 2021
Please set the random seed at the beginning to get consistent results across different runs:
rng(1);
motion_planner = pathPlannerRRT(cstmp,'MinIterations',2000,'ConnectionDistance',5,'MinTurningRadius',4,'ConnectionMethod','Reeds-Shepp','ApproximateSearch',false);
path = plan(motion_planner,curr_pose,goal_pose);
  2 Comments
Qu Cao
Qu Cao on 4 Jul 2021
A rapidly exploring random tree (RRT) is an algorithm designed to efficiently search nonconvex, high-dimensional spaces by randomly building a space-filling tree.
rng controls the generation of random numbers.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!