Skip to content

Commit

Permalink
Make sure topics start with /
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelchang committed Mar 1, 2016
1 parent 4724024 commit d0696cd
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
74 changes: 74 additions & 0 deletions launch/example.launch~
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0"?>
<launch>
<arg name="host" default="raphaelchang.com" />
<arg name="port" default="8080"/>
<node pkg="roscloud_client" type="client_node.py" name="foo_client_node" output="screen">
<param name="name" value="foo"/>
<param name="host" value="$(arg host)"/>
<param name="port" value="$(arg port)"/>
<param name="private_key" value="MIICXAIBAAKBgQCTUQ49FJUCVvU5tIag" />
<param name="description" value="foo robot" />
</node>

<node pkg="roscloud_client" type="client_node.py" name="bar_client_node" output="screen">
<param name="name" value="bar"/>
<param name="host" value="$(arg host)"/>
<param name="port" value="$(arg port)"/>
<param name="private_key" value="MIICXAIBAAKBgQCTUQ49FJUCVvU5tIag" />
<param name="description" value="bar robot" />
</node>

<node pkg="roscloud_client" type="client_node.py" name="baz_client_node" output="screen">
<param name="name" value="baz"/>
<param name="host" value="$(arg host)"/>
<param name="port" value="$(arg port)"/>
<param name="private_key" value="MIICXAIBAAKBgQCTUQ49FJUCVvU5tIag" />
<param name="description" value="baz robot" />
</node>

<node pkg="roscloud_client" type="client_node.py" name="qux_client_node" output="screen">
<param name="name" value="qux"/>
<param name="host" value="$(arg host)"/>
<param name="port" value="$(arg port)"/>
<param name="private_key" value="MIICXAIBAAKBgQCTUQ49FJUCVvU5tIag" />
<param name="description" value="qux robot" />
<rosparam>
publishing:
- /state
- /filtered_state
- /usb_cam/image_raw/compressed
- /test_string
types:
- geometry_msgs/Point
- geometry_msgs/Point
- sensor_msgs/CompressedImage
- std_msgs/String
trusted:
- ".*"
- foo bar
- foo
- "ba[a-z]"
</rosparam>

</node>

<node pkg="rostopic" type="rostopic" name="state_pub"
args="pub -r 100 /state geometry_msgs/Point '{x: 1, y: 1, z: 0}'"/>
<node pkg="rostopic" type="rostopic" name="filtered_state_pub"
args="pub -r 100 /filtered_state geometry_msgs/Point '{x: 2, y: 1, z: 1}'" />
<node pkg="rostopic" type="rostopic" name="string_pub"
args="pub -r 100 /test_string std_msgs/String 'test'" />
<node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
<param name="video_device" value="/dev/video0" />
<param name="image_width" value="640" />
<param name="image_height" value="480" />
<param name="pixel_format" value="yuyv" />
<param name="camera_frame_id" value="usb_cam" />
<param name="io_method" value="mmap"/>
</node>
<!-- <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen"> -->
<!-- <remap from="image" to="/qux/usb_cam/image_raw"/> -->
<!-- <param name="autosize" value="true" /> -->
<!-- </node> -->

</launch>
2 changes: 2 additions & 0 deletions src/client_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def __init__(self, host, port, name, broadcasting, private_key, description):
# Runs a loop that checks for received messages.
def run(self):
for topic, msg_type, trusted in self.broadcasting:
if topic[0] != "/":
topic = "/" + topic
self.create_subscriber(topic, msg_type, trusted)
if topic == "/receiving":
rospy.logerror("{}: topic name 'receiving' is reserved".format(
Expand Down

0 comments on commit d0696cd

Please sign in to comment.