ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Points 1 and 3: You need to declare the tf_prefix parameter before you load anything that publishes TFs that should be in the namespace.

Move the line <param name="tf_prefix" value="qbot0" /> in your launch file before:

<!-- run kobuki base -->
<include file="$(find kobuki_node)/launch/minimal.launch"/>

Also the static_transform_publisher does not use the parameter I think, so you should either move those links to the URDF or use an argument for those transforms.

With the argument your launch file would look something like this:

<launch>
<group ns="qbot0">
    <arg name="tf_prefix" default="qbot0"/>
    <param name="tf_prefix" value="$(arg tf_prefix)" />

    <!-- run kobuki base -->
    <include file="$(find kobuki_node)/launch/minimal.launch"/>

    <!-- tf config -->
    <node pkg="tf" type="static_transform_publisher" name="camera_to_base" args="0 0 0.1 0 0.0 0 $(arg tf_prefix)/base_footprint $(arg tf_prefix)/camera_link 100"/>
    <node pkg="tf" type="static_transform_publisher" name="robot_state_publisher" args="0 0 0 0 0.0 0 $(arg tf_prefix)/base_footprint $(arg tf_prefix)/base_link 100"/>

    <!-- run kinect -->
    <include file="$(find freenect_launch)/launch/freenect.launch" />
</group>
</launch>

As for point 2. There are a range of tools that would help with debuging. The rosrun tf view_frames and rosrun rqt_tf_tree rqt_tf_tree both provide sources for the transform, there are other tools to work with tf like

$ rosrun tf 
bullet_migration_sed.py     tf_change_notifier          tf_empty_listener           tf_remap
static_transform_publisher  tf_echo                     tf_monitor                  view_frames

And there are more, but it's too much for me to go into right now.

Points 1 and 3: You need to declare the tf_prefix parameter before you load anything that publishes TFs that should be in the namespace.

Move the line <param name="tf_prefix" value="qbot0" /> in your launch file before:

<!-- run kobuki base -->
<include file="$(find kobuki_node)/launch/minimal.launch"/>

Also the static_transform_publisher does not use the parameter I think, so you should either move those links to the URDF or use an argument for those transforms.

With the argument your launch file would look something like this:

<launch>
<group ns="qbot0">
    <arg name="tf_prefix" default="qbot0"/>
<group ns="$(arg tf_prefix)">
    <param name="tf_prefix" value="$(arg tf_prefix)" />

    <!-- run kobuki base -->
    <include file="$(find kobuki_node)/launch/minimal.launch"/>

    <!-- tf config -->
    <node pkg="tf" type="static_transform_publisher" name="camera_to_base" args="0 0 0.1 0 0.0 0 $(arg tf_prefix)/base_footprint $(arg tf_prefix)/camera_link 100"/>
    <node pkg="tf" type="static_transform_publisher" name="robot_state_publisher" args="0 0 0 0 0.0 0 $(arg tf_prefix)/base_footprint $(arg tf_prefix)/base_link 100"/>

    <!-- run kinect -->
    <include file="$(find freenect_launch)/launch/freenect.launch" />
</group>
</launch>

As for point 2. There are a range of tools that would help with debuging. The rosrun tf view_frames and rosrun rqt_tf_tree rqt_tf_tree both provide sources for the transform, there are other tools to work with tf like

$ rosrun tf 
bullet_migration_sed.py     tf_change_notifier          tf_empty_listener           tf_remap
static_transform_publisher  tf_echo                     tf_monitor                  view_frames

And there are more, but it's too much for me to go into right now.

Points 1 and 3: You need to declare the tf_prefix parameter before you load anything that publishes TFs that should be in the namespace.

Move the line <param name="tf_prefix" value="qbot0" /> in your launch file before:

<!-- run kobuki base -->
<include file="$(find kobuki_node)/launch/minimal.launch"/>

Also the static_transform_publisher does not use the parameter I think, so you should either move those links to the URDF or use an argument for those transforms.

With the argument your launch file would look something like this:

<launch>
<arg name="tf_prefix" default="qbot0"/>
<group ns="$(arg tf_prefix)">
    <param name="tf_prefix" value="$(arg tf_prefix)" />

    <!-- run kobuki base -->
    <include file="$(find kobuki_node)/launch/minimal.launch"/>

    <!-- tf config -->
    <node pkg="tf" type="static_transform_publisher" name="camera_to_base" args="0 0 0.1 0 0.0 0 $(arg tf_prefix)/base_footprint $(arg tf_prefix)/camera_link 100"/>
    <node pkg="tf" type="static_transform_publisher" name="robot_state_publisher" args="0 0 0 0 0.0 0 $(arg tf_prefix)/base_footprint $(arg tf_prefix)/base_link 100"/>

    <!-- run kinect -->
    <include file="$(find freenect_launch)/launch/freenect.launch" />
</group>
</launch>

As for point 2. There are a range of tools that would help with debuging. The rosrun tf view_frames and rosrun rqt_tf_tree rqt_tf_tree both provide sources for the transform, there are other tools to work with tf like

$ rosrun tf 
bullet_migration_sed.py     tf_change_notifier          tf_empty_listener           tf_remap
static_transform_publisher  tf_echo                     tf_monitor                  view_frames

And there are more, but it's too much for me to go into right now.


updated answer

I changed the arg tf_prefix I previously used in the launch file to robot_name to be less confusing. As @jaindu mentions it is possible to pass the tf_prefix to rgbd_camera kinect_frames.launch from looking at the launch files you should include the freenect_tf_prefix.launch instead of freenect.launch for that, the relevant lines would look something like this:

<include file="$(find freenect_launch)/launch/freenect_tf_prefix.launch">
    <arg name="tf_prefix" default="$(arg robot_name)"/>
</include>

as for the kobuki_node stuff it is a bit harder to test without setting up quite a bit of stuff. As far as I can tell, setting the parameters in the kobuki_node minimal.launch should fix the problem. As I said it's not very easy to test without actual feedback but adding the params odom_frame and base_frame to minimal.launch, passing the robot_name arg and using it in the params might work. Here is my guess as to what might work:

kobuki_node minimal.launch

<!--
  Standalone launcher for running a default Kobuki
 -->
<launch>
  <arg name="kobuki_publish_tf" default="true"/> <!-- Publish base_footprint - odom transforms (usually good thing to have for localisation) -->
  <arg name="tf_prefix" default=""/>

  <node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/>
  <node pkg="nodelet" type="nodelet" name="mobile_base" args="load kobuki_node/KobukiNodelet mobile_base_nodelet_manager">
    <rosparam file="$(find kobuki_node)/param/base.yaml" command="load"/>
    <param name="odom_frame" value="$(arg tf_prefix)/odom"/>
    <param name="base_frame" value="$(arg tf_prefix)/base_frame"/>
    <param name="publish_tf" value="$(arg kobuki_publish_tf)"/>
    <remap from="mobile_base/odom" to="odom"/>
    <remap from="mobile_base/joint_states" to="joint_states"/>
  </node>

  <node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" >
    <rosparam command="load" file="$(find kobuki_node)/param/diagnostics.yaml" />
  </node>
</launch>

your launch file as the tf_prefix param does not have an effect in this file, I removed it.

<launch>
    <arg name="robot_name" default="qbot0"/>
    <group ns="$(arg robot_name)">

        <!-- run kobuki base -->
        <!-- <include file="$(find kobuki_node)/launch/minimal.launch"/> -->
        <include file="$(find kobuki_node)/launch/minimal.launch">
            <arg name="tf_prefix" default="$(arg robot_name)"/>    
        </include>

        <!-- tf config -->
        <node pkg="tf" type="static_transform_publisher" name="camera_to_base" args="0 0 0.1 0 0.0 0 $(arg robot_name)/base_footprint $(arg robot_name)/camera_link 100"/>
        <node pkg="tf" type="static_transform_publisher" name="robot_state_publisher" args="0 0 0 0 0.0 0 $(arg robot_name)/base_footprint $(arg robot_name)/base_link 100"/>

        <!-- run kinect -->
        <!-- <include file="$(find freenect_launch)/launch/freenect.launch" /> -->
        <include file="$(find freenect_launch)/launch/freenect_tf_prefix.launch">
            <arg name="tf_prefix" default="$(arg robot_name)"/>
        </include>
    </group>
</launch>

Points 1 and 3: You need to declare the tf_prefix parameter before you load anything that publishes TFs that should be in the namespace.

Move the line <param name="tf_prefix" value="qbot0" /> in your launch file before:

<!-- run kobuki base -->
<include file="$(find kobuki_node)/launch/minimal.launch"/>

Also the static_transform_publisher does not use the parameter I think, so you should either move those links to the URDF or use an argument for those transforms.

With the argument your launch file would look something like this:

<launch>
<arg name="tf_prefix" default="qbot0"/>
<group ns="$(arg tf_prefix)">
    <param name="tf_prefix" value="$(arg tf_prefix)" />

    <!-- run kobuki base -->
    <include file="$(find kobuki_node)/launch/minimal.launch"/>

    <!-- tf config -->
    <node pkg="tf" type="static_transform_publisher" name="camera_to_base" args="0 0 0.1 0 0.0 0 $(arg tf_prefix)/base_footprint $(arg tf_prefix)/camera_link 100"/>
    <node pkg="tf" type="static_transform_publisher" name="robot_state_publisher" args="0 0 0 0 0.0 0 $(arg tf_prefix)/base_footprint $(arg tf_prefix)/base_link 100"/>

    <!-- run kinect -->
    <include file="$(find freenect_launch)/launch/freenect.launch" />
</group>
</launch>

As for point 2. There are a range of tools that would help with debuging. The rosrun tf view_frames and rosrun rqt_tf_tree rqt_tf_tree both provide sources for the transform, there are other tools to work with tf like

$ rosrun tf 
bullet_migration_sed.py     tf_change_notifier          tf_empty_listener           tf_remap
static_transform_publisher  tf_echo                     tf_monitor                  view_frames

And there are more, but it's too much for me to go into right now.


updated answer

I changed the arg tf_prefix I previously used in the launch file to robot_name to be less confusing. As @jaindu mentions it is possible to pass the tf_prefix to rgbd_camera kinect_frames.launch from looking at the launch files you should include the freenect_tf_prefix.launch instead of freenect.launch for that, the relevant lines would look something like this:

<include file="$(find freenect_launch)/launch/freenect_tf_prefix.launch">
    <arg name="tf_prefix" default="$(arg robot_name)"/>
</include>

as for the kobuki_node stuff it is a bit harder to test without setting up quite a bit of stuff. As far as I can tell, setting the parameters in the kobuki_node minimal.launch should fix the problem. As I said it's not very easy to test without actual feedback but adding the params odom_frame and base_frame to minimal.launch, passing the robot_name arg and using it in the params might work. Here is my guess as to what might work:

kobuki_node minimal.launch

<!--
  Standalone launcher for running a default Kobuki
 -->
<launch>
  <arg name="kobuki_publish_tf" default="true"/> <!-- Publish base_footprint - odom transforms (usually good thing to have for localisation) -->
  <arg name="tf_prefix" default=""/>

  <node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/>
  <node pkg="nodelet" type="nodelet" name="mobile_base" args="load kobuki_node/KobukiNodelet mobile_base_nodelet_manager">
    <rosparam file="$(find kobuki_node)/param/base.yaml" command="load"/>
    <param name="odom_frame" value="$(arg tf_prefix)/odom"/>
    <param name="base_frame" value="$(arg tf_prefix)/base_frame"/>
    <param name="publish_tf" value="$(arg kobuki_publish_tf)"/>
    <remap from="mobile_base/odom" to="odom"/>
    <remap from="mobile_base/joint_states" to="joint_states"/>
  </node>

  <node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" >
    <rosparam command="load" file="$(find kobuki_node)/param/diagnostics.yaml" />
  </node>
</launch>

your launch file as the tf_prefix param does not have an effect in this file, I removed it.

<launch>
    <arg name="robot_name" default="qbot0"/>
    <group ns="$(arg robot_name)">

        <!-- run kobuki base -->
        <!-- <include file="$(find kobuki_node)/launch/minimal.launch"/> -->
        <include file="$(find kobuki_node)/launch/minimal.launch">
            <arg name="tf_prefix" default="$(arg robot_name)"/>    
        </include>

        <!-- tf config -->
        <node pkg="tf" type="static_transform_publisher" name="camera_to_base" args="0 0 0.1 0 0.0 0 $(arg robot_name)/base_footprint $(arg robot_name)/camera_link 100"/>
        <node pkg="tf" type="static_transform_publisher" name="robot_state_publisher" args="0 0 0 0 0.0 0 $(arg robot_name)/base_footprint $(arg robot_name)/base_link 100"/>

        <!-- run kinect -->
        <!-- <include file="$(find freenect_launch)/launch/freenect.launch" /> -->
        <include file="$(find freenect_launch)/launch/freenect_tf_prefix.launch">
            <arg name="tf_prefix" default="$(arg robot_name)"/>
        </include>
    </group>
</launch>

Points 1 and 3: You need to declare the tf_prefix parameter before you load anything that publishes TFs that should be in the namespace.

Move the line <param name="tf_prefix" value="qbot0" /> in your launch file before:

<!-- run kobuki base -->
<include file="$(find kobuki_node)/launch/minimal.launch"/>

Also the static_transform_publisher does not use the parameter I think, so you should either move those links to the URDF or use an argument for those transforms.

With the argument your launch file would look something like this:

<launch>
<arg name="tf_prefix" default="qbot0"/>
<group ns="$(arg tf_prefix)">
    <param name="tf_prefix" value="$(arg tf_prefix)" />

    <!-- run kobuki base -->
    <include file="$(find kobuki_node)/launch/minimal.launch"/>

    <!-- tf config -->
    <node pkg="tf" type="static_transform_publisher" name="camera_to_base" args="0 0 0.1 0 0.0 0 $(arg tf_prefix)/base_footprint $(arg tf_prefix)/camera_link 100"/>
    <node pkg="tf" type="static_transform_publisher" name="robot_state_publisher" args="0 0 0 0 0.0 0 $(arg tf_prefix)/base_footprint $(arg tf_prefix)/base_link 100"/>

    <!-- run kinect -->
    <include file="$(find freenect_launch)/launch/freenect.launch" />
</group>
</launch>

As for point 2. There are a range of tools that would help with debuging. The rosrun tf view_frames and rosrun rqt_tf_tree rqt_tf_tree both provide sources for the transform, there are other tools to work with tf like

$ rosrun tf 
bullet_migration_sed.py     tf_change_notifier          tf_empty_listener           tf_remap
static_transform_publisher  tf_echo                     tf_monitor                  view_frames

And there are more, but it's too much for me to go into right now.


updated answer

I changed the arg tf_prefix I previously used in the launch file to robot_name to be less confusing. As @jaindu mentions it is possible to pass the tf_prefix to kinect_frames.launch from looking at the launch files you should include the freenect_tf_prefix.launch instead of freenect.launch for that, the relevant lines would look something like this:

<include file="$(find freenect_launch)/launch/freenect_tf_prefix.launch">
    <arg name="tf_prefix" default="$(arg robot_name)"/>
</include>

as for the kobuki_node stuff it is a bit harder to test without setting up quite a bit of stuff. As far as I can tell, setting the parameters in the kobuki_node minimal.launch should fix the problem. As I said it's not very easy to test without actual feedback but adding the params odom_frame and base_frame to minimal.launch, passing the robot_name arg and using it in the params might work. Here is my guess as to what might work:

kobuki_node minimal.launch

<!--
  Standalone launcher for running a default Kobuki
 -->
<launch>
  <arg name="kobuki_publish_tf" default="true"/> <!-- Publish base_footprint - odom transforms (usually good thing to have for localisation) -->
  <arg name="tf_prefix" default=""/>

  <node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/>
  <node pkg="nodelet" type="nodelet" name="mobile_base" args="load kobuki_node/KobukiNodelet mobile_base_nodelet_manager">
    <rosparam file="$(find kobuki_node)/param/base.yaml" command="load"/>
    <param name="odom_frame" value="$(arg tf_prefix)/odom"/>
    <param name="base_frame" value="$(arg tf_prefix)/base_frame"/>
    <param name="publish_tf" value="$(arg kobuki_publish_tf)"/>
    <remap from="mobile_base/odom" to="odom"/>
    <remap from="mobile_base/joint_states" to="joint_states"/>
  </node>

  <node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" >
    <rosparam command="load" file="$(find kobuki_node)/param/diagnostics.yaml" />
  </node>
</launch>

your launch file as the tf_prefix param does not have an effect in this file, I removed it.

<launch>
    <arg name="robot_name" default="qbot0"/>
    <group ns="$(arg robot_name)">

        <!-- run kobuki base -->
        <!-- <include file="$(find kobuki_node)/launch/minimal.launch"/> -->
        <include file="$(find kobuki_node)/launch/minimal.launch">
            <arg name="tf_prefix" default="$(arg robot_name)"/>    
        </include>

        <!-- tf config -->
        <node pkg="tf" type="static_transform_publisher" name="camera_to_base" args="0 0 0.1 0 0.0 0 $(arg robot_name)/base_footprint $(arg robot_name)/camera_link 100"/>
        <node pkg="tf" type="static_transform_publisher" name="robot_state_publisher" args="0 0 0 0 0.0 0 $(arg robot_name)/base_footprint $(arg robot_name)/base_link 100"/>

        <!-- run kinect -->
        <!-- <include file="$(find freenect_launch)/launch/freenect.launch" /> -->
        <include file="$(find freenect_launch)/launch/freenect_tf_prefix.launch">
            <arg name="tf_prefix" default="$(arg robot_name)"/>
        </include>
    </group>
</launch>

I guess I should add that neither of the packages use the tf_prefix as I think it was intended to be used. Kobuki does not use it based on the launch files I have seen so far (not many) and I have not looked at the code. And I guess not using it is OK. You can read more about it here tf_prefix deprecated