cartographer-project / cartographer

Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.
Apache License 2.0
7.04k stars 2.24k forks source link

Ways to influence time taken to find a localization match (constraints builder constraints > 0) in pure localization #1813

Open scenicpastures opened 3 years ago

scenicpastures commented 3 years ago

I've been using Cartographer to generate maps and then localize within this map in pure localization mode. I've noticed that it can take a variable amount of time (typically 10 to 30 srconds with my data set) for Cartographer find a localization match, where the position of the robot typically jumps to it's 'correct' position within the map.

Will the following factors influence the time taken for this initial jump?,

I've experimented with the methods above to decrease the time taken to find a localization match without much success. Are these methods expected to decrease this time? Are there other ways of doing this?

Thanks

MichaelGrupp commented 3 years ago

I will refer to a "localization match" as pose graph constraint (trajectory node to submap of other trajectory) and the "jump" as finished pose graph optimization, as these are the mechanisms used in Cartographer.

So what needs to happen is briefly this:

  1. trajectory node is inserted into pose graph
  2. constraint search is started for this node
  3. constraint is found and inserted into pose graph
  4. optimization runs and minimizes the error residual of the constraint --> pose adjustment

For each of these steps there are parameters that can influence the time spent for them. For example:

  1. num_accumulated_range_data, motion filter
  2. sampling_ratio of constraint builder
  3. search window parameters of fast correlative scan matcher; min_score, max_constraint_distance of constraint builder
  4. optimize_every_n_nodes of pose graph

When you start a trajectory with an initial pose estimate, you need to specify to which existing trajectory you are relating this pose to. This can help to speed up the search because it internally already creates a connectivity state between these two trajectories (and all others that are transitively connected).