Ask Your Question

Carlike robot's localization algorithm in simulation

asked 2016-04-04 09:33:29 -0500

murdock gravatar image

updated 2016-04-23 07:15:29 -0500


I have been struggling finding the right tutorials for me. Here is what I need to do: I need to simulate AMCL algorithm of a carlike robot using such sensors as odometry, lidar, gyroscope and accelerometer in pure simulation. I have read about RVIZ but the robot is supposed to be carlike, therefore I started looking into turtlebot_simulation tutorials which gave me a dead end because it required indigo version (I am running jade).

I have looked through all beginner/intermediate tutorials, but I just keep hitting a wall. I would really appreciate if someone would give me links/tips to the useful tutorials.

Dont hesitate to ask me more information in case my question is unclear.

EDIT Can I simulate IMU data in ROS stage? I have found this question, but its rather outdated.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-04-04 14:15:34 -0500

croesmann gravatar image

You cannot use rviz on its own for your purpose, since you want to simulate a carlike robot. rviz is just a visualization.

You have three options for simulating a carlike robot:

  1. [not recommended] Write your own simulation model (implement the discrete equations of motion and publish the current state to rviz)
  2. Write a gazebo plugin for your carlike robot (this might be more advanced)
  3. Use the 2D - simulator stage.

I would prefer option 3 for your task, since stage is able to simulate your carlike motion as well as laser/sonar range sensors. This should be enough for your AMCL task. You can also add noise to your motion model (in the stage config), which is great for your evaluation.

In order to setup stage, your can refer to the following links:

If you check out the turtlebot stage package, you will find the file (which is loaded from your stage world file):

define turtlebot position
   pose [ 0.0 0.0 0.0 0.0 ]
   odom_error [0.03 0.03 999999 999999 999999 0.02]
   size [ 0.2552 0.2552 0.40 ]
   origin [ 0.0 0.0 0.0 0.0 ]
   gui_nose 1
   drive "diff" # change to "car" for your carlike robot ["diff", "omni" or "car"]
   color "gray"
   kinect(pose [ -0.1 0.0 -0.11 0.0 ]) # replace this with laser / sonar information

   # only used if drive is set to "car"
   wheelbase 1.0

You must also define the wheelbase. You might better refer to the example in the Stage manual (see link above).

After stage is running your model, you need to command the velocity and steering angle. Here you can chose either your joystick, a predefined control sequence (programmed) or some planner as Orhangazi44 suggested (e.g. dwa_local_planner or teb_local_planner).

edit flag offensive delete link more


Thank you very much for your information. It was incredibly confusing with all of those tutorials. However, my goal is also to save some data and then visualise it, for example, estimation error plots. Is there any easier way I could do it?

murdock gravatar image murdock  ( 2016-04-04 15:45:17 -0500 )edit

Thank You Dear @croesmann. And sorry @murdock, I forgot to write about gazebo simulator. I can simulate turtlebot in Indigo with gazebo simulator. Another simple suggestion; 4. If you are new in ROS, I recommend you to install Indigo. Indigo's EOL date is 2019, (Jade: 2017).

Orhan gravatar image Orhan  ( 2016-04-05 01:06:34 -0500 )edit

@murdock regarding saving data and plotting graphs offline you might either take a look at

  • python with numpy and pyplot
  • Matlab with Robotics System Toolbox (if you are at a university with proper licenses, you might have access to it)
  • just plotting:
croesmann gravatar image croesmann  ( 2016-04-05 01:17:52 -0500 )edit

data can be saved easily using rosbag and afterwards replayed using python or matlab. Otherwise you can write and read your data to/from file manually.

croesmann gravatar image croesmann  ( 2016-04-05 01:19:30 -0500 )edit

I see, thank you very much! I have another question regarding AMCL. I am aware that I need to do sensor fusion. This is done by defining a computational model in a matrix. Where does one set these settings in AMCL? Since I havent found src file for AMCL, only a config/header file.

murdock gravatar image murdock  ( 2016-04-05 03:15:04 -0500 )edit

Sensor fusion isn't part of an amcl. Take a look at robot_localization.

Orhan gravatar image Orhan  ( 2016-04-05 03:31:51 -0500 )edit

Thank you very much!

murdock gravatar image murdock  ( 2016-04-05 03:37:40 -0500 )edit

You installed from debian sources, so you haven't got all files. And here is amcl_node.cpp in jade-devel branch. You can clone and edit all navigation stack.

Orhan gravatar image Orhan  ( 2016-04-05 03:48:42 -0500 )edit

answered 2016-04-04 10:01:48 -0500

Orhan gravatar image

updated 2016-04-07 02:49:10 -0500

AFAIK, there is no fully working car-like planners in ROS, yet. I have a car-like robot and I'm using dwa_local_planner to avoiding obstacles succesfully. Because My robot needs carefully motions in some narrow places. You can also try teb_local_planner. It has good tutorials and now supports different footprint types.

edit flag offensive delete link more


Aha, thanks! I am confused what should I try to use in ROS. Should I try using gazebo in which (as far as I understand) I can actually build the "car-like" or just stick with Rviz?

murdock gravatar image murdock  ( 2016-04-04 13:23:30 -0500 )edit

You are running move_base node in somewhere in .launch files. move_basehas parameter called local_planner, change it to dwa_local_planner. Then, dwa planner has a lot of parameters too :) Try to tune it via rqt reconfigure gui (rosrun rqt_reconfigure rqt_reconfigure command).

Orhan gravatar image Orhan  ( 2016-04-04 13:56:54 -0500 )edit

@Orhangazi44, Could you give me a hint on which dwa_local_planner params I should focus on to make the robot move like a car? Also, does it change a lot if I already have a robot but its using differential drive and I am trying to simulate it as a car?

murdock gravatar image murdock  ( 2016-04-24 08:28:23 -0500 )edit

You can try my parameters in my question. I was using sbpl_lattice_planner with it. Now I'm trying navfn with dwa_local_planner. Because sbpl planner isn't fully compatible with indigo.

Orhan gravatar image Orhan  ( 2016-04-24 11:43:45 -0500 )edit

Here is why I'm left sbpl_lattice_planner behind. You can also find sbpl planner's indigo fork on same link.

Orhan gravatar image Orhan  ( 2016-04-24 11:46:27 -0500 )edit

Aha, move_base has all its params in yaml files, for ex, costmap_common_params, local_costmap_params, and then theres a param that call "base_local_planner" with value="X/TebLocalPlannerROS" /> So instead of X I should use either teb_local_planner or dwa one? It seems too simple to change one line.

murdock gravatar image murdock  ( 2016-04-24 14:03:57 -0500 )edit

it is as simple as that. But you might load an extra param yaml file for the local planner config. The local costmap resolution value for TEB should not be too low. Find example params here. for jackal: diff_drive as starting point

croesmann gravatar image croesmann  ( 2016-04-24 14:35:56 -0500 )edit

I added a jackal setup to the tutorials package (see this branch). I recommend teb_local_planner version 0.4 which is not yet available on the public repos, but only from source. Parameters are tuned only roughly.

croesmann gravatar image croesmann  ( 2016-04-25 02:50:59 -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



Asked: 2016-04-04 09:31:59 -0500

Seen: 1,189 times

Last updated: Apr 23 '16