diff --git a/workspace/src/application_pkg/application_pkg/web_node.py b/workspace/src/application_pkg/application_pkg/web_node.py index 1505aec..02abeaf 100755 --- a/workspace/src/application_pkg/application_pkg/web_node.py +++ b/workspace/src/application_pkg/application_pkg/web_node.py @@ -104,10 +104,13 @@ class _ThreadingHTTPServer(socketserver.ThreadingMixIn, HTTPServer): class WebNode(Node): - def __init__(self, port=8080): + def __init__(self): super().__init__('web_node') global _mode_publisher + self.declare_parameter('port', 8080) + port = self.get_parameter('port').value + self._mode_publisher = self.create_publisher( String, '/gimbal/mode', 10 ) diff --git a/workspace/src/bringup_pkg/launch/vision_pipeline.launch.py b/workspace/src/bringup_pkg/launch/vision_pipeline.launch.py index c762320..f25cec4 100755 --- a/workspace/src/bringup_pkg/launch/vision_pipeline.launch.py +++ b/workspace/src/bringup_pkg/launch/vision_pipeline.launch.py @@ -1,6 +1,11 @@ from launch import LaunchDescription from launch_ros.actions import Node +# Port allocation to avoid conflicts: +# :8080 - web_node (HTTP API) +# :8081 - web_video_server (MJPEG stream) +# :9090 - rosbridge_websocket (WebSocket) + def generate_launch_description(): return LaunchDescription([ @@ -21,6 +26,7 @@ def generate_launch_description(): executable='web_node', name='web_node', output='screen', + parameters=[{'port': 8080}], ), Node( package='gimbal_control_pkg', @@ -37,11 +43,13 @@ def generate_launch_description(): executable='rosbridge_websocket', name='rosbridge_websocket', output='screen', + parameters=[{'port': 9090}], ), Node( package='web_video_server', executable='web_video_server', name='web_video_server', output='screen', + parameters=[{'port': 8081}], ), ])