2424vmax = 1.5
2525SAFETY_DIST = 2.0
2626EPISODES = 100
27- NUM_OBSTACLES = 4
27+ NUM_OBSTACLES = 0
2828NUM_STEPS = 100
2929NUM_CHANNELS = 3
3030GAMMA = 0.2
31- USE_CBF = True
31+ USE_CBF = False
3232
3333resolution = 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+ '''
319317for 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
331329plt.show()
332-
330+ '''
333331
0 commit comments