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

How to create the odom --> base_link transform in gmapping

asked 2018-10-18 08:44:22 -0500

sberg gravatar image

Hi

We are trying to run gmapping using ROS Indigo on Ubuntu 14.04 . The problem we are encountering is that the transform between "odom" and "base frame" is not created correctly. Even though we think it should exist since the transform is visible when echoing rostopic. Should the way we are launching gmapping work or is the problem that the robot is not publishing the transforms correctly? Also how do we create the transform between odom and base_link.

running:

rosrun rqt_tf_tree rqt_tf_tree

yields the following result:

link to tf_tree

As you can see the link between odom and base_link is missing

however when we run

rostopic echo cvc/tf

The transform between odom and base_link is visible

transforms: 
  - 
    header: 
      seq: 0
      stamp: 
        secs: 1539863401
        nsecs: 756178000
      frame_id: odom
    child_frame_id: base_link
    transform: 
      translation: 
        <omitted to save space
      rotation: 
        <omitted to save space>

We are using the following launch file:

<launch>
  <param name="robot_description"
    textfile="/home/pd/vmc/Thesis_tools/SLAM_launch/gmapping/charm.urdf" /> 

  <node name="robot_state_publisher" pkg="robot_state_publisher"
    type="robot_state_publisher" /> 

  <node pkg="tf" type="static_transform_publisher" name="base_laser" args="0.23 0 0 0 0 0 1 base_link laser_frame 100" />

  <node name="gmapper" pkg="gmapping" type="slam_gmapping" args=""  output="screen">
    <param name="scan_frame" value="cvc/scan"/>
    <param name="odom_frame" value="odom"/>
    <param name="base_frame" value="base_link"/>
    <param name="map_frame" value="map"/>
  </node>

  <node name="rviz" pkg="rviz" type="rviz" required="true"
      args="-d gmapping.rviz" />

</launch>

Thanks in advance for any help.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-10-18 09:28:09 -0500

Delb gravatar image

I don't think your issue comes from base_link->odom but from laser_frame->base_link and since there is an issue with base_link, the link with odom isn't created.

From the gmapping wiki, section 4.1.5 : Required tf transforms :

the frame attached to incoming scans → base_link

usually a fixed value, broadcast periodically by a robot_state_publisher, or a tf static_transform_publisher.

In your launch file you have robot_state_publisher AND static_transform_publisher so I'm pretty sure you redifine a new parent to the laser_frame which often leads to that kind of error in the tf tree. I would suggest to get rid of the static_transform_publisher, if your URDF is correctly made with the laser frame inside that should work fine.

edit flag offensive delete link more

Comments

Okay thank you we solved it by removing the robot_state_publisher however then the robot model is no longer visible in Rviz. We tried removing both of them and removing static_transform_publisher resulted in nothing working. Where is the documentation on linking sensors to the robot model?

sberg gravatar image sberg  ( 2018-10-19 02:55:49 -0500 )edit
1

Normally you have a static_transform_publisher to create a frame so that ROS can link your sensor if it's not represented already in the URDF. robot_state_publisher already do that if you have it in the URDF so you should remove the static_transform instead of robot_state_publisher.

Delb gravatar image Delb  ( 2018-10-19 03:01:48 -0500 )edit

Thanks Yes that is what we are trying to do but failing when using the robot_state_publisher. We think that the problem is that we do not have the sensor correctly repsresented in the URDF-file The error we are getting is Fixed frame [map] does not exist even though the tf_tree looks correct

sberg gravatar image sberg  ( 2018-10-19 04:34:49 -0500 )edit

Can you show the tf tree with robot_state_publisher please ? Also are you only launching the launch file from the question ? You miss providing the odometry information (usually odom comes from the mobile_base if it's a real robot or Gazebo if simulation)

Delb gravatar image Delb  ( 2018-10-19 04:56:06 -0500 )edit

Turns out we had named one of the variables wrong in the URDF file. Still kind of strange that the tf_tree looked good.

Also a big thank you for your time!

sberg gravatar image sberg  ( 2018-10-19 08:34:56 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-10-18 08:44:22 -0500

Seen: 4,115 times

Last updated: Oct 18 '18