Code Monkey home page Code Monkey logo

quickmcl's Introduction

QuickMCL

NOTE: I no longer work in the field of robotics, this is not maintained. But hopefully the ideas and techniques presented here might be of use to you. Or the software itself might even still work!


This package implements an MCL localisation node based on (Thrun et al., 2005) as well as on reverse engineering what AMCL does.

The CPU and memory usage of QuickMCL compared to AMCL is analysed in this blog post, and it turns out QuickMCL is way better.

This was done as course-work for a robotics master program, but I thought it turned out good enough it was worth putting it up publicly after the fact. I might make improvements to it after the fact if there is any interest in the project.

This has been tested with ROS Kinetic, Melodic & Noetic, but I see no reason why it shouldn't work with newer ROS.

Just like AMCL this package estimates the location of the base_link TF frame in the map frame, but then publishes the difference between map and odom.

As inputs to the node the change over time in the odom to base_link transform is used, as well as the point cloud from the laser scanner. In addition a map is required.

Installation

You can build the software as normal ROS 1 software. However, note that QuickMCL performs poorly in debug builds. This is due to the use of the Eigen library. An optimised build is essential to good performance. The difference in processing time is about 20x!

If you use catkin_make build with catkin_make --cmake-args -DCMAKE_BUILD_TYPE=Release. If you use catkin-tools you can set the CMake flags using catkin config, for example: catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release

If you want to build parts of your software as a debug build still, consider taking a look at workspace overlaying.

Documentation

How to use the software is documented in a separate file.

There are also example launch files, in particular the one for the node of this package may be of interest. All parameters and ROS names can be overridden here. In addition there are extra launch files for related nodes that are needed or are useful in combination with this package.

As for code documentation: Doxygen documentation can be generated to the directory doc_generated by running doxygen in the directory of this file.

Limitations

Compared to AMCL:

  • Only the likelihood field model is implemented, not the beam model.
  • No support for beam skipping.
  • Only odometry type implemented is differential drive.

Shared with AMCL:

  • The map offset is taken into account, but not the rotation.

Extra features compared with AMCL

  • QuickMCL can either use a PointCloud2 topic (in the base_link TF frame) or a LaserScan topic for the sensor data. See the launch file for the laser filter for an example of how a node that converts from the laser scan to a point cloud can look.
  • Multiple resampling types implemented (low variance, adaptive, KLD).
  • Some parameters that are hard coded in AMCL (such as KLD bucket sizes) are tunable via ROS parameters.
  • Code is more documented.
  • Some bugs in AMCL have not been "reimplemented"!
    • AMCL has incorrect variance handling in the odometry models by default. You have to explicitly select "corrected" models with it.
    • Clustering wraparound for the circle cut (pi/-pi) fixed. (AMCL bug)
  • Checks if particles are inside free space and penalises particles that aren't.
  • More efficient resampling with respect to performance when the number of particles is large.
  • Lower memory usage than AMCL.

References

  • Thrun, S., Burgard, W., Fox, D., 2005. Probabilistic robotics, Intelligent robotics and autonomous agents. MIT Press, Cambridge, Mass.

quickmcl's People

Contributors

vorpalblade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

quickmcl's Issues

CI broken

CI appears to have broken during the last year. Build fails with the following, which doesn't make much sense:

quickmcl: Cannot locate rosdep definition for [rosunit]

Investigate moving scan subsampling to an earlier step

It might be worth it to move scan sub-sampling earlier.

Currently it happens in MapLikelihood::update_importance, but at this point the point cloud has already been transformed via TF into a new coordinate frame.

Look into the possibility of doing this sub-sampling much earlier. It would require a rewrite of the laser_handler.cpp code, since currently this happens very early (in the call projector.transformLaserScanToPointCloud in LaserSub<sensor_msgs::LaserScan>::laser_callback, or externally for point clouds).

Initial pose via parameters

Would be good to add support (similar to AMCL) for initial pose via parameters. Maybe also write back current estimate to the parameters (similar to AMCL) to facilitate restart.

ROS2 Inquery

Hi,

I'm a maintainer / developer on ROS2 Navigation [1] and was curious about this. I saw you posted on Navigation and in my glancing around I found your blog on it. There's definitely some work to be done on it, but I think its a good starting point to be a candidate for replacement of AMCL in ROS2 Navigation stack, if you're interested. I would be open to helping you finish it up to be feature parity and move it into the later stack.

The big things questions I'd have are:

  • You mention not testing KLD sampling, but I see it implemented. Can you explain more about why you didn't test against it? Just want to make sure feature-wise it works, regardless of the specific determinism of the memory/CPU benchmarks.
  • Did you do localization accuracy testing in simulation (or ground truth hardware)? I'd want to know that it works on the order as well. Did you test that your implementation correctly was able to recover from delocalization?
  • Other than motion models/beam skipping, anything else missing? Those are things I can do pretty fast.

Finally, why GPL-3? I admit, I'm a fan of relatively restrictive licenses for my application-level code [2] but since this is lower-level and people need to build on top of it, that's going to be quite an up-hill battle to get people to use it. I use LGPL-2.1 when building very difficult application-level code because its the most restrictive (give back if you improve it) license that companies will actually accept. However if it wasn't some new technique or non-application level I'm usually running Apache/BSD. GPL-3 for many companies is a non-starter [3]. It would be monumentally easier of a sell if this was available as Apache-2.0 (which still leaves IP + ability to patent should there be something here) or BSD (very very permissive, good baseline if you don't actually care). Given you're the only author, if this interests you, the process is trivial.

[1] https://github.com/ros-planning/navigation2
[2] https://github.com/SteveMacenski/slam_toolbox
[3] https://www.cnet.com/news/torvalds-no-gpl-3-for-linux/

Positioning delay in motion

Hello, I wanted to replace AMCL with this package, but I had a problem.In the process of robot moving, each laser processing takes a lot of time, which leads to positioning delay. But I put likelihood_ num_ When beams is turned on, the delay problem will be alleviated, but it still can't meet the requirements, which is completely different from AMCL. Is this normal, please? What can I do to change that? Hope to get your help ,thanks. @VorpalBlade

[ INFO] [1622604936.906454767]: Sensor model took 515 ms
[ INFO] [1622604936.909437357]: Laser cloud processing took 521 ms
[ INFO] [1622604936.913094327]: Laser cloud processing took 3 ms
[ INFO] [1622604936.916572128]: Laser cloud processing took 3 ms
[ INFO] [1622604936.919894154]: Laser cloud processing took 3 ms
[ INFO] [1622604936.923857023]: Laser cloud processing took 3 ms
[ INFO] [1622604936.927586915]: Laser cloud processing took 3 ms
[ INFO] [1622604937.000761051]: Laser cloud processing took 12 ms
[ INFO] [1622604937.090635198]: Laser cloud processing took 3 ms
[ INFO] [1622604937.201118132]: Laser cloud processing took 13 ms
[ INFO] [1622604937.290968898]: Laser cloud processing took 3 ms
[ INFO] [1622604937.400704508]: Laser cloud processing took 12 ms
[ INFO] [1622604937.490612819]: Laser cloud processing took 3 ms
[ INFO] [1622604937.599952569]: Laser cloud processing took 11 ms
[ INFO] [1622604937.699796460]: Laser cloud processing took 11 ms
[ INFO] [1622604937.800352997]: Laser cloud processing took 12 ms
[ INFO] [1622604938.355880810]: Sensor model took 467 ms
[ INFO] [1622604938.359256935]: Resampling took 3 ms

Support point clouds not in the proper TF frame

Currently it is assumed in LaserSub<sensor_msgs::PointCloud2>::laser_callback in laser_handler.cpp that the point cloud is already in the proper reference frame (base_link). It would be nice to support transforming it with TF2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.