Skip to content

Commit e5332b2

Browse files
committed
minor changes
1 parent e3a4344 commit e5332b2

File tree

5 files changed

+19
-21
lines changed

5 files changed

+19
-21
lines changed

scripts/eval_results.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ def parse_args():
3333
if etas[e][i, 0] == 0:
3434
break
3535
etas[e] = etas[e][:i, :]
36-
print("Eta shape after removing: ", etas[0].shape)
36+
37+
# print("Eta shape after removing: ", etas[0].shape)
3738

3839
for e in range(len(etas)):
3940
ids = (etas[e]==0).argmax(axis=1)
4041
for i in range(etas[e].shape[0]):
4142
etas[e][i, ids[i]:] = etas[e][i, ids[i]-1]
4243

4344

44-
4545
etas_m = []
4646
stds = []
4747
for eta in etas:
4848
etas_m.append(np.mean(eta, axis=0))
4949
stds.append(np.std(eta, axis=0))
50-
50+
print("eta: ", etas_m[-1][-1])
5151

5252
collisions_num = []
5353
for i in range(len(collisions)):

scripts/stdcov.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def parse_args():
4343
vmax = 1.5
4444
SAFETY_DIST = 2.0
4545
NUM_STEPS = 100
46-
EPISODES = 1
46+
EPISODES = 100
4747
print("ROOBTS NUM : ", ROBOTS_NUM)
4848

4949
path = Path().resolve()

scripts/test16.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def safety_constraint(u, A, b):
7070
print(f"*** Episode {episode} ***")
7171
targets = np.zeros((TARGETS_NUM, 1, 2))
7272
for i in range(TARGETS_NUM):
73-
targets[i, 0, 0] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand(1,1)
74-
targets[i, 0, 1] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand(1,1)
73+
targets[i, 0, 0] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand()
74+
targets[i, 0, 1] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand()
7575

7676
# plt.plot([-0.5*AREA_W, 0.5*AREA_W], [-0.5*AREA_W, -0.5*AREA_W], c='tab:blue', label="Environment")
7777
# plt.plot([0.5*AREA_W, 0.5*AREA_W], [-0.5*AREA_W, 0.5*AREA_W], c='tab:blue')
@@ -298,7 +298,7 @@ def safety_constraint(u, A, b):
298298
robots_hist = np.concatenate((robots_hist, np.expand_dims(points, 0)))
299299
eta = num / denom
300300
# print("Efficiency: ", eta)
301-
eval_data[episode, s-1] = eta
301+
eval_data[episode, s-1] = eta[0]
302302

303303

304304

scripts/test20.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def safety_constraint(u, A, b):
7070
print(f"*** Episode {episode} ***")
7171
targets = np.zeros((TARGETS_NUM, 1, 2))
7272
for i in range(TARGETS_NUM):
73-
targets[i, 0, 0] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand(1,1)
74-
targets[i, 0, 1] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand(1,1)
73+
targets[i, 0, 0] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand()
74+
targets[i, 0, 1] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand()
7575

7676
# plt.plot([-0.5*AREA_W, 0.5*AREA_W], [-0.5*AREA_W, -0.5*AREA_W], c='tab:blue', label="Environment")
7777
# plt.plot([0.5*AREA_W, 0.5*AREA_W], [-0.5*AREA_W, 0.5*AREA_W], c='tab:blue')
@@ -299,7 +299,7 @@ def safety_constraint(u, A, b):
299299
robots_hist = np.concatenate((robots_hist, np.expand_dims(points, 0)))
300300
eta = num / denom
301301
# print("Efficiency: ", eta)
302-
eval_data[episode, s-1] = eta
302+
eval_data[episode, s-1] = eta[0]
303303

304304
if all_stopped:
305305
break

scripts/test_2d_model.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
vmax = 1.5
2525
SAFETY_DIST = 2.0
2626
EPISODES = 100
27-
NUM_OBSTACLES = 4
27+
NUM_OBSTACLES = 0
2828
NUM_STEPS = 100
2929
NUM_CHANNELS = 3
3030
GAMMA = 0.2
31-
USE_CBF = True
31+
USE_CBF = False
3232

3333
resolution = 2 * ROBOT_RANGE / GRID_STEPS
3434

@@ -71,8 +71,8 @@ def safety_constraint(u, A, b):
7171
print(f"*** Episode {episode} ***")
7272
targets = np.zeros((TARGETS_NUM, 1, 2))
7373
for i in range(TARGETS_NUM):
74-
targets[i, 0, 0] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand(1,1)
75-
targets[i, 0, 1] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand(1,1)
74+
targets[i, 0, 0] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand()
75+
targets[i, 0, 1] = -0.5*(AREA_W-1) + (AREA_W-1) * np.random.rand()
7676

7777
# plt.plot([-0.5*AREA_W, 0.5*AREA_W], [-0.5*AREA_W, -0.5*AREA_W], c='tab:blue', label="Environment")
7878
# plt.plot([0.5*AREA_W, 0.5*AREA_W], [-0.5*AREA_W, 0.5*AREA_W], c='tab:blue')
@@ -159,7 +159,6 @@ def safety_constraint(u, A, b):
159159

160160
r_step = 2 * ROBOT_RANGE / GRID_STEPS
161161
denom = np.sum(s**2 * gmm_pdf(Xg, Yg, means, covariances, mix))
162-
print("Total info: ", denom)
163162
for s in range(1, NUM_STEPS+1):
164163
# print(f"*** Step {s} ***")
165164
all_stopped = True
@@ -304,18 +303,17 @@ def safety_constraint(u, A, b):
304303

305304
robots_hist = np.concatenate((robots_hist, np.expand_dims(points, 0)))
306305
eta = num / denom
307-
# print("Efficiency: ", eta)
308-
eval_data[episode, s-1] = eta
306+
eval_data[episode, s-1] = eta[0]
309307

310308
if all_stopped:
311309
break
312310

313311
path = Path().resolve()
314312
res_path = path / "results"
315-
np.save(res_path/"eta12.npy", eval_data)
316-
np.save(res_path/"collisions12.npy", collision_counter)
317-
313+
np.save(res_path/"eta12_conv.npy", eval_data)
314+
np.save(res_path/"collisions12_conv.npy", collision_counter)
318315

316+
'''
319317
for i in range(ROBOTS_NUM):
320318
ax.plot(robots_hist[:, i, 0], robots_hist[:, i, 1])
321319
ax.scatter(robots_hist[-1, i, 0], robots_hist[-1, i, 1])
@@ -329,5 +327,5 @@ def safety_constraint(u, A, b):
329327
ax2.scatter(robots_hist[-1, i, 0], robots_hist[-1, i, 1])
330328
331329
plt.show()
332-
330+
'''
333331

0 commit comments

Comments
 (0)