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

Problem with ROS Navigation on a real robot

asked 2017-02-26 04:28:26 -0500

dgrixti gravatar image

updated 2017-02-26 07:29:00 -0500


I have been building a robot for a university project and working with ROS Navigation stack.

I have got the robot to work in Gazebo simulation using Gazebo plugins and managed to send goal poses through Rviz successfully. However now I am trying to reproduce the same on the real robot but the goal planning isn’t going so well. It seems that the localization and the odometry update isn’t working properly.

When I give the robot very close goal poses it moves with no problems, but when I give a goal which is slightly more far on the map (a couple of feet) it starts to go off track or in case of a 90 degree turn, the robot keeps going straight and then it takes a big turn or a detour in order to return to it’s goal and gives these warnings:

[ WARN] [1488103550.240345429]: Costmap2DROS transform timeout. Current time: 1488103550.2400, global_pose stamp: 1488103548.1647, tolerance: 2.0000
[ WARN] [1488103550.241602412]: Could not get robot pose, cancelling pose reconfiguration

Below is an image explaining a scenario with the desired path the robot should take and the path it takes with the ROS planner: image description

Here is my setup:

I am using real Kinect + fake laser depthimage_to_laserscan in combination with AMCL and Move Base.

I am publishing the odometry using this class since I am using roboclaw motor shield:

I have based my move_base on this example and only changed the names of topics:

Below is my TF graph: image description

My navigation launch file:

<arg name="scan_topic" default="kinect_scan"/> 
  <arg name="odom_frame_id"   default="odom"/>
  <arg name="base_frame_id"   default="base_link"/>
  <arg name="global_frame_id" default="map"/>

<!-- DG: Kinect cloud to laser scan -->
<node pkg="depthimage_to_laserscan" type="depthimage_to_laserscan" name="depthimage_to_laserscan">
    <remap from="image"     to="/camera/depth/image_raw"/>
    <remap from="camera_info" to="/camera/depth/camera_info"/>
    <remap from="scan" to="$(arg scan_topic)"/>
    <param name="range_max" type="double" value="4"/>

<node pkg="tf" type="static_transform_publisher" name="base_link_to_laser" args="0 0 0 0 0 0 /base_link /camera_depth_frame 100"/>

  <!-- Map server -->
  <arg name="map_file" default="$(find rovytwo_navigation)/maps/empty/blank_map.yaml"/>
  <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />

  <arg name="use_map_topic"   default="false"/>
  <arg name="initial_pose_x"  default="0.0"/>
  <arg name="initial_pose_y"  default="0.0"/>
  <arg name="initial_pose_a"  default="0.0"/>
  <node pkg="amcl" type="amcl" name="amcl" output="screen">
    <param name="use_map_topic"             value="$(arg use_map_topic)"/>

    <param name="odom_model_type"           value="diff"/>
    <param name="odom_alpha5"               value="0.1"/>
    <param name="gui_publish_rate"          value="10.0"/> <!-- -->
    <param name="laser_max_beams"             value="60"/>
    <param name="laser_max_range"           value="12.0"/>
    <param name="min_particles"             value="500"/>
    <param name="max_particles"             value="2000"/>
    <param name="kld_err"                   value="0.05"/>
    <param name="kld_z"                     value="0.99"/>
    <param name="odom_alpha1"               value="0.2"/>
    <param name="odom_alpha2"               value="0.2"/>

    <param name="odom_alpha3"               value="0.2"/>
    <param name="odom_alpha4"               value="0.2"/>
    <param name="laser_z_hit"               value="0.5"/>
    <param name="laser_z_short"             value="0.05"/>
    <param name="laser_z_max"               value="0.05"/>
    <param name="laser_z_rand ...
edit retag flag offensive close merge delete


Please attach all images directly to your post. If you ever delete them from your google drive, this question becomes useless / unintelligible. I've given you enough karma.

gvdhoorn gravatar image gvdhoorn  ( 2017-02-26 04:38:53 -0500 )edit

As to text files (ie: launch files), same rationale: please include them directly into your question. Use the Preformatted Text button (the one with 101010 on it) to make sure things are formatted properly.

gvdhoorn gravatar image gvdhoorn  ( 2017-02-26 04:39:58 -0500 )edit

Thanks for adding the karma. I have now included all images and code snippets to the post.

dgrixti gravatar image dgrixti  ( 2017-02-26 07:29:30 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2017-03-10 06:13:31 -0500

dgrixti gravatar image

It turns out that the biggest issue was that the robot was not able to perform all the turns indicated by move_base cmd_vel. In fact it seems that the robot was only able to move in a straight line or take sharp left / right turns.

Not being able to turn slightly it cause the robot inabilty to steer smoothly and this was confusing the planner and thus having to first move into an area where it could potentially take a sharp turn. By refining the code which converts cmd_vel to odom and cmd_vel to motor signals and testing by comparing actual movements with the ones projected on RViz I was able to improve the navigation drastically and now the robot is able to perform better trajectories.

edit flag offensive delete link more

answered 2017-02-27 10:59:48 -0500

Procópio gravatar image

It seems you are navigating in an empy map? Why is that? In that case, AMCL will not be able to properly localize the robot as it does not have any reference.

Also, your TF tree regarding the camera seems a bit off. I would expect to see something like: camera_link -> camera_rgb_frame -> camera_rgb_optical_frame (meaning camera_link should be the parent of camera_rgb_frame and camera_depth_frame). But I guess your setup would work anyways, although it seems weird IMO.

edit flag offensive delete link more


Thanks for your feedback Procopio. The reason for using an empty map in this case is that I want to try to navigate in an empty space without any obstacles to make sure all is working fine with the simplest scenario.

dgrixti gravatar image dgrixti  ( 2017-02-28 04:17:57 -0500 )edit

I tested with various maps which I found on the internet but all give the same problem unfortunately. I will make sure to revise the URDF to get the TF tree in the order suggested by you, but I have a feeling I could be missing something else. Could it be the way I publish /odom from the code?

dgrixti gravatar image dgrixti  ( 2017-02-28 04:19:47 -0500 )edit

if you have a robot, create the map of your surrounding and then load it and try navigating there. what happens?

Procópio gravatar image Procópio  ( 2017-03-06 06:53:04 -0500 )edit

I have created gmappinng with linear speed 1.0 and angular speed 1.0 settings. Then I sent from teleop_node (adapted node from turtlebot) commands to move the robot at same speeds 1.0. / 1.0. The map was created well and then I used it for navigation. It seems that ROS still has some issues

dgrixti gravatar image dgrixti  ( 2017-03-07 05:17:13 -0500 )edit

While I give 2D pose navigation goals in a straight line it seems to behave well, but the minute it needs to go around a gap or turn slightly to left or right it goes into a "Unstuck robot behaviour" mode and it just keeps turning on itself until it fails.

dgrixti gravatar image dgrixti  ( 2017-03-07 05:19:03 -0500 )edit

Any advice on how to calibrate angular velocities with ROS? Or how to test that real velocity/angular speeds match with the ones ROS thinks it is happening on the map?

dgrixti gravatar image dgrixti  ( 2017-03-07 05:20:09 -0500 )edit

I think we are getting out of your original question here. As far as I understood you had a problem with localization, trying to localize your robot in an empty map. Another issue is your navigation config. That will be better addressed with a new, more localized, question.

Procópio gravatar image Procópio  ( 2017-03-08 06:15:19 -0500 )edit

You're right, I also posted an answer which explains how I managed to get better results recently by improving the cmd_vel and odom. Thanks for your help!

dgrixti gravatar image dgrixti  ( 2017-03-10 06:15:12 -0500 )edit

Question Tools

1 follower


Asked: 2017-02-26 04:28:26 -0500

Seen: 2,514 times

Last updated: Mar 10 '17