Skip to content
Snippets Groups Projects
Commit 3eb57dab authored by rachelmoan's avatar rachelmoan
Browse files

remove pointless while loop

parent 5395e03d
No related branches found
No related tags found
No related merge requests found
......@@ -30,26 +30,26 @@ def test_traj_from_points():
start = robot_starts[i]
goal = robot_goals[i]
while time.time() - start_time < 10:
try:
rrtstar = RRTStar(env, (start[0], start[1]), (goal[0], goal[1]), 0.5, 0.05, 500, r=2.0)
rrtstarpath = rrtstar.run()
rrtstarpath = list(reversed(rrtstarpath))
xs = []
ys = []
for node in rrtstarpath:
xs.append(node[0])
ys.append(node[1])
try:
rrtstar = RRTStar(env, (start[0], start[1]), (goal[0], goal[1]), 0.5, 0.05, 500, r=2.0)
rrtstarpath = rrtstar.run()
rrtstarpath = list(reversed(rrtstarpath))
xs = []
ys = []
for node in rrtstarpath:
xs.append(node[0])
ys.append(node[1])
x,y,h,path = get_traj_from_points(np.array([start[0], start[1],0]), dynamics, target_velocity, T, DT, [xs, ys])
x_hists.append(x)
y_hists.append(y)
h_hists.append(h)
paths.append(path)
success_count += 1
break
except Exception as e:
print(f"Robot {i} failed to find a valid trajectory: {e}")
x,y,h,path = get_traj_from_points(np.array([start[0], start[1],0]), dynamics, target_velocity, T, DT, [xs, ys])
x_hists.append(x)
y_hists.append(y)
h_hists.append(h)
paths.append(path)
success_count += 1
except Exception as e:
print(f"Robot {i} failed to find a valid trajectory: {e}")
end_time = time.time()
total_time += (end_time - start_time)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment