diff --git a/docker-compose.yml b/docker-compose.yml index 37d83e6..5e94ec7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,7 +52,7 @@ services: - -c - | ./Tools/autotest/sim_vehicle.py $ARDUPILOT_VEHICLE --no-rebuild \ - --no-mavproxy --enable-dds --sysid $DRONE_SYS_ID -I$TRACKER_INSTANCE + --no-mavproxy --enable-dds --sysid $DRONE_SYS_ID -I$INSTANCE profiles: - uav-sim stdin_open: true diff --git a/sim_drone.py b/sim_drone.py index e6eb46c..14d40f4 100644 --- a/sim_drone.py +++ b/sim_drone.py @@ -86,7 +86,7 @@ def modified_environ(*remove, **update): # @app.command() -def start(tracker_instance: int = 0, sys_id: int = 1): +def start(instance: int = 0, sys_id: int = 1): """Starts the simulated drone with a given sys_id, each drone must have it's own unique ID. """ @@ -96,12 +96,12 @@ def start(tracker_instance: int = 0, sys_id: int = 1): with logger.contextualize(syd_id=sys_id): env = os.environ with modified_environ( - SERIAL0_PORT=str(int(env["SERIAL0_PORT"]) + 10 * tracker_instance), - MAVROS2_PORT=str(int(env["MAVROS2_PORT"]) + 10 * tracker_instance), - MAVROS1_PORT=str(int(env["MAVROS1_PORT"]) + 10 * tracker_instance), - FDM_PORT_IN=str(int(env["FDM_PORT_IN"]) + 10 * tracker_instance), - SITL_PORT=str(int(env["SITL_PORT"]) + 10 * tracker_instance), - TRACKER_INSTANCE=str(tracker_instance), + SERIAL0_PORT=str(int(env["SERIAL0_PORT"]) + 10 * instance), + MAVROS2_PORT=str(int(env["MAVROS2_PORT"]) + 10 * instance), + MAVROS1_PORT=str(int(env["MAVROS1_PORT"]) + 10 * instance), + FDM_PORT_IN=str(int(env["FDM_PORT_IN"]) + 10 * instance), + SITL_PORT=str(int(env["SITL_PORT"]) + 10 * instance), + INSTANCE=str(instance), DRONE_SYS_ID=str(sys_id), ): logger.info("Starting drone stack, this may take some time") @@ -126,7 +126,7 @@ def start_group(): """Start a group of robots""" for i in range(sim_drone_count): logger.info(f"start robot {i}") - start(tracker_instance=i, sys_id=i + 1) + start(instance=i, sys_id=i + 1) # if i == 0: # wait_for_gazebo()