Ask Your Question
0

Changing tf_prefix for turtlebot

asked 2016-07-13 18:45:46 -0500

David_Zizu gravatar image

updated 2016-07-13 18:48:07 -0500

I know that similar questions were already asked here but I still haven't found an answer to my question. I would like to create a system of several turtlebots with different names (e.g. "pinky", "inky" etc). I need to navigate them and, therefore, I need different tf_prefix for each turtlebot. However, I don't know how to change the tf_prefix for odom frame. I changed the namespace by organizing each turtlebot in a separate group (e.g. group ns="pinky"). But when I set in a launch file, the odom frame remains unchanged. I had similar problems with turtlebot_gazebo; however, I solved it by writing group name and tf_prefix together. Nevertheless, this solution doesn't work for the real turtlebot. Here is my launch file:

<launch>
   <!--Here I try to set the namespace and add tf_prefix-->
   <group ns="pinky">
   <param name="tf_prefix" value="pinky" />

  <arg name="base"       default="$(optenv TURTLEBOT_BASE kobuki)"/>  <!-- create, rhoomba -->
  <arg name="battery"    default="$(optenv TURTLEBOT_BATTERY /sys/class/power_supply/BAT0)"/>  <!-- /proc/acpi/battery/BAT0 in 2.6 or earlier kernels-->
  <arg name="stacks"     default="$(optenv TURTLEBOT_STACKS hexagons)"/>  <!-- circles, hexagons -->
  <arg name="3d_sensor"  default="$(optenv TURTLEBOT_3D_SENSOR kinect)"/>  <!-- kinect, asus_xtion_pro -->
  <arg name="simulation" default="$(optenv TURTLEBOT_SIMULATION false)"/>

  <param name="/use_sim_time" value="$(arg simulation)"/>

  <include file="$(find turtlebot_bringup)/launch/includes/robot.launch.xml">
  <arg name="base" value="$(arg base)" />
  <arg name="stacks" value="$(arg stacks)" />
  <arg name="3d_sensor" value="$(arg 3d_sensor)" />
  </include>
  <include file="$(find turtlebot_bringup)/launch/includes/mobile_base.launch.xml">
  <arg name="base" value="$(arg base)" />
  </include>
  <include file="$(find turtlebot_bringup)/launch/includes/netbook.launch.xml">
  <arg name="battery" value="$(arg battery)" />
  </include>

</group>
</launch>

I am not able to attach photo, but here is the description of my tree:


                                odom                             pinky/base_footprint
                                   |                                       |
                                  \/                                      \/
                           base_footprint                          pinky/base_link
                                                                          |
                                                        /                 |       \
                                                   pinky/...        pinky/...   pinky/...

Could someone please help me solve this problem? Thanks in advance!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-07-15 19:29:02 -0500

David_Zizu gravatar image

Finally I found a solution to my problem. I had to add the name of the robot to the base.yaml. There are two lines which specify "Name of odometry TF frame" and "Name of base TF frame." As a result I just had to add name of the robot to odom and base_footprint frames.

edit flag offensive delete link more

Comments

1

How did you add the name of the robot to odom and base_footprint? robot_name_odom or robot_name/odom ?? I'm struggling with the same problem and can't get either solution to work. Thanks

j_salfity gravatar imagej_salfity ( 2017-06-23 18:04:10 -0500 )edit

Yes: please post code as well as or instead of a "this is what I did" description.

Will Chamberlain gravatar imageWill Chamberlain ( 2018-10-07 07:44:14 -0500 )edit
1

answered 2016-07-15 16:30:46 -0500

Chrissi gravatar image

Try to find where the robot_pose_ekf is started for your robot (that depends on the base if I am not mistaken). Should look something like this:

<node pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf">
<remap from="imu_data" to="imu/data"/>
<param name="freq" value="10.0"/>
<param name="sensor_timeout" value="1.0"/>
<param name="publish_tf" value="true"/>
<param name="odom_used" value="true"/>
<param name="imu_used" value="true"/>
<param name="vo_used" value="false"/>
<param name="output_frame" value="odom"/>
</node>

And change it to

<node  pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf" >
<param name="freq" value="30.0"/>
<param name="sensor_timeout" value="1.0"/>
<param name="publish_tf" value="true"/>
<param name="odom_used" value="true"/>
<param name="imu_used" value="true"/>
<param name="vo_used" value="false"/>
<param name="output_frame" value="odom"/>
<remap from="odom" to="$(arg robot_name)/odom"/>
</node>

Pay attention to the last line before </node>. Where you set robot_name to pinky.

Hope that helps. Did the trick for me if I remember correctly but it has been a while.

edit flag offensive delete link more

Comments

Thank you for the response! Unfortunately your solution didn't work, I don't have the node robot_pose_ekf for the simple launch file.

David_Zizu gravatar imageDavid_Zizu ( 2016-07-15 19:25:56 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-07-13 18:45:46 -0500

Seen: 1,201 times

Last updated: Jul 15 '16