From c47e70e8594433b18ec2b8763f48d6724e479372 Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Tue, 30 Apr 2024 10:47:25 -0400 Subject: [PATCH] lampi demo start --- config/lampi.yaml | 6 ++++ launch/bridge_launch.py | 24 ---------------- ...urtle_sim_launch.py => demo_pub_launch.py} | 28 ++++++++++++++++++- launch/demo_sub_launch.py | 10 ++++++- ...emo_pub_bridge_launch.py => lampi_demo.py} | 15 +++++++--- 5 files changed, 53 insertions(+), 30 deletions(-) create mode 100644 config/lampi.yaml delete mode 100644 launch/bridge_launch.py rename launch/{demo_turtle_sim_launch.py => demo_pub_launch.py} (50%) rename launch/{demo_pub_bridge_launch.py => lampi_demo.py} (79%) diff --git a/config/lampi.yaml b/config/lampi.yaml new file mode 100644 index 0000000..fc6552e --- /dev/null +++ b/config/lampi.yaml @@ -0,0 +1,6 @@ +mqtt_ros_bridge: + ros__parameters: + lampi: + topic: "/devices/b827eb3d9134/lamp/set_config" + type: "lampi_msgs.msg:Lampi" + publish_on_ros: False diff --git a/launch/bridge_launch.py b/launch/bridge_launch.py deleted file mode 100644 index 50f739d..0000000 --- a/launch/bridge_launch.py +++ /dev/null @@ -1,24 +0,0 @@ -from launch.launch_description import LaunchDescription -from launch_ros.actions import Node - - -def generate_launch_description() -> LaunchDescription: - """ - Generate LaunchDescription for MQTT ROS bridge. - - Returns - ------- - LaunchDescription - Launches bridge_node. - - """ - run_bridge_node = Node( - package='mqtt_ros_bridge', - executable='bridge_node', - emulate_tty=True, - output='screen' - ) - - return LaunchDescription([ - run_bridge_node - ]) diff --git a/launch/demo_turtle_sim_launch.py b/launch/demo_pub_launch.py similarity index 50% rename from launch/demo_turtle_sim_launch.py rename to launch/demo_pub_launch.py index 0c1e83b..b5e6e09 100644 --- a/launch/demo_turtle_sim_launch.py +++ b/launch/demo_pub_launch.py @@ -1,3 +1,6 @@ +import os + +from ament_index_python.packages import get_package_share_directory from launch.actions import SetEnvironmentVariable from launch.launch_description import LaunchDescription from launch_ros.actions import Node @@ -13,6 +16,20 @@ def generate_launch_description() -> LaunchDescription: Launches bridge_node. """ + config = os.path.join( + get_package_share_directory('mqtt_ros_bridge'), + 'config', + 'pub.yaml' + ) + + run_bridge_node = Node( + package='mqtt_ros_bridge', + executable='bridge_node', + emulate_tty=True, + output='screen', + arguments=[config] + ) + turtle_sim = Node( package='turtlesim', executable='turtlesim_node', @@ -20,7 +37,16 @@ def generate_launch_description() -> LaunchDescription: output='screen' ) + rqt = Node( + package='rqt_gui', + executable='rqt_gui', + emulate_tty=True, + output='screen' + ) + return LaunchDescription([ SetEnvironmentVariable("ROS_DOMAIN_ID", "2"), - turtle_sim + run_bridge_node, + turtle_sim, + rqt ]) diff --git a/launch/demo_sub_launch.py b/launch/demo_sub_launch.py index d81e866..b6f02c0 100644 --- a/launch/demo_sub_launch.py +++ b/launch/demo_sub_launch.py @@ -38,8 +38,16 @@ def generate_launch_description() -> LaunchDescription: output='screen' ) + rqt = Node( + package='rqt_gui', + executable='rqt_gui', + emulate_tty=True, + output='screen' + ) + return LaunchDescription([ SetEnvironmentVariable("ROS_DOMAIN_ID", "1"), run_bridge_node, - turtle_sim + turtle_sim, + rqt ]) diff --git a/launch/demo_pub_bridge_launch.py b/launch/lampi_demo.py similarity index 79% rename from launch/demo_pub_bridge_launch.py rename to launch/lampi_demo.py index ac0cb7f..8b6f55e 100644 --- a/launch/demo_pub_bridge_launch.py +++ b/launch/lampi_demo.py @@ -19,8 +19,8 @@ def generate_launch_description() -> LaunchDescription: config = os.path.join( get_package_share_directory('mqtt_ros_bridge'), 'config', - 'pub.yaml' - ) + 'lampi.yaml' + ) run_bridge_node = Node( package='mqtt_ros_bridge', @@ -30,7 +30,14 @@ def generate_launch_description() -> LaunchDescription: arguments=[config] ) + rqt = Node( + package='rqt_gui', + executable='rqt_gui', + emulate_tty=True, + output='screen' + ) + return LaunchDescription([ - SetEnvironmentVariable("ROS_DOMAIN_ID", "2"), - run_bridge_node + run_bridge_node, + rqt ])