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

Localization SLAM how to do?

asked 2017-01-16 12:49:36 -0500

FelixF gravatar image

updated 2017-01-18 11:44:57 -0500

Hey guys,

I try to develop an autonomous driving car. The problem is that I don't know how to localize the car on my SLAM map.

I only use a LiDAR UTM-30LX LiDAR to navigate. I created successfully a SLAM map with hector mapping.

Now I want to estimate a start point and a goal. I use the navigation stack with move base to navigate. As local planner I have implemented the teb_local_planner because of the Ackermann steering. I can estimate a start point and can set a goal. I also can forward my cmd_vel to the car with a steering angle and a speed info. But the position of the robot on the map in rviz don't change.

Can you help me and tell me what I have to do? I can't start playing around to find a good config for the teb_local_planner like this :(

Here is my launch file:

  <node pkg="urg_node" type="urg_node" name="urg_node">
    <param name="ip_address" type="string" value=""/>
  <param name="pub_map_odom_transform" value="true"/>
  <param name="map_frame" value="map"/>
  <param name="base_frame" value="base_frame"/>
  <param name="odom_frame" value="odom"/>
  <node pkg="tf" type="static_transform_publisher" name="map_2_odom" args="0 0 0 0 0 0 /map /odom 100"/>
  <node pkg="tf" type="static_transform_publisher" name="odom_2_base_footprint" args="0 0 0 0 0 0 /odom /base_footprint 100"/>
  <node pkg="tf" type="static_transform_publisher" name="base_footprint_2_base_link" args="0 0 0 0 0 0 /base_footprint /base_link 100"/>
  <node pkg="tf" type="static_transform_publisher" name="base_link_2_base_stabilized_link" args="0 0 0 0 0 0 /base_link /base_stabilized 100"/>
  <node pkg="tf" type="static_transform_publisher" name="base_stablized_2_base_frame" args="0 0 0 0 0 0 /base_stabilized /base_frame 100"/>
  <node pkg="tf" type="static_transform_publisher" name="base_frame_2_laser_link" args="0 0 0 0 0 0 /base_frame /laser 100"/>
  <node pkg="tf" type="static_transform_publisher" name="base_2_nav_link" args="0 0 0 0 0 0 /base_frame /nav 100"/>
  <node pkg="amcl" type="amcl" name="amcl"/>
  <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
    <rosparam file="$(find autonomous_car)/launch/costmaps/costmap_common_params.yaml" command="load" ns="global_costmap"/>
    <rosparam file="$(find autonomous_car)/launch/costmaps/costmap_common_params.yaml" command="load" ns="local_costmap"/>
    <rosparam file="$(find autonomous_car)/launch/costmaps/local_costmap_params.yaml" command="load"/>
    <rosparam file="$(find autonomous_car)/launch/costmaps/global_costmap_params.yaml" command="load"/>
    <rosparam file="$(find autonomous_car)/launch/costmaps/teb_local_planner_params.yaml" command="load"/>
    <param name="clearing_rotation_allowed" value="false"/>
  <node pkg="rviz" type="rviz" name="rviz" args="-d $(find hector_slam_example)/launch/rviz_cfg.rviz"/>

My amcl_pose dont update, but the car is moving with the speed and angle from the first input :/

rostopic echo /amcl_pose


seq: 0


secs: 1484760781

nsecs: 434161143

frame_id: map




  x: 1.50654940711

  y: 3.46721180218

  z: 0.0


  x: 0.0

  y: 0.0

  z: -0.773900494384

  w: 0.633307212016

covariance: [0.18227685925353398, 0.0027654181834790847, 0.0, 0.0, 0.0, 0.0, 0.0027654181834790847, 0.22445548719072939, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ... (more)

edit retag flag offensive close merge delete


Not a navigation expert, but I see static TF publishers for important transforms such as /map to /odom and /odom and /base_footprint. That seems strange to me, because how do you expect your localisation (you are running one, right?) to update the position of your robot that way?

gvdhoorn gravatar image gvdhoorn  ( 2017-01-17 02:07:07 -0500 )edit

following on @gvdhoorn, are you running AMCL?

Procópio gravatar image Procópio  ( 2017-01-17 10:58:42 -0500 )edit

So I set the init pose and I set a goal, then the Path the Robot should drive appears. the echo of cmd_vel contains good values. But if I start moving arround the LiDAR the ArrowCloud won't get smaler and also the polygon of the robot does not move

FelixF gravatar image FelixF  ( 2017-01-17 15:26:32 -0500 )edit

I think I have to reconfigure my whole tf tree... But I don't get it :/

FelixF gravatar image FelixF  ( 2017-01-17 16:21:51 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2017-01-17 10:56:57 -0500

Procópio gravatar image

updated 2017-01-17 11:01:08 -0500

you should use AMCL. it is THE node for localization in ROS. And, as mentioned by @gvdhoorn, you should not publish the tf between /map and /odom, because that is exactly what you want to be published by a localization algoritm (follow the link above on AMCL and check the illustrations on the bottom of the page).

edit flag offensive delete link more


please check my comment on top. You are right I deleted this tf, but the porblem is still alive :/

FelixF gravatar image FelixF  ( 2017-01-17 15:27:28 -0500 )edit

what exactly is your problem? what is the output of the AMCL node?

Procópio gravatar image Procópio  ( 2017-01-18 05:44:06 -0500 )edit

The Problem is that the position of the car shown in rviz don't update, allthough the car is moving

I aded the amcl_pose to the question

FelixF gravatar image FelixF  ( 2017-01-18 11:46:11 -0500 )edit

so your amcl pose does not change at all while moving the robot? is it subscribing to the correct scan topic?

Procópio gravatar image Procópio  ( 2017-01-23 03:57:27 -0500 )edit

answered 2017-01-16 19:00:32 -0500

petern3 gravatar image

I'd suggest having a poke around the relevant topics. As long as you know that it is actually making a goal, have a look at all the topics between the goal and rviz, because it's getting lost somewhere (each topic will tell you which nodes are listening, and the nodes will tell you what they're sending).

For example: Is it sending the goal? Is it creating a path? Does cmd_vel get the message (and is it sensible)? Is rviz looking at the correct topic?

If you can find out where it goes wrong, you can have a more detailed look. Hopefully it's just something simple like rviz is looking at /cmd_vel instead of /my_autonomous_car/base_controller/cmd_vel or something.

edit flag offensive delete link more


yeah the whole path planing is working, check my comments on top please

FelixF gravatar image FelixF  ( 2017-01-17 15:28:09 -0500 )edit

Question Tools



Asked: 2017-01-16 12:35:18 -0500

Seen: 1,862 times

Last updated: Jan 18 '17