File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
gymnasium_robotics/envs/maze Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -275,11 +275,11 @@ def add_xy_position_noise(self, xy_pos: np.ndarray) -> np.ndarray:
275
275
def compute_reward (
276
276
self , achieved_goal : np .ndarray , desired_goal : np .ndarray , info
277
277
) -> float :
278
- d = np .linalg .norm (achieved_goal - desired_goal , axis = - 1 )
278
+ distance = np .linalg .norm (achieved_goal - desired_goal , axis = - 1 )
279
279
if self .reward_type == "dense" :
280
- return np .exp (- d )
280
+ return np .exp (- distance )
281
281
elif self .reward_type == "sparse" :
282
- return - ( d > 0.45 ).astype (np .float32 )
282
+ return ( distance <= 0.45 ).astype (np .float64 )
283
283
284
284
def compute_terminated (
285
285
self , achieved_goal : np .ndarray , desired_goal : np .ndarray , info
Original file line number Diff line number Diff line change @@ -355,11 +355,11 @@ def add_xy_position_noise(self, xy_pos: np.ndarray) -> np.ndarray:
355
355
def compute_reward (
356
356
self , achieved_goal : np .ndarray , desired_goal : np .ndarray , info
357
357
) -> float :
358
- d = np .linalg .norm (achieved_goal - desired_goal , axis = - 1 )
358
+ distance = np .linalg .norm (achieved_goal - desired_goal , axis = - 1 )
359
359
if self .reward_type == "dense" :
360
- return np .exp (- d )
360
+ return np .exp (- distance )
361
361
elif self .reward_type == "sparse" :
362
- return - ( d > 0.45 ).astype (np .float32 )
362
+ return ( distance <= 0.45 ).astype (np .float64 )
363
363
364
364
def compute_terminated (
365
365
self , achieved_goal : np .ndarray , desired_goal : np .ndarray , info
You can’t perform that action at this time.
0 commit comments