Skip to content

Instantly share code, notes, and snippets.

@jonbinney
Created January 11, 2013 19:24
Show Gist options
  • Save jonbinney/4513241 to your computer and use it in GitHub Desktop.
Save jonbinney/4513241 to your computer and use it in GitHub Desktop.
Allow nodelets to run under a given namespace
diff -r 7126145eb885 launch/kinect_frames.launch
--- a/launch/kinect_frames.launch Tue Dec 11 11:23:14 2012 -0800
+++ b/launch/kinect_frames.launch Sat Jan 05 19:33:48 2013 +0530
@@ -9,13 +9,13 @@
<arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)" />
<node pkg="tf" type="static_transform_publisher" name="$(arg camera)_base_link"
- args="0 -0.02 0 0 0 0 /$(arg camera)_link /$(arg camera)_depth_frame 100" />
+ args="0 -0.02 0 0 0 0 $(arg camera)_link $(arg camera)_depth_frame 100" />
<node pkg="tf" type="static_transform_publisher" name="$(arg camera)_base_link1"
- args="0 -0.045 0 0 0 0 /$(arg camera)_link /$(arg camera)_rgb_frame 100" />
+ args="0 -0.045 0 0 0 0 $(arg camera)_link $(arg camera)_rgb_frame 100" />
<node pkg="tf" type="static_transform_publisher" name="$(arg camera)_base_link2"
- args="$(arg optical_rotate) /$(arg camera)_depth_frame /$(arg camera)_depth_optical_frame 100" />
+ args="$(arg optical_rotate) $(arg camera)_depth_frame $(arg camera)_depth_optical_frame 100" />
<node pkg="tf" type="static_transform_publisher" name="$(arg camera)_base_link3"
- args="$(arg optical_rotate) /$(arg camera)_rgb_frame /$(arg camera)_rgb_optical_frame 100" />
+ args="$(arg optical_rotate) $(arg camera)_rgb_frame $(arg camera)_rgb_optical_frame 100" />
</launch>
<!-- TODO Could instead store these in camera_pose_calibration format for consistency
diff -r 7126145eb885 launch/openni.launch
--- a/launch/openni.launch Tue Dec 11 11:23:14 2012 -0800
+++ b/launch/openni.launch Sat Jan 05 19:33:48 2013 +0530
@@ -3,9 +3,11 @@
<!-- "camera" should uniquely identify the device. All topics are pushed down
into the "camera" namespace, and it is prepended to tf frame ids. -->
+ <arg name="ns" default="" /> <!-- if supplied, then should be fully resolved -->
+ <arg name="tf_prefix" default="$(arg ns)" />
<arg name="camera" default="camera" />
- <arg name="rgb_frame_id" default="/$(arg camera)_rgb_optical_frame" />
- <arg name="depth_frame_id" default="/$(arg camera)_depth_optical_frame" />
+ <arg name="rgb_frame_id" default="$(arg tf_prefix)/$(arg camera)_rgb_optical_frame" />
+ <arg name="depth_frame_id" default="$(arg tf_prefix)/$(arg camera)_depth_optical_frame" />
<!-- device_id can have the following formats:
"B00367707227042B": Use device with given serial number
@@ -41,7 +43,7 @@
<arg name="bond" default="false" /> <!-- DEPRECATED, use respawn arg instead -->
<arg name="respawn" default="$(arg bond)" />
- <!-- Start nodelet manager in top-level namespace -->
+ <!-- Start nodelet manager in provided namespace -->
<arg name="manager" value="$(arg camera)_nodelet_manager" />
<arg name="debug" default="false" /> <!-- Run manager in GDB? -->
<include file="$(find openni_launch)/launch/includes/manager.launch">
@@ -49,6 +51,9 @@
<arg name="debug" value="$(arg debug)" />
</include>
+ <!-- figure out the resolved nodelet manager namespace -->
+ <arg name="resolved_manager" value="$(arg ns)/$(arg manager)" />
+
<!-- Push down all topics/nodelets into "camera" namespace -->
<group ns="$(arg camera)">
@@ -56,7 +61,7 @@
<include if="$(arg load_driver)"
file="$(find openni_launch)/launch/includes/device.launch">
<!-- Could really use some syntactic sugar for this -->
- <arg name="manager" value="/$(arg manager)" /> <!-- Fully resolved -->
+ <arg name="manager" value="$(arg resolved_manager)" /> <!-- fully resolved -->
<arg name="device_id" value="$(arg device_id)" />
<arg name="rgb_frame_id" value="$(arg rgb_frame_id)" />
<arg name="depth_frame_id" value="$(arg depth_frame_id)" />
@@ -73,7 +78,7 @@
<!-- Load standard constellation of processing nodelets -->
<include file="$(find openni_launch)/launch/includes/processing.launch">
- <arg name="manager" value="/$(arg manager)" /> <!-- Fully resolved -->
+ <arg name="manager" value="$(arg resolved_manager)" /> <!-- Fully resolved -->
<arg name="rgb" value="$(arg rgb)" />
<arg name="ir" value="$(arg ir)" />
<arg name="depth" value="$(arg depth)" />
@@ -85,6 +90,7 @@
</group> <!-- camera -->
<!-- Load reasonable defaults for the relative pose between cameras -->
+ <param name="tf_prefix" value="$(arg tf_prefix)" /> <!-- for static transform publisher -->
<include if="$(arg publish_tf)"
file="$(find openni_launch)/launch/kinect_frames.launch">
<arg name="camera" value="$(arg camera)" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment