Skip to content

Porting from MultiagentMapping

Florian Tschopp edited this page Jun 28, 2019 · 1 revision

Notable Changes

  • Packages renamed to maplab (multiagent_mapping_common -> maplab_common)
  • Shared ptrs in VIMap removed
  • VIMap ResourceLoader changed
  • namespace from VIMap changed to vi_map to viwls_graph
  • Removed MappedContainerBase (using std::unordered_map instead)
  • Changed Aligned typedefs (from AligenedXXX<Type>::type to AlignedXXX<Type>)
  • Typedef UniquePtr now points to AlignedUniquePtr (instead of std::unique_ptr)

Copy git directory with history

  • Clone multiagent_mapping. If you already work on this repo, it's recommended to create a second clone to do this.

    git clone git@github.com:ethz-asl/multiagent_mapping.git
  • Next we need to isolate the desired package and move it do the subfolder we want it in maplab.

    • Move all files inside PACKAGE_PATH to the git root and remove all other files:

      git filter-branch --subdirectory-filter PACKAGE_PATH/ -- --all
    • Move all the files left in the repo (the ones that were in PACKAGE_PATH) back into a subfolder NEW_PACKAGE_PATH:

      git filter-branch -f --index-filter \
      'git ls-files -s | sed "s-\t\"*-&NEW_PACKAGE_PATH/-" |
      GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
      git update-index --index-info &&
      mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD

    Important:

    • Some characters like - in NEWSUBDIR need to be escaped by \-
    • On OSX, \t doesn't work. You need to replace \t by a literal tab, for example by pressing Ctrl+V and then Tab in your console
  • Then, you can merge your directory from multiagent_mapping into maplab:

    cd path/to/maplab
    git checkout -b feature/import-DIRECTORY
    git remote add muma_DIRECTORY path/to/prepared/multiagent_mapping
    git fetch muma_DIRECTORY
    git merge muma_DIRECTORY/master # or whichever branch you want to merge
    # Use flag --allow-unrelated-histories with merge if you're on a newer git version.
    git remote remove muma_DIRECTORY

    feature/import-DIRECTORY (name of the branch to merge in) and muma_DIRECTORY (name of the remote) can be anything you want.

Sources:

Other useful filter commands

Remove all files that don't match expression REG_EXPR:

git filter-branch --tree-filter "find . -type f ! -name 'REG_EXPR' -delete" HEAD

Search and replace to fix some issues

Replace multiagent_mapping

# Run in the root of your package -- goes through all of the files in `.`!

# Header guards, macros.
# Careful: This will also change `MULTIAGENT_MAPPING_TEST_DATA_DIR` which we need to keep as is for now.
find . -type f -exec sed -i 's/MULTIAGENT_MAPPING/MAPLAB/g' {} +

# Common rename.
find . -type f -exec sed -i 's/multiagent_mapping_common/maplab_common/g' {} +
find . -type f -exec sed -i 's/multiagent-mapping-common/maplab-common/g' {} +

Replace aligned typedefs

# Run in the root of your package -- goes through all of the files in `.`!
find . -type f -exec sed -i 's/Aligned\(.*\)>::type/Aligned\1>/g' {} +
  • Only changes one-line definitions -- multi-line definitions need to be manually addressed
  • Also need to change allocation for UniquePtr type

Update VIMap namespace

# Run in the root of your package -- goes through all of the files in `.`!
find . -type f -exec sed -i 's/viwls_graph/vi_map/g' {} +

Also changes namespaces of other types that were in the package viwls_graph before, these need to be manually changed.

Useful searches for cleanup

dmap

grep -irn "dmap"

Also matches IdMap.

multiagent_mapping

grep -irn "multiagent"

Works with multiagent mapping separated by space, - or _, or as one word.

Shared ptrs

grep -rn "shared_ptr\|::Ptr\|::ConstPtr"

Clone this wiki locally