fix: suppress shutdown errors and align rosbridge params with Jazzy defaults

- Wrap rclpy.shutdown() in try/except across all nodes to avoid
  "rcl_shutdown already called" errors when launched via ros2 launch.
- Replace web_node's server.shutdown() with server_close() to prevent
  the HTTP server from hanging on SIGINT (shutdown() waits on an event
  only set by serve_forever, which the timer-based approach doesn't use).
- Set rosbridge_websocket default_call_service_timeout=5.0,
  call_services_in_new_thread=True, send_action_goals_in_new_thread=True
  to match upcoming Jazzy defaults and silence startup warnings.
This commit is contained in:
dev01
2026-06-02 21:23:10 +08:00
parent d81558d1be
commit 64da9fd848
5 changed files with 23 additions and 6 deletions
@@ -153,4 +153,7 @@ def main():
pass
finally:
node.destroy_node()
rclpy.shutdown()
try:
rclpy.shutdown()
except RuntimeError:
pass
@@ -132,7 +132,7 @@ class WebNode(Node):
break
def destroy_node(self):
self._server.shutdown()
self._server.server_close()
super().destroy_node()
@@ -145,4 +145,7 @@ def main():
pass
finally:
node.destroy_node()
rclpy.shutdown()
try:
rclpy.shutdown()
except RuntimeError:
pass
@@ -43,7 +43,12 @@ def generate_launch_description():
executable='rosbridge_websocket',
name='rosbridge_websocket',
output='screen',
parameters=[{'port': 9090}],
parameters=[{
'port': 9090,
'default_call_service_timeout': 5.0,
'call_services_in_new_thread': True,
'send_action_goals_in_new_thread': True,
}],
),
Node(
package='web_video_server',
@@ -250,4 +250,7 @@ def main():
finally:
node.cleanup()
node.destroy_node()
rclpy.shutdown()
try:
rclpy.shutdown()
except RuntimeError:
pass
@@ -159,4 +159,7 @@ def main():
pass
finally:
node.destroy_node()
rclpy.shutdown()
try:
rclpy.shutdown()
except RuntimeError:
pass