Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed hard-coded plot limits #1018

Merged
merged 1 commit into from
May 18, 2024
Merged

Conversation

yousefbilal
Copy link
Contributor

The limits of the plots were fixed to (-2,15) which is the example random range. Adjusted to be rand_min, rand_max instead.

@AtsushiSakai
Copy link
Owner

@yousefbilal Thank you for your PR. Is it possible to post animation movies before and after changes?

@yousefbilal
Copy link
Contributor Author

yousefbilal commented May 18, 2024

Sure, this is the plot before the change. Some parts are hidden because the plot limits are [-2,15]
image

After the change, which sets the limits of the plot to the random sample area
image

Note that this also affects RRTStar as it extends the RRT class.

I used the following for the test:

def main(gx=4.0, gy=5.0):
    print("start " + __file__)

    # ====Search Path with RRT====
    obstacleList = [(1, 2, 1), (3, 2, 2), (3, 1, 2), (4, 1, 2), (0.5, -3, 2),
                    (4, -2, 2)]  # [x, y, radius]
    # Set Initial parameters
    rrt = RRT(
        start=[0, 0],
        goal=[gx, gy],
        rand_area=[-5, 6],
        obstacle_list=obstacleList,
        # play_area=[0, 10, 0, 14]
        robot_radius=0.5
        )
    path = rrt.planning(animation=show_animation)

    if path is None:
        print("Cannot find path")
    else:
        print("found path!!")

        # Draw final path
        if show_animation:
            rrt.draw_graph()
            plt.plot([x for (x, y) in path], [y for (x, y) in path], '-r')
            plt.grid(True)
            plt.pause(0.01)  # Need for Mac
            plt.show()

@AtsushiSakai AtsushiSakai merged commit ed5004b into AtsushiSakai:master May 18, 2024
8 checks passed
@AtsushiSakai
Copy link
Owner

@yousefbilal Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants