auto formatting

This commit is contained in:
Burak Ozter 2024-11-01 12:20:39 -03:00
parent de3aab205b
commit dfdcb284f8
1 changed files with 14 additions and 10 deletions

View File

@ -96,11 +96,11 @@ def start(tracker_instance: int = 0, sys_id: int = 1):
with logger.contextualize(syd_id=sys_id): with logger.contextualize(syd_id=sys_id):
env = os.environ env = os.environ
with modified_environ( with modified_environ(
SERIAL0_PORT =str( int(env['SERIAL0_PORT']) + 10 * tracker_instance), SERIAL0_PORT=str(int(env["SERIAL0_PORT"]) + 10 * tracker_instance),
MAVROS2_PORT=str( int(env['MAVROS2_PORT']) + 10 * tracker_instance), MAVROS2_PORT=str(int(env["MAVROS2_PORT"]) + 10 * tracker_instance),
MAVROS1_PORT=str( int(env['MAVROS1_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), FDM_PORT_IN=str(int(env["FDM_PORT_IN"]) + 10 * tracker_instance),
SITL_PORT=str( int(env['SITL_PORT']) + 10 * tracker_instance), SITL_PORT=str(int(env["SITL_PORT"]) + 10 * tracker_instance),
TRACKER_INSTANCE=str(tracker_instance), TRACKER_INSTANCE=str(tracker_instance),
DRONE_SYS_ID=str(sys_id), DRONE_SYS_ID=str(sys_id),
): ):
@ -119,7 +119,7 @@ def start(tracker_instance: int = 0, sys_id: int = 1):
@app.command() @app.command()
def start_group(): def start_group():
env = os.environ env = os.environ
sim_drone_count = int(env['SIM_DRONE_COUNT']) sim_drone_count = int(env["SIM_DRONE_COUNT"])
start_ros_master() start_ros_master()
"""Start a group of robots""" """Start a group of robots"""
for i in range(sim_drone_count): for i in range(sim_drone_count):
@ -128,6 +128,7 @@ def start_group():
# if i == 0: # if i == 0:
# wait_for_gazebo() # wait_for_gazebo()
def start_ros_master(): def start_ros_master():
docker_stack = sh.docker.compose( docker_stack = sh.docker.compose(
"--profile", "--profile",
@ -139,6 +140,7 @@ def start_ros_master():
) )
processes.append(docker_stack) processes.append(docker_stack)
def cleanup(): def cleanup():
# Wait for all subprocesses to exit # Wait for all subprocesses to exit
logger.info("Waiting for commands to exit") logger.info("Waiting for commands to exit")
@ -148,7 +150,9 @@ def cleanup():
for waitable in processes: for waitable in processes:
waitable.kill() waitable.kill()
waitable.wait() waitable.wait()
except Exception as e: print(e) except Exception as e:
print(e)
atexit.register(cleanup) atexit.register(cleanup)