-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Assume-Zhan/rtabmap-humble-docker
Dockerfile with ROS2 humble and RTAB-MAP
- Loading branch information
Showing
23 changed files
with
1,836 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* Reference: https://aka.ms/devcontainer.json */ | ||
{ | ||
"name": "ROS2 and RTAB-Map Container", | ||
"dockerComposeFile": "../docker/docker-compose.yaml", | ||
"service": "ros2-rtabmap", | ||
|
||
// workspace settings | ||
"workspaceFolder": "/home/ros2-agv-essentials/rtabmap_ws", | ||
|
||
// Vscode extensions | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-vscode.cpptools", | ||
"ms-vscode.cpptools-themes", | ||
"twxs.cmake", | ||
"donjayamanne.python-extension-pack", | ||
"eamodio.gitlens", | ||
"ms-iot.vscode-ros" | ||
] | ||
} | ||
}, | ||
|
||
// Lifecycle scripts | ||
"postCreateCommand": "${containerWorkspaceFolder}/.devcontainer/postCreateCommand.sh" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sudo apt-get update | ||
sudo rosdep update | ||
# Note: The following commands are commented out to prevent unintended install/builds. | ||
# sudo rosdep install --from-paths src --ignore-src -y | ||
# sudo chown -R user /home/ros2-agv-essentials/ | ||
# colcon build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.vscode | ||
/build | ||
/install | ||
/log | ||
docker/cache/* | ||
!docker/cache/.gazebo | ||
docker/cache/.gazebo/* | ||
!docker/cache/.gazebo/.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# ROS2 RTAB-Map | ||
|
||
### Run with docker | ||
|
||
```bash | ||
git clone https://github.com/j3soon/ros2-agv-essentials.git | ||
``` | ||
|
||
```bash | ||
cd ros2-agv-essentials/rtabmap_ws/docker | ||
docker-compose pull | ||
docker-compose up -d --build | ||
``` | ||
|
||
- Attach to the container | ||
```sh | ||
docker attach ros2-rtabmap-ws | ||
cd /home/ros2-agv-essentials/rtabmap_ws | ||
colcon build --symlink-install | ||
``` | ||
|
||
### LiDAR test with gazebo | ||
|
||
- Launch Gazebo with turtlebot3 in `tmux` | ||
```bash | ||
ros2 launch rtabmap_sim sim_robot.launch.py | ||
``` | ||
- Run rtabmap LiDAR demo in a new `tmux` window | ||
```bash | ||
ros2 launch rtabmap_demos turtlebot3_scan.launch.py | ||
``` | ||
|
||
### RGBD test with gazebo | ||
|
||
- Launch Gazebo with turtlebot3 in `tmux` | ||
```bash | ||
ros2 launch rtabmap_sim sim_robot.launch.py | ||
``` | ||
- Run rtabmap LiDAR demo in a new `tmux` window | ||
```bash | ||
ros2 launch rtabmap_demos turtlebot3_rgbd.launch.py | ||
``` | ||
|
||
### Dual sensor test with gazebo | ||
|
||
- Launch Gazebo with turtlebot3 in `tmux` | ||
```bash | ||
ros2 launch rtabmap_sim sim_robot.launch.py | ||
``` | ||
- Run dual sensor demo in a new `tmux` window | ||
```bash | ||
ros2 launch rtabmap_sim dual_sensor.launch.py | ||
``` | ||
|
||
### Run with rqt | ||
|
||
- Running in a new `tmux` window | ||
```bash | ||
rqt_robot_steering | ||
``` | ||
|
||
### Result | ||
|
||
- After you've run the demo, you could find the following result directly. | ||
|
||
1. LiDAR test | ||
<center> | ||
<img src="./assets/lidar_test.png" width="75%"/> | ||
</center> | ||
2. RGBD test | ||
<center> | ||
<img src="./assets/rgbd_test.png" width="75%"/> | ||
</center> | ||
3. Dual sensor test | ||
<center> | ||
<img src="./assets/dual_test.png" width="75%"/> | ||
</center> | ||
|
||
### Reference | ||
|
||
- [RTAB-Map wiki](https://github.com/introlab/rtabmap/wiki) | ||
|
||
### Existing issues | ||
|
||
- `VTK` warning | ||
```bash | ||
QVTKOpenGLWidget: Warning: In /build/vtk6-6.3.0+dfsg1/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 781 | ||
... | ||
``` | ||
- It seems that the warning isn't a big deal. But it will interrupt debugging in the future. | ||
- Possible solution : set `VTK_LEGACY_REMOVE`, but it required to build from source. | ||
- Still not tested yet. | ||
- [Issue Reference](https://discourse.vtk.org/t/vtk-9-0-rc1/2916) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Source global ROS2 environment | ||
source /opt/ros/$ROS_DISTRO/setup.bash | ||
# Source workspace environment | ||
# Note: If you have not built your workspace yet, the following command will fail | ||
source $ROS2_WS/install/setup.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
FROM introlab3it/rtabmap:jammy | ||
|
||
LABEL org.opencontainers.image.authors="assume0701@gmail.com" | ||
LABEL description = \ | ||
"A image for ROS2 humble and RTAB-Map develop environment." | ||
|
||
ARG USERNAME=user | ||
|
||
RUN apt-get update && apt-get upgrade -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
############################################# | ||
# --- Basic setup --- | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
sudo \ | ||
vim \ | ||
curl \ | ||
tree \ | ||
tmux \ | ||
# --- | ||
# Simulation required packages | ||
ros-humble-turtlebot3 \ | ||
ros-humble-turtlebot3-gazebo \ | ||
ros-humble-gazebo-ros-pkgs \ | ||
ros-humble-joint-state-publisher-gui \ | ||
ros-humble-rqt-robot-steering \ | ||
# --- | ||
# RTAB-MAP required packages | ||
ros-humble-rtabmap-ros && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Gazebo | ||
RUN curl -sSL http://get.gazebosim.org | sh | ||
|
||
# add user with default bash | ||
RUN adduser --disabled-password --gecos '' --shell /bin/bash ${USERNAME} && \ | ||
adduser ${USERNAME} sudo && \ | ||
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
||
COPY .bashrc /home/$USERNAME/.bashrc | ||
|
||
# Login with user | ||
USER ${USERNAME} | ||
|
||
CMD ["bash"] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
version: '3.0' | ||
services: | ||
# Container for ROS2 rtabmap | ||
rtabmap-ws: | ||
# Build or Reference the image | ||
build: . | ||
image: j3soon/ros2-rtabmap-ws | ||
container_name: ros2-rtabmap-ws | ||
stdin_open: true | ||
tty: true | ||
privileged: true | ||
command: bash | ||
network_mode: host | ||
working_dir: /home/ros2-agv-essentials/rtabmap_ws | ||
|
||
# Container Settings | ||
environment: | ||
- DISPLAY=${DISPLAY} | ||
# Set ros2 environment variables. | ||
# References: | ||
# - https://docs.ros.org/en/humble/Concepts/Intermediate/About-Domain-ID.html | ||
# - https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html | ||
# - https://docs.ros.org/en/humble/Tutorials/Demos/Logging-and-logger-configuration.html#console-output-colorizing | ||
- ROS_LOCALHOST_ONLY=1 | ||
- ROS_DOMAIN_ID=42 | ||
- ROS2_WS=/home/ros2-agv-essentials/rtabmap_ws | ||
- RCUTILS_COLORIZED_OUTPUT=1 | ||
# If you want to access GPU, please uncomment the lines below. | ||
# Reference : https://docs.docker.com/compose/gpu-support/ | ||
# deploy: | ||
# resources: | ||
# reservations: | ||
# devices: | ||
# - driver: nvidia | ||
# count: all | ||
# capabilities: [ gpu ] | ||
volumes: | ||
# Mount local timezone into container. ( Readonly ) | ||
# Reference: https://stackoverflow.com/questions/57607381/how-do-i-change-timezone-in-a-docker-container | ||
- /etc/timezone:/etc/timezone:ro | ||
- /etc/localtime:/etc/localtime:ro | ||
# Mount X11 server | ||
- /tmp/.X11-unix:/tmp/.X11-unix | ||
# Direct Rendering Infrastructure | ||
- /dev/dri:/dev/dri | ||
# Mount sound card to prevent Gazebo warning. | ||
- /dev/snd:/dev/snd | ||
# Mount Gazebo models directory to reuse models downloaded during first launch. | ||
# Reference: https://answers.ros.org/question/365658 | ||
- ./cache/.gazebo:/home/user/.gazebo | ||
# Mounting the following directories will forbid direct deletion. | ||
# Consider mount these directories only if the build process is slow. | ||
# "source=${localWorkspaceFolder}/../cache/humble/build,target=/home/ws/build,type=bind", | ||
# "source=${localWorkspaceFolder}/../cache/humble/install,target=/home/ws/install,type=bind", | ||
# "source=${localWorkspaceFolder}/../cache/humble/log,target=/home/ws/log,type=bind" | ||
# Mount workspace | ||
- ../..:/home/ros2-agv-essentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(rtabmap_sim) | ||
|
||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
add_compile_options(-Wall -Wextra -Wpedantic) | ||
endif() | ||
|
||
# find dependencies | ||
find_package(ament_cmake REQUIRED) | ||
# uncomment the following section in order to fill in | ||
# further dependencies manually. | ||
# find_package(<dependency> REQUIRED) | ||
|
||
install(DIRECTORY launch config models urdf | ||
DESTINATION share/${PROJECT_NAME}/ | ||
) | ||
|
||
if(BUILD_TESTING) | ||
find_package(ament_lint_auto REQUIRED) | ||
# the following line skips the linter which checks for copyrights | ||
# comment the line when a copyright and license is added to all source files | ||
set(ament_cmake_copyright_FOUND TRUE) | ||
# the following line skips cpplint (only works in a git repo) | ||
# comment the line when this package is in a git repo and when | ||
# a copyright and license is added to all source files | ||
set(ament_cmake_cpplint_FOUND TRUE) | ||
ament_lint_auto_find_test_dependencies() | ||
endif() | ||
|
||
ament_package() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
rtabmap: | ||
ros__parameters: | ||
frame_id: 'base_footprint' | ||
use_sim_time: True | ||
use_action_for_goal: True | ||
qos_image: 2 | ||
qos_imu: 2 | ||
Reg/Force3DoF: 'true' | ||
Optimizer/GravitySigma: '0' | ||
|
||
# For LiDAR data subscription | ||
subscribe_scan: True | ||
|
||
# For RGB-D data subscription | ||
subscribe_depth: True | ||
subscribe_rgb: True | ||
|
||
# Data synchronization | ||
approx_sync: True |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from launch import LaunchDescription | ||
|
||
from launch.substitutions import PathJoinSubstitution | ||
|
||
from launch_ros.actions import Node | ||
from launch_ros.substitutions import FindPackageShare | ||
|
||
def generate_launch_description(): | ||
|
||
# Load the rtabmap settings file | ||
rtabmap_settings = PathJoinSubstitution([ | ||
FindPackageShare("rtabmap_sim"), | ||
"config/dual_sensor.yaml" | ||
]) | ||
|
||
# Setup the remaps for camera topics | ||
remappings = [ | ||
('rgb/image', '/camera/image_raw'), | ||
('rgb/camera_info', '/camera/camera_info'), | ||
('depth/image', '/camera/depth/image_raw') | ||
] | ||
|
||
rtabmap_slam = Node( | ||
package = 'rtabmap_slam', | ||
executable = 'rtabmap', | ||
parameters = [rtabmap_settings], | ||
remappings = remappings, | ||
arguments = ['-d'] | ||
) | ||
|
||
rtabmapviz = Node( | ||
package = 'rtabmap_viz', | ||
executable = 'rtabmap_viz', | ||
parameters = [rtabmap_settings], | ||
remappings = remappings | ||
) | ||
|
||
return LaunchDescription([ | ||
|
||
# Nodes to launch | ||
rtabmap_slam, rtabmapviz | ||
]) |
Oops, something went wrong.