Skip to content

Commit 63534d1

Browse files
authored
Fixed RRT algorithms by fixing backwards trace (#59)
1 parent 81a75da commit 63534d1

File tree

1 file changed

+4
-4
lines changed
  • src/algorithms/configuration/maps

1 file changed

+4
-4
lines changed

src/algorithms/configuration/maps/map.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def move_agent(self, to: Point, no_trace: bool = False, follow: bool = False) ->
194194
if not follow:
195195
return self.move(self.agent, to, no_trace)
196196
else:
197-
line: List[Point] = self.get_line_sequence(self.agent.position, to)[1:] # Get rid of first point, the current agent pos
197+
line: List[Point] = self.get_line_sequence(self.agent.position, to)
198198
for next_pos in line:
199199
if not self.move(self.agent, next_pos, no_trace):
200200
return False
@@ -206,10 +206,10 @@ def get_line_sequence(self, frm: Point, to: Point) -> List[Point]:
206206
Given coordinate of two n dimensional points. The task to find all the intermediate points required for
207207
drawing line AB.
208208
'''
209-
start = np.array([[to[i] for i in range(self.size.n_dim)]])
210-
end = np.array([frm[i] for i in range(self.size.n_dim)])
209+
start = np.array([[frm[i] for i in range(self.size.n_dim)]])
210+
end = np.array([to[i] for i in range(self.size.n_dim)])
211211
coord_list = bresenhamline(start, end)
212-
sequence = list(map(lambda x: Point(*list(x)), coord_list)) + [to]
212+
sequence = list(map(lambda x: Point(*list(x)), coord_list))
213213
return sequence
214214

215215
def is_valid_line_sequence(self, line_sequence: List[Point]) -> bool:

0 commit comments

Comments
 (0)