2323GRID_STEPS  =  64 
2424vmax  =  1.5 
2525SAFETY_DIST  =  2.0 
26- EPISODES  =  50 
26+ EPISODES  =  1 
2727NUM_OBSTACLES  =  4  
28- NUM_STEPS  =  100 
28+ NUM_STEPS  =  50 
2929NUM_CHANNELS  =  3 
3030GAMMA  =  0.5 
31- USE_CBF  =  True 
31+ USE_CBF  =  False 
3232
3333resolution  =  2  *  ROBOT_RANGE  /  GRID_STEPS 
3434
@@ -225,7 +225,7 @@ def safety_constraint(u, A, b):
225225          # Check for obstacles (2x2 m) 
226226          for  obs  in  obstacles :
227227            # if p_w[0] > obs[0] - 1.0 and p_w[0] < obs[0] + 1.0 and p_w[1] > obs[1] - 1.0 and p_w[1] < obs[1] + 1.0: 
228-             if  np .linalg .norm (p_w  -  obs ) <  0.5 * SAFETY_DIST :
228+             if  np .linalg .norm (p_w  -  obs ) <  SAFETY_DIST :
229229              img_obs [0 , i , j ] =  255 
230230
231231      # -------- EVAL ------- 
@@ -315,19 +315,23 @@ def safety_constraint(u, A, b):
315315  np .save (res_path / "eta12.npy" , eval_data )
316316  np .save (res_path / "collisions12.npy" , collision_counter )
317317
318- ''' 
318+ """ 
319+ fig, ax = plt.subplots(1, 1) 
320+ plot_occgrid(Xg, Yg, Z, ax=ax) 
321+ 
319322for i in range(ROBOTS_NUM): 
320323  ax.plot(robots_hist[:, i, 0], robots_hist[:, i, 1]) 
321324  ax.scatter(robots_hist[-1, i, 0], robots_hist[-1, i, 1]) 
322325
326+ th = np.arange(0, 2*np.pi+np.pi/20, np.pi/20) 
323327for obs in obstacles: 
324-   o_x = np.array([obs[0]-1, obs[0]+1, obs[0]+1, obs[0]-1, obs[0]-1]) 
325-   o_y = np.array([obs[1]-1, obs[1]-1, obs[1]+1, obs[1]+1, obs[1]-1]) 
328+   # o_x = np.array([obs[0]-1, obs[0]+1, obs[0]+1, obs[0]-1, obs[0]-1]) 
329+   # o_y = np.array([obs[1]-1, obs[1]-1, obs[1]+1, obs[1]+1, obs[1]-1]) 
330+   o_x = obs[0] + 0.5*SAFETY_DIST*np.cos(th) 
331+   o_y = obs[1] + 0.5*SAFETY_DIST*np.sin(th) 
326332  ax.plot(o_x, o_y, c='r', linewidth=3) 
327333
328- for i in range(ROBOTS_NUM): 
329-   ax2.scatter(robots_hist[-1, i, 0], robots_hist[-1, i, 1]) 
330334
331335plt.show() 
332- ''' 
333336
337+ """ 
0 commit comments