Skip to content

Commit

Permalink
Bugfix: if "false" is always True (#617)
Browse files Browse the repository at this point in the history
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 <[email protected]>
(cherry picked from commit 1e30af0)
  • Loading branch information
nachovizzo authored and mergify[bot] committed Nov 8, 2024
1 parent 2658f27 commit 4a82600
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ros_gz_sim/launch/gz_sim.launch.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4a82600

Please sign in to comment.