If you are using ROS2 Humble container, you would need to build/install rtabmap_ros inside the container, not outside.
For a fast test you can try
rtabmap_ros docker image to launch any examples from
here:
```
docker run -it --rm --privileged --user $UID \
-e ROS_HOME=/tmp/.ros \
-e OMP_WAIT_POLICY=passive \
--network=host \
--ipc=host \
-v ~/.ros:/tmp/.ros \
introlab3it/rtabmap_ros:humble-latest \
ros2 launch rtabmap_examples realsense_d435i_infra.launch.py
```
If you have Nvidia GPU, you launch like this to get UI working:
```
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run -it --rm --privileged --user $UID \
-e DISPLAY=$DISPLAY \
-e QT_X11_NO_MITSHM=1 \
-e NVIDIA_VISIBLE_DEVICES=all \
-e NVIDIA_DRIVER_CAPABILITIES=all \
-e XAUTHORITY=$XAUTH \
-e ROS_HOME=/tmp/.ros \
-e OMP_WAIT_POLICY=passive \
--runtime=nvidia \
--network=host \
--ipc=host \
-v ~/.ros:/tmp/.ros \
-v $XAUTH:$XAUTH \
-v /tmp/.X11-unix:/tmp/.X11-unix \
introlab3it/rtabmap_ros:humble-latest \
ros2 launch rtabmap_examples realsense_d435i_infra.launch.py
```
Reference:
https://github.com/introlab/rtabmap_ros/tree/ros2/dockerEDITTo rebuild docker image with latest rtabmap version or if you modify some files, you can do:
git clone --branch ros2 https://github.com/introlab/rtabmap_ros.git
cd rtabmap_ros
docker build . -t rtabmap_ros -f docker/humble/latest/Dockerfile
It is also possible to open rtabmap_ros folder in VSCode and re-open in a dev container.