From 4dac2db579c984ede65bf24fb9087bc95d80aed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Tr=C3=B6ster?= Date: Thu, 14 Dec 2023 14:53:25 +0100 Subject: [PATCH] fix init crash for maps with only one robot spawn zone --- robot_sf/robot_env.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/robot_sf/robot_env.py b/robot_sf/robot_env.py index 6e17ab0..627626d 100644 --- a/robot_sf/robot_env.py +++ b/robot_sf/robot_env.py @@ -150,7 +150,8 @@ def init_simulators( sims: List[Simulator] = [] for i in range(num_sims): - n = map_def.num_start_pos if i < num_sims - 1 else num_robots % map_def.num_start_pos + n = map_def.num_start_pos if i < num_sims - 1 \ + else max(1, num_robots % map_def.num_start_pos) sim_robots = [env_config.robot_factory() for _ in range(n)] sim = Simulator( env_config.sim_config, map_def, sim_robots,