keep coding

This commit is contained in:
Atsushi Sakai
2018-04-02 08:38:16 +09:00
parent 5b03bc2d4a
commit 00f181621b
3 changed files with 70 additions and 22 deletions

View File

@@ -12,11 +12,12 @@ import random
import math
import copy
import numpy as np
import reeds_shepp_path_planning
import pure_pursuit
import unicycle_model
import matplotlib.pyplot as plt
import reeds_shepp_path_planning
import unicycle_model
show_animation = True
@@ -337,18 +338,14 @@ class RRT():
self.nodeList[i] = tNode
def DrawGraph(self, rnd=None):
u"""
"""
Draw Graph
"""
# plt.clf()
if rnd is not None:
plt.plot(rnd.x, rnd.y, "^k")
for node in self.nodeList:
if node.parent is not None:
plt.plot(node.path_x, node.path_y, "-g")
pass
# plt.plot([node.x, self.nodeList[node.parent].x], [
# node.y, self.nodeList[node.parent].y], "-g")
for (ox, oy, size) in self.obstacleList:
plt.plot(ox, oy, "ok", ms=30 * size)
@@ -362,9 +359,6 @@ class RRT():
plt.grid(True)
plt.pause(0.01)
# plt.show()
# input()
def GetNearestListIndex(self, nodeList, rnd):
dlist = [(node.x - rnd.x) ** 2 +
(node.y - rnd.y) ** 2 +
@@ -399,7 +393,7 @@ class RRT():
class Node():
u"""
"""
RRT Node
"""
@@ -417,14 +411,6 @@ class Node():
def main():
print("Start rrt start planning")
# ====Search Path with RRT====
obstacleList = [
(5, 5, 1),
(3, 6, 2),
(3, 8, 2),
(3, 10, 2),
(7, 5, 2),
(9, 5, 2)
] # [x,y,size(radius)]
obstacleList = [
(5, 5, 1),
(4, 6, 1),

View File

@@ -1,15 +1,15 @@
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Unicycle model class
author Atsushi Sakai
"""
import math
dt = 0.05 # [s]
L = 2.9 # [m]
L = 0.9 # [m]
steer_max = math.radians(40.0)
curvature_max = math.tan(steer_max) / L
curvature_max = 1.0 / curvature_max + 1.0

View File

@@ -6,8 +6,70 @@ author: Atsushi Sakai (@Atsushi_twi)
"""
import sys
sys.path.append("../ReedsSheppPath/")
# import random
import math
# import numpy as np
import matplotlib.pyplot as plt
import reeds_shepp_path_planning
show_animation = True
def hybrid_a_star_planning(start, goal, ox, oy, xyreso, yawreso):
rx, ry, ryaw = [], [], []
return rx, ry, ryaw
def main():
print("Start rrt start planning")
# ====Search Path with RRT====
ox, oy = [], []
for i in range(60):
ox.append(i)
oy.append(0.0)
for i in range(60):
ox.append(60.0)
oy.append(i)
for i in range(61):
ox.append(i)
oy.append(60.0)
for i in range(61):
ox.append(0.0)
oy.append(i)
for i in range(40):
ox.append(20.0)
oy.append(i)
for i in range(40):
ox.append(40.0)
oy.append(60.0 - i)
# Set Initial parameters
start = [10.0, 10.0, math.radians(90.0)]
goal = [50.0, 50.0, math.radians(-90.0)]
xyreso = 2.0
yawreso = math.radians(15.0)
rx, ry, ryaw = hybrid_a_star_planning(
start, goal, ox, oy, xyreso, yawreso)
plt.plot(ox, oy, ".k")
reeds_shepp_path_planning.plot_arrow(
start[0], start[1], start[2])
reeds_shepp_path_planning.plot_arrow(
goal[0], goal[1], goal[2])
plt.grid(True)
plt.axis("equal")
plt.show()
print(__file__ + " start!!")