From 4a826002bd32023fd393bb578557c761c142148c Mon Sep 17 00:00:00 2001 From: Ignacio Vizzo Date: Mon, 7 Oct 2024 19:26:23 +0200 Subject: [PATCH] Bugfix: `if "false"` is always `True` (#617) There is an issue in this launch file when passing the string 'false' as an argument. In Python, non-empty strings are always evaluated as True, regardless of their content. This means that even if you pass 'false', the system will still evaluate it as True. This bug results in the launch system incorrectly calling the OnShutdown method twice. When any ROS launch action invokes a RosAdapter, it triggers the following exception: "Cannot shutdown a ROS adapter that is not running." To temporarily work around this issue, you can launch gz_sim_launch.py with the on_exit_shutdown argument set to an empty string. This prevents the erroneous shutdown sequence and avoids the associated exception. Signed-off-by: Ignacio Vizzo (cherry picked from commit 1e30af0105058d68c8f1c98f37904505f613cf97) --- ros_gz_sim/launch/gz_sim.launch.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ros_gz_sim/launch/gz_sim.launch.py.in b/ros_gz_sim/launch/gz_sim.launch.py.in index ba8244a9..8859d132 100644 --- a/ros_gz_sim/launch/gz_sim.launch.py.in +++ b/ros_gz_sim/launch/gz_sim.launch.py.in @@ -121,7 +121,7 @@ def launch_gz(context, *args, **kwargs): else: debug_prefix = None - if on_exit_shutdown: + if on_exit_shutdown != 'false': on_exit = Shutdown() else: on_exit = None