Skip to content

Commit 6a91c3a

Browse files
committed
fixed rrt search return type
1 parent c4086b0 commit 6a91c3a

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

  • GEMstack/onboard/planning

GEMstack/onboard/planning/RRT.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def LocalPlanner(nearest_p,sample_p, step_size=0.5):
8181
return new_p
8282

8383
class BiRRT:
84-
def __init__(self, start : list, goal : list, obstacles : list, map : list):
84+
def __init__(self, start : list, goal : list, obstacles : list, MAP_SIZE : list):
8585

8686
self.path = []
8787
self.tree_from_start = []
@@ -98,20 +98,18 @@ def __init__(self, start : list, goal : list, obstacles : list, map : list):
9898
self.step_size = 0.5 # meter
9999
self.search_r = 1.3 # meter
100100
self.heading_limit = math.pi/6 # limit the heading change in route
101-
self.goal_sample_rate = 0.1 # rate to check area near end-goal
102101

103102
# Map boundary
104-
self.MAP_X_LOW = map[0] # meter
105-
self.MAP_X_HIGH = map[1] # meter
106-
self.MAP_Y_LOW = map[2] # meter
107-
self.MAP_Y_HIGH = map[3] # meter
103+
self.MAP_X_LOW = MAP_SIZE[0] # meter
104+
self.MAP_X_HIGH = MAP_SIZE[1] # meter
105+
self.MAP_Y_LOW = MAP_SIZE[2] # meter
106+
self.MAP_Y_HIGH = MAP_SIZE[3] # meter
108107

109108
def search(self):
110109
# initialize two tree
111110
self.tree_from_start.append(self.start_point)
112111
self.tree_from_end.append(self.end_point)
113112

114-
# self.start_time = time.time()
115113
# perform search within max number of iterration
116114
for iterration in range(self.MAX_Iteration):
117115
# uniformly sample a point within in the map
@@ -230,11 +228,11 @@ def trace_path(self,point_a,point_b):
230228
point_b = point_temp
231229

232230
while point_a is not None:
233-
path_start.append(point_a)
231+
path_start.append([point_a.x,point_a.y,point_a.heading])
234232
point_a = point_a.parent
235233
while point_b is not None:
236234
point_b.heading = angle_inverse(point_b.heading)
237-
path_end.append(point_b)
235+
path_end.append([point_b.x,point_b.y,point_b.heading])
238236
point_b = point_b.parent
239237

240238
self.path = path_start[::-1] + path_end

0 commit comments

Comments
 (0)