From 713d01b9f9108133b8bb6c4c659e4382311a1982 Mon Sep 17 00:00:00 2001 From: ll7 <32880741+ll7@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:04:13 +0100 Subject: [PATCH] Update robot_sf/gym_env/robot_env_with_pedestrian_obstacle_forces.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .../robot_env_with_pedestrian_obstacle_forces.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/robot_sf/gym_env/robot_env_with_pedestrian_obstacle_forces.py b/robot_sf/gym_env/robot_env_with_pedestrian_obstacle_forces.py index 08e3a3e..9a9277c 100644 --- a/robot_sf/gym_env/robot_env_with_pedestrian_obstacle_forces.py +++ b/robot_sf/gym_env/robot_env_with_pedestrian_obstacle_forces.py @@ -24,7 +24,15 @@ def __init__(self, map_def=None, debug=False): # Load the default map if map_def is None: logger.warning("No map_def provided. Using default map") - map_def = convert_map("maps/svg_maps/example_map_with_obstacles.svg") + default_map_path = "maps/svg_maps/example_map_with_obstacles.svg" + try: + map_def = convert_map(default_map_path) + except FileNotFoundError: + logger.error(f"Default map not found at {default_map_path}") + raise + except Exception as e: + logger.error(f"Failed to load default map: {str(e)}") + raise # create map pool with one map map_pool = MapDefinitionPool(map_defs={"my_map": map_def})