PythonRobotics icon indicating copy to clipboard operation
PythonRobotics copied to clipboard

RRT* with reeds-sheep seems to produce illegal paths

Open davidenitti opened this issue 2 years ago • 4 comments

Describe the bug Sometimes the path produced by RRT* with reeds-sheep script rrt_star_reeds_shepp.py seems not allowed: there are sharp corners in the path.

Expected behavior allowed path

Screenshots Screenshot from 2021-10-02 20-34-39

Screenshot from 2021-10-02 20-41-58

Desktop (please complete the following information):

  • Python version 3.8.10

davidenitti avatar Oct 02 '21 18:10 davidenitti

Thank you. Can you share your code to reproduce the issue?

AtsushiSakai avatar Oct 03 '21 07:10 AtsushiSakai

the code is rrt_star_reeds_shepp.py unmodified. However, this issue does not always appears, given the randomness of RRT, so I have to see if I manage to put a seed to the randomness to reproduce the problem. I'll let you know if I manage to do this.

davidenitti avatar Oct 03 '21 09:10 davidenitti

so I managed to reproduce the issue using the script rrt_star_reeds_shepp.py and setting seed 8 after random import:

import random
random.seed(8)

I get this: plot1

a detail plot1_detail

davidenitti avatar Oct 03 '21 09:10 davidenitti

if you find a way to fix it let me know, thanks!

davidenitti avatar Oct 08 '21 21:10 davidenitti

Please let me take this issue as part of my course project on SUSTech EEE5058.

I found that the direct reason for this unexpected result is the difference between the length of the node's x_list and yaw_list. So when you zip() lists with different lengths, the longer parts of the longer lists was discarded.

Noticed that in this random.seed(8) case, RRTStarReedsShepp.planning() gives 101 nodes (in self.node_list), and 21 of these nodes have different lengths on the node.x_list (or y_list) and the node.yaw_list. Some of these nodes' yaw_lists are longer than the corresponding x_lists, and in this case, it's fine since all the x and y can be zipped and plotted correctly. However, when the yaw_lists are shorter than the x_lists, some x and y are discarded by zip() so some points on the curve are missed in the final plot.

A simple way to get a good figure is to add elements to the yaw_list to make it as long as the x and y lists.

Snipaste_2023-04-01_17-29-33 Snipaste_2023-04-01_17-38-51

Now I'm working on what makes the lengths of these lists different, and I will fix it soon.

RyderCRD avatar Apr 01 '23 10:04 RyderCRD

Thank you. Your PR is welcome.

AtsushiSakai avatar Apr 01 '23 11:04 AtsushiSakai