Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
6f0a44e
adding new dependency installation for monocular container
nickoenig37 Jul 12, 2024
d3d9841
Deleting RGBD related files for setup simplicity focussing on monocular
nickoenig37 Jul 12, 2024
6326b20
Setting up cmakeslist for monocular
nickoenig37 Jul 12, 2024
925d72b
New function for pure RGB tracking
nickoenig37 Jul 12, 2024
b8c6c2f
adding utility file to be identified
nickoenig37 Jul 12, 2024
43bcd17
Creating node and headers for RGB tracking with ORBSLAM
nickoenig37 Jul 12, 2024
862ef5e
Launch files for monocular/rgb
nickoenig37 Jul 12, 2024
d069856
yaml config file under new namespace for rgb
nickoenig37 Jul 12, 2024
9a7bedb
camera calibration for same camera in scout gazebo but only using mon…
nickoenig37 Jul 12, 2024
2e87005
Function creation for RGB tracking
nickoenig37 Jul 12, 2024
aa2d276
commenting/deleting depth funtions not being used for monocular
nickoenig37 Jul 23, 2024
1511821
Adding calibration for my raspberry pi camera
nickoenig37 Jul 23, 2024
3c67288
personal chanes for the docker file
nickoenig37 Jul 23, 2024
0c96f51
adding cyclone to the .bashrc for communication outside of the container
nickoenig37 Jul 23, 2024
e2fb6ee
readme changes for cyclone implementation
nickoenig37 Jul 23, 2024
360cbb4
getting rid of namespace mention that's not used
nickoenig37 Jul 23, 2024
7fd307d
changing to base_link since it is linked in the tf tree to camera
nickoenig37 Jul 23, 2024
dc4899c
Adding calibration for my robots basic gazebo camera
nickoenig37 Jul 25, 2024
74f0cc2
adding comments and commenting out spam message from not using odom
nickoenig37 Jul 25, 2024
c6b2844
moving the base frame to base_link since that tf connects the camera_…
nickoenig37 Jul 25, 2024
eb02bb2
Additions for pointcloud in rviz and unstable traj logging
nickoenig37 Jul 26, 2024
28f2998
Fully working pointcloud topic visualization with monocular
nickoenig37 Jul 26, 2024
4f0bbe6
renaming image
nickoenig37 Aug 7, 2024
bc936d4
Merge pull request #1 from nickoenig37/mono_traj_bagging
nickoenig37 Aug 7, 2024
afb535a
comments and deleting unnecessary lines
nickoenig37 Aug 7, 2024
751da6d
updating the Readme
nickoenig37 Aug 7, 2024
2ad3e53
Merge pull request #1 from budisic-robotics/update_repo
nickoenig37 Aug 7, 2024
7e50e76
cropping gif
nickoenig37 Aug 7, 2024
8d74569
Merge pull request #2 from budisic-robotics/update_repo
nickoenig37 Aug 7, 2024
ede5919
Merge pull request #3 from nickoenig37/update_repo
nickoenig37 Aug 7, 2024
5c71348
Started rearranging the README
Aug 13, 2024
6625df1
Cyclone config file
nickoenig37 Aug 13, 2024
6121069
Merge branch 'ORBSLAM_mono' of github.com:budisic-robotics/ORB-SLAM3-…
nickoenig37 Aug 13, 2024
d92d234
Removed bash_history
Aug 13, 2024
1b02ec2
Added LD_LIBRARY_PATH to docker-compose
Aug 13, 2024
e40d243
Added some extra folders to container_root
Aug 13, 2024
ec79509
Added all build, install, log folders to .gitignore
Aug 13, 2024
8c489ff
Moved specification of ROS_DOMAIN_ID to compose
Aug 13, 2024
5e352d2
Moved Cyclone DDS setup to earlier section and expanded it
Aug 13, 2024
113c9c2
Update README.md
mbudisic Aug 13, 2024
62c3f82
get rid of "potential issues"
nickoenig37 Aug 13, 2024
5d904ac
title update
nickoenig37 Aug 15, 2024
b072135
small change
nickoenig37 Oct 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ container_root/colcon_ws/build/
container_root/colcon_ws/install/
container_root/colcon_ws/log/
container_root/colcon_ws/src/
**/build/
**/install/
**/log/
**/.bash_history
container_root/.cache/
container_root/.cache/
container_root/.config/
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,10 @@ RUN cd /root/ && sudo chmod +x * && ./vscode_install.sh && rm -rf vscode_install
RUN apt-get update && apt-get install ros-humble-pcl-ros tmux -y
RUN apt-get install ros-humble-nav2-common x11-apps nano -y
COPY ORB_SLAM3 /home/orb/ORB_SLAM3
RUN . /opt/ros/humble/setup.sh && cd /home/orb/ORB_SLAM3 && mkdir build && ./build.sh
RUN . /opt/ros/humble/setup.sh && cd /home/orb/ORB_SLAM3 && mkdir -p build && ./build.sh

# New dependencies with monocular addition
RUN apt-get install libcanberra-gtk-module libcanberra-gtk3-module -y

# For fixing communication between containers
RUN apt-get install -y ros-humble-rmw-cyclonedds-cpp
Binary file added ORBSLAM_Moving.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
116 changes: 92 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,144 @@
# ORB-SLAM3 ROS2 Wrapper Docker

This repository contains a dockerized comprehensive wrapper for ORB-SLAM3 on ROS 2 Humble for Ubuntu 22.04.
This repository contains a dockerized comprehensive wrapper for ORB-SLAM3 using a monocular camera on ROS 2 Humble for Ubuntu 22.04. This repository was adapted from a dockerized rgbd implementation of ORB-SLAM3 at <https://github.com/suchetanrs/ORB-SLAM3-ROS2-Docker>

# Demo GIF

![ORBSLAM3-GIF](orbslam3.gif)
![ORBSLAM3-GIF](ORBSLAM_Moving.gif)

# Steps to use this wrapper

## 1. Clone this repository

1. ```git clone https://github.com/suchetanrs/ORB-SLAM3-ROS2-Docker```
2. ```cd ORB-SLAM3-ROS2-Docker```
3. ```git submodule update --init --recursive --remote```
```bash
git clone <copy https or ssh repository location>
cd ORB-SLAM3-ROS2-MONO-Docker
git submodule update --init --recursive --remote
```

## 2. Install Docker on your system
## 2. Install Docker on your system (if not already installed)

```bash
cd ORB-SLAM3-ROS2-Docker
cd ORB-SLAM3-ROS2-MONO-Docker
sudo chmod +x container_root/shell_scripts/docker_install.sh
./container_root/shell_scripts/docker_install.sh
```

## 3. Build the image with ORB_SLAM3

1. Build the image: ```sudo docker build -t orb-slam3-humble:22.04 .```
2. Add ```xhost +``` to your ```.bashrc``` to support correct x11-forwarding using ```echo "xhost +" >> ~/.bashrc```
3. ```source ~/.bashrc```
4. You can see the built images on your machine by running ```sudo docker images```.
1. Add ```xhost +``` to your ```.bashrc``` to support correct x11-forwarding using ```echo "xhost +" >> ~/.bashrc```
1. ```source ~/.bashrc```
1. You can see the built images on your machine by running ```sudo docker images```.

## 4. Running the container

1. ```cd ORB-SLAM3-ROS2-Docker``` (ignore if you are already in the folder)
2. ```sudo docker compose run orb_slam3_22_humble```
3. This should take you inside the container. Once you are inside, run the command ```xeyes``` and a pair of eyes should pop-up. If they do, x11 forwarding has correctly been setup on your computer.
3. This should take you inside the container. Once you are inside, run the command ```xeyes``` and a pair of eyes should pop-up. If they do, x11 forwarding has correctly been setup on your computer. (Ignore the message:

```bash
bash: /root/colcon_ws/install/setup.bash: No such file or directory
```

It should go away once you complete the next step.)

## 5. Building the ORB-SLAM3 Wrapper

Launch the container using steps in (4).

```bash
cd /root/colcon_ws/
colcon build --symlink-install
```

The build process may emit warnings associated with `-Wreorder`, `-Wunused-parameter` and similar compiler flags.
You can ignore them.

If there are no errors (in addition to warnings above) then you can source the install script"

```bash
source install/setup.bash
```

# Container Information (Editing and Launching Files)

## Launching ORB-SLAM3

Launch the container using steps in (4).
If you are inside the container, run the following:

1. ```ros2 launch orb_slam3_ros2_wrapper unirobot.launch.py```
3. You can adjust the initial co-ordinates of the robot along with its namespace in the ```unirobot.launch.py``` file.
```bash
ros2 launch orb_slam3_ros2_wrapper rgb_unirobot.launch.py
```

## Interfacing ORB-SLAM3 nodes with external ROS2 processes

To make ORB-SLAM3 read from an external ROS2 simulation (or hardware teleoperation), one needs to ensure that the Docker container running ORB-SLAM3 and the external ROS2 are communicating correctly.

Presently, this has been configured using Cyclone DDS only.

1. Make sure that both the ORB-SLAM3 container and the external ROS2 have the same `ROS_DOMAIN_ID` set-up.

1. ORB-SLAM3 container is already configured to use Cyclone DDS.
The external ROS2 has to have the following steps configured, as detailed in <https://github.com/suchetanrs/ORB-SLAM3-ROS2-Docker/issues/8#issuecomment-2187977113>

1. Install Cyclone DDS:

## Running this with a Gazebo Classic simulation.
```bash
sudo apt-get install -y ros-humble-rmw-cyclonedds-cpp
```

1. Setup the ORB-SLAM3 ROS2 Docker using the steps above. Once you do (1) step in the ```Launching ORB-SLAM3``` section, you should see a window popup which is waiting for images. This is partially indicative of the setup correctly done.
2. Setup the simulation by following the README [here](https://github.com/suchetanrs/scout-husky-gazebo-ros2)
3. Once you are able to teleop the robot, you should be able to run ORB-SLAM3 with both the containers (simulation and wrapper) running parallely.
1. Create the Cyclone DDS configuration file in user's home folder (`~/.ros/cyclonedds.xml`) containing the following configuration:

### Potential issues you may face.
The simulation and the wrapper both have their ```ROS_DOMAIN_ID``` set to 55 so they are meant to work out of the box. However, you may face issues if this environment variable is not set properly. Before you start the wrapper, run ```ros2 topic list``` and make sure the topics namespaced with ```scout_2``` are visible inside the ORB-SLAM3 container provided the simulation is running along the side.
```xml
<?xml version="1.0" encoding="UTF-8" ?>
<CycloneDDS xmlns="https://cdds.io/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Domain id="any">
<General>
<NetworkInterfaceAddress>auto</NetworkInterfaceAddress>
<AllowMulticast>false</AllowMulticast>
</General>
<Discovery>
<ParticipantIndex>auto</ParticipantIndex>
<MaxAutoParticipantIndex>100</MaxAutoParticipantIndex>
<Peers>
<Peer Address="localhost" />
</Peers>
</Discovery>
</Domain>
</CycloneDDS>
```

1. Set up the following environment variables, e.g., in `.bashrc` add:

## Important notes
```bash

ORB-SLAM3 is launched from ```orb_slam3_docker_20_humble/orb_slam3_ros2_wrapper/launch/rgbd.launch.py``` which inturn is launched from ```orb_slam3_docker_20_humble/orb_slam3_ros2_wrapper/launch/unirobot.launch.py```
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export CYCLONEDDS_URI=~/.ros/cyclonedds.xml

Currently the ```rgbd.launch.py``` launch file defaults to ```orb_slam3_ros2_wrapper/params/scout_v2_rgbd.yaml```. You can modify this with your own parameter file in case you wish to use your own camera.
```

The very initial versions of this code were derived from [thien94/orb_slam3_ros_wrapper](https://github.com/thien94/orb_slam3_ros_wrapper) and [zang9/ORB_SLAM3_ROS2](https://github.com/zang09/ORB_SLAM3_ROS2)
1. Setup the ORB-SLAM3 ROS2 Docker using the steps above. Once you do (1) step in the ```Launching ORB-SLAM3``` section, you should see a window popup which is waiting for images. This is partially indicative of the setup correctly done. However, I recommend you run your simulation first and then run the ORB-SLAM3 wrapper for monocular.

- NOTE: for a monocular camera, you need multiple keyframes to begin tracking. So, you may need to move the camera around a bit to get the ORB-SLAM3 to start tracking.

If you're having issues interfacing between your simulation and the ROS2 communication side of things see the potential issues section below!

## Making Changes & Managing the Workspace

- For starters, all changed code is in the ```orb_slam3_ros2_wrapper``` directory. This is where you will be making changes to the ORB-SLAM3 wrapper, the ```ORB_SLAM3``` directory is the original codebase and should not be modified.
- For managing sensors being used by the algorithm, see the "ROS Parameter descriptions" section below. These paramater files are initialized in the `reg_rgb.launch.py` file.
- For changing topic names to subscribe to, go to orb_slam3_ros2_wrapper/src/monocular/rgb-slam-node.cpp

## Camera Calibration and Gazebo Camera Calibration
- The algorithm is much better when using your own camera calibration file. I recommend following these instructions to calibrate the camera: `https://docs.ros.org/en/rolling/p/camera_calibration/tutorial_mono.html`
- Take the values this calibration gave you and make the corresponding changes to the format of an existing file. If you don't understand the format value differences between files, I recommend giving both of them to GPT and asking it to write your values to the correct file format.
- For calibrating your camera in gazebo I recommend following this link: `https://medium.com/@arshad.mehmood/camera-calibration-in-gazebo-ros2-6bed2620a652`

## ROS Parameter descriptions

| Parameter Name | Default Value | Description |
|-------------------------|---------------|-----------------------------------------------------------------------------|
| `robot_base_frame` | `base_footprint` | The name of the frame attached to the robot's base. |
Expand All @@ -80,4 +148,4 @@ The very initial versions of this code were derived from [thien94/orb_slam3_ros_
| `robot_y` | `0.0` | The robot's initial y-coordinate in the global frame. Specifies the starting position along the y-axis. The SLAM Wrapper will assume this to be the initial y position|
| `visualization` | `true` | A boolean flag to enable or disable visualization. When set to `true`, the ORB-SLAM3 viewer will show up with the tracked points and the keyframe trajectories.|
| `ros_visualization` | `false` | A boolean flag to control ROS-based visualization. If set to `true`, it enables ROS tools like RViz to visualize the robot's data. (3D position of the tracked points etc.) **This feature is unstable and not tested as of now**|
| `no_odometry_mode` | `false` | A boolean flag to toggle odometry mode. When `true`, the system operates without relying on odometry data, which might be used in scenarios where odometry information is unavailable or unreliable. In this case, it publishes the transform directly between the ```global_frame``` and the ```robot_base_frame```|
| `no_odometry_mode` | `false` | A boolean flag to toggle odometry mode. When `true`, the system operates without relying on odometry data, which might be used in scenarios where odometry information is unavailable or unreliable. In this case, it publishes the transform directly between the ```global_frame``` and the ```robot_base_frame```|
Loading