-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from benjaminwp18/yaml-suppport
Yaml suppport
- Loading branch information
Showing
10 changed files
with
237 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
mqtt_ros_bridge: | ||
ros__parameters: | ||
turtle_pub: | ||
topic: "/turtle1/cmd_vel" | ||
type: "geometry_msgs.msg:Twist" | ||
publish_on_ros: True | ||
|
||
yippee: | ||
topic: "foo" | ||
type: "std_msgs.msg:String" | ||
publish_on_ros: True | ||
use_ros_serializer: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
mqtt_ros_bridge: | ||
ros__parameters: | ||
turtle_pub: | ||
topic: "/turtle1/cmd_vel" | ||
type: "geometry_msgs.msg:Twist" | ||
publish_on_ros: False | ||
|
||
yippee: | ||
topic: "foo" | ||
type: "std_msgs.msg:String" | ||
publish_on_ros: True | ||
use_ros_serializer: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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 | ||
|
||
|
||
def generate_launch_description() -> LaunchDescription: | ||
""" | ||
Generate LaunchDescription for MQTT ROS bridge. | ||
Returns | ||
------- | ||
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] | ||
) | ||
|
||
return LaunchDescription([ | ||
SetEnvironmentVariable("ROS_DOMAIN_ID", "2"), | ||
run_bridge_node | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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 | ||
|
||
|
||
def generate_launch_description() -> LaunchDescription: | ||
""" | ||
Generate LaunchDescription for MQTT ROS bridge. | ||
Returns | ||
------- | ||
LaunchDescription | ||
Launches bridge_node. | ||
""" | ||
config = os.path.join( | ||
get_package_share_directory('mqtt_ros_bridge'), | ||
'config', | ||
'sub.yaml' | ||
) | ||
|
||
run_bridge_node = Node( | ||
package='mqtt_ros_bridge', | ||
executable='bridge_node', | ||
emulate_tty=True, | ||
output='screen', | ||
arguments=[config] | ||
) | ||
|
||
turtle_sim = Node( | ||
package='rqt_robot_steering', | ||
executable='rqt_robot_steering', | ||
emulate_tty=True, | ||
parameters=[{"topic": "/turtle1/cmd_vel"}], | ||
output='screen' | ||
) | ||
|
||
return LaunchDescription([ | ||
SetEnvironmentVariable("ROS_DOMAIN_ID", "1"), | ||
run_bridge_node, | ||
turtle_sim | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from launch.actions import SetEnvironmentVariable | ||
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. | ||
""" | ||
turtle_sim = Node( | ||
package='turtlesim', | ||
executable='turtlesim_node', | ||
emulate_tty=True, | ||
output='screen' | ||
) | ||
|
||
return LaunchDescription([ | ||
SetEnvironmentVariable("ROS_DOMAIN_ID", "2"), | ||
turtle_sim | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from importlib import import_module | ||
from typing import cast | ||
|
||
from mqtt_ros_bridge.msg_typing import MsgLike | ||
|
||
|
||
def lookup_message(object_path: str, package: str = 'mqtt_ros_bridge') -> MsgLike: | ||
"""Lookup message from a some.module:object_name specification.""" | ||
return cast(MsgLike, _lookup_object(object_path, package)) | ||
|
||
|
||
def _lookup_object(object_path: str, package: str = 'mqtt_ros_bridge') -> object: | ||
"""Lookup object from a some.module:object_name specification.""" | ||
module_name, obj_name = object_path.split(":") | ||
module = import_module(module_name, package) | ||
obj = getattr(module, obj_name) | ||
return obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters