├── .github └── workflows │ └── main.yml ├── .gitignore ├── LICENSE.md ├── README.md ├── build-everything.sh ├── cslam.repos ├── media ├── graco_pc.gif ├── graco_pg.gif └── system-overview.svg └── requirements.txt /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: cslam 4 | 5 | # Controls when the workflow will run 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the "main" branch 8 | push: 9 | branches: [ "main" ] 10 | pull_request: 11 | branches: [ "main" ] 12 | 13 | # Allows you to run this workflow manually from the Actions tab 14 | workflow_dispatch: 15 | 16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 17 | jobs: 18 | # This workflow contains a single job called "build" 19 | build: 20 | # The type of runner that the job will run on 21 | runs-on: ubuntu-22.04 22 | 23 | # Steps represent a sequence of tasks that will be executed as part of the job 24 | steps: 25 | - uses: actions/checkout@v2 26 | - uses: ros-tooling/setup-ros@v0.7 27 | - name: Install Python Dependencies 28 | run: | 29 | pip install --break-system-packages -r requirements.txt 30 | - name: Install C++ Dependencies 31 | run: | 32 | sudo add-apt-repository ppa:borglab/gtsam-release-4.1 -y 33 | sudo apt-get -y update 34 | sudo apt install libgtsam-dev libgtsam-unstable-dev 35 | - uses: ros-tooling/action-ros-ci@v0.3 36 | with: 37 | package-name: cslam 38 | import-token: ${{ secrets.SWARMSLAM_TOKEN }} 39 | target-ros2-distro: humble 40 | vcs-repo-file-url: cslam.repos 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | src/ 2 | build/ 3 | log/ 4 | install/ 5 | results/ 6 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Pierre-Yves Lajoie 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Swarm-SLAM: Sparse Decentralized Collaborative Simultaneous Localization and Mapping Framework for Multi-Robot Systems 2 | 3 | ![Swarm-SLAM Overview](media/system-overview.svg) 4 | 5 | Look up our [Documentation](https://lajoiepy.github.io/cslam_documentation/html/index.html) and our [Start-up instructions](https://lajoiepy.github.io/cslam_documentation/html/md_startup-instructions.html)! 6 | 7 |

8 | Swarm-SLAM on GRACO dataset 9 | Swarm-SLAM on GRACO dataset 10 |

11 | 12 | [Swarm-SLAM](https://ieeexplore.ieee.org/document/10321649) is an open-source C-SLAM system designed to be scalable, flexible, decentralized, and sparse, which are all key properties in swarm robotics. Our system supports lidar, stereo, and RGB-D sensing, and it includes a novel inter-robot loop closure prioritization technique that reduces inter-robot communication and accelerates the convergence. 13 | 14 | To clone Swarm-SLAM: 15 | ``` 16 | sudo apt install python3-vcstool 17 | git clone https://github.com/MISTLab/Swarm-SLAM.git 18 | cd Swarm-SLAM 19 | mkdir src 20 | vcs import src < cslam.repos 21 | ``` 22 | 23 | Packages summary: 24 | - [cslam](https://github.com/lajoiepy/cslam): contains the Swarm-SLAM nodes; 25 | - [cslam_interfaces](https://github.com/lajoiepy/cslam_interfaces): contains the custom ROS 2 messages; 26 | - [cslam_experiments](https://github.com/lajoiepy/cslam_experiments): contains examples of launch files and configurations for different setups; 27 | - [cslam_visualization](https://github.com/lajoiepy/cslam_visualization): contains an online (optional) visualization tool to run on your base station to monitor the mapping progress. 28 | 29 | Follow the [start-up instructions](https://lajoiepy.github.io/cslam_documentation/html/md_startup-instructions.html) to install, build and run Swarm-SLAM. 30 | 31 | How to cite [our paper](https://ieeexplore.ieee.org/document/10321649): 32 | ``` 33 | @ARTICLE{lajoieSwarmSLAM, 34 | author={Lajoie, Pierre-Yves and Beltrame, Giovanni}, 35 | journal={IEEE Robotics and Automation Letters}, 36 | title={Swarm-SLAM: Sparse Decentralized Collaborative Simultaneous Localization and Mapping Framework for Multi-Robot Systems}, 37 | year={2024}, 38 | volume={9}, 39 | number={1}, 40 | pages={475-482}, 41 | doi={10.1109/LRA.2023.3333742} 42 | } 43 | 44 | ``` 45 | 46 | -------------------------------------------------------------------------------- /build-everything.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ### Installation script for ROS 2 (tested with Humble and Jazzy) 4 | ## Credits to @anadon 5 | 6 | set -e 7 | 8 | # Usage: ./install.sh [add_ros_setup (true/false)] [shell_type (bash/zsh)] 9 | ADD_ROS_SETUP=${1:-true} 10 | SHELL_TYPE=${2:-bash} 11 | RC_FILE="$HOME/.${SHELL_TYPE}rc" 12 | WORKSPACE_DIR="$(pwd)" 13 | 14 | if (( EUID == 0 )); then 15 | SUDO="" 16 | else 17 | SUDO="sudo" 18 | fi 19 | 20 | $SUDO add-apt-repository universe 21 | $SUDO apt update 22 | 23 | export DEBIAN_FRONTEND=noninteractive 24 | 25 | DEPS_0="curl git sudo apt-utils dialog locales" 26 | DEPS_1="libboost-all-dev cmake libtbb-dev intel-mkl-full python3-rosdep python3-colcon-common-extensions sudo git software-properties-common python3-dev python3-full python3-pip" 27 | DEPS_2="ros-dev-tools ros-$ROS_DISTRO-desktop ros-$ROS_DISTRO-rtabmap ros-$ROS_DISTRO-rtabmap-msgs ros-$ROS_DISTRO-navigation2 ros-$ROS_DISTRO-nav2-bringup ros-$ROS_DISTRO-perception-pcl ros-$ROS_DISTRO-rtabmap-conversions ros-rolling-cv-bridge" 28 | 29 | $SUDO apt install -y $DEPS_0 30 | 31 | $SUDO locale-gen en_US en_US.UTF-8 32 | $SUDO update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 33 | export LANG=en_US.UTF-8 34 | export LC_ALL=en_US.UTF-8 35 | 36 | declare -A REPOS=( 37 | ["cslam"]="https://github.com/lajoiepy/cslam.git" 38 | ["cslam_interfaces"]="https://github.com/lajoiepy/cslam_interfaces.git" 39 | ["cslam_experiments"]="https://github.com/lajoiepy/cslam_experiments.git" 40 | ["gtsam"]="https://github.com/borglab/gtsam.git" 41 | ) 42 | 43 | for repo in "${!REPOS[@]}"; do 44 | if [ ! -d "$repo" ]; then 45 | git clone "${REPOS[$repo]}" 46 | else 47 | echo "Repo $repo already cloned. Skipping." 48 | fi 49 | done 50 | 51 | $SUDO apt install -y $DEPS_1 52 | 53 | $SUDO curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg 54 | 55 | echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo "$UBUNTU_CODENAME") main" | $SUDO tee /etc/apt/sources.list.d/ros2.list > /dev/null 56 | 57 | $SUDO apt update 58 | $SUDO apt install -y $DEPS_2 59 | 60 | pip install -r requirements.txt 61 | 62 | pushd gtsam || exit 1 63 | echo "WARNING!!! This deviates from the Swarm-Slam instructions by using gtsam v4.2 and not 4.1.1." 64 | mkdir -p build 65 | cd build || exit 1 66 | cmake .. 67 | make -j$(nproc) 68 | $SUDO make install 69 | popd || exit 1 70 | 71 | ################## 72 | # ROS 2 OS SETUP # 73 | ################## 74 | 75 | echo "WARNING!!! Using newer ROS 2 versions (like Humble or Jazzy) instead of Foxy" 76 | 77 | if [[ "$ADD_ROS_SETUP" == "true" ]]; then 78 | echo "Adding ROS environment setup to $RC_FILE" 79 | echo 'source "/opt/ros/$ROS_DISTRO/setup.'"$SHELL_TYPE"'"' >> "$RC_FILE" 80 | source "/opt/ros/$ROS_DISTRO/setup.$SHELL_TYPE" 81 | fi 82 | 83 | $SUDO rosdep init || echo "rosdep already initialized" 84 | if ! rosdep update; then 85 | echo "WARNING: rosdep update failed — continuing anyway" 86 | fi 87 | if ! rosdep install --from-paths src -y --ignore-src --rosdistro $ROS_DISTRO; then 88 | echo "WARNING: rosdep install failed — continuing anyway" 89 | fi 90 | 91 | pushd cslam_interfaces || exit 1 92 | colcon build 93 | if [[ "$ADD_ROS_SETUP" == "true" ]]; then 94 | echo 'source "'"$WORKSPACE_DIR"'/cslam_interfaces/install/setup.'"$SHELL_TYPE"'"' >> "$RC_FILE" 95 | source "$WORKSPACE_DIR/cslam_interfaces/install/setup.$SHELL_TYPE" 96 | fi 97 | popd || exit 1 98 | 99 | colcon build 100 | colcon test 101 | 102 | if [[ "$ADD_ROS_SETUP" == "true" ]]; then 103 | echo 'source "'"$WORKSPACE_DIR"'/install/setup.'"$SHELL_TYPE"'"' >> "$RC_FILE" 104 | source "$WORKSPACE_DIR/install/setup.$SHELL_TYPE" 105 | fi 106 | -------------------------------------------------------------------------------- /cslam.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | cslam: 3 | type: git 4 | url: https://github.com/lajoiepy/cslam.git 5 | version: main 6 | cslam_interfaces: 7 | type: git 8 | url: https://github.com/lajoiepy/cslam_interfaces.git 9 | version: main 10 | cslam_experiments: 11 | type: git 12 | url: https://github.com/lajoiepy/cslam_experiments.git 13 | version: main 14 | -------------------------------------------------------------------------------- /media/graco_pc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISTLab/Swarm-SLAM/af17c4b71432f750571ea699a0beccfbe9004872/media/graco_pc.gif -------------------------------------------------------------------------------- /media/graco_pg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISTLab/Swarm-SLAM/af17c4b71432f750571ea699a0beccfbe9004872/media/graco_pg.gif -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | networkx>=2.8.8 2 | numba 3 | numpy 4 | open3d 5 | Pillow 6 | scikit_learn 7 | scipy 8 | sortedcontainers 9 | torch>=1.13.0 10 | torchvision>=0.14.0 11 | distinctipy 12 | numpy-quaternion 13 | --------------------------------------------------------------------------------