Installation steps
- Install ROS 2
- Install Swarm-SLAM packages:
sudo apt install python3-vcstool
cd $YOUR_ROS2_REPO
mkdir src
vcs import src < cslam.repos
- Install miniconda
- Install python packages
conda create --name cslam
conda activate cslam
sudo apt install python3-pip
pip install -r requirements.txt # The requirements file is in the main Swarm-SLAM repo.You don't need torch if you are only using lidar.
- Install gtsam: https://github.com/borglab/gtsam . We tested version 4.1.1:
- If you are using lidar, install teaser++ with python bindings: https://teaser.readthedocs.io/en/latest/installation.html#installing-python-bindings
- Install ROS 2 dependencies:
sudo apt install python3-rosdep python3-colcon-common-extensions
source /opt/ros/foxy/setup.bash
sudo rosdep init
rosdep update
rosdep install --from-paths src -y --ignore-src --rosdistro foxy
Build and tests
- Build the repo:
conda activate cslam
source /opt/ros/foxy/setup.bash
colcon build
- Run tests:
- For images, download CosPlace model ResNet-18 dimension 64 : https://github.com/gmberton/CosPlace . Other models can be used by modifying frontend.cosplace.descriptor_dim and frontend.cosplace.backbone params accordingly. Place the model file in src/cslam/models/ Set frontend.nn_checkpoint accordingly
- For deployment on real robots, I strongly advise to use the Zenoh DDS Bridge with
ROS_DOMAIN_ID
to avoid flooding the network with discovery messages. For example, on : ROS_DOMAIN_ID=$ROBOT_ID ros2 launch cslam_experiments experiment_realsense.launch.py robot_id:=$ROBOT_ID
zenoh-bridge-dds -d $ROBOT_ID --allow /cslam/.*
Running your experiments
- To adapt Swarm-SLAM to your specific system: take inspirations from the various launch and config files in cslam_experiments.
- Many datasets are only available in ROS 1. To convert them to ROS 2, I suggest to run the bag in ROS 1, along with the ros1_bridge (
https://github.com/ros2/ros1_bridge
), while recording the bag in ROS 2. In separate terminals run: rosbag play bag.bag
ros2 run ros1_bridge dynamic_bridge --bridge-all-1to2-topics
ros2 bag record -a
Development
Debugging instructions for ROS 2 nodes