Skip to content

Commit f3b0a39

Browse files
author
Lorenzo
committed
Merge PR #110 (ROS 2 Humble Python and C++ Support) while preserving mole-specific fixes
2 parents b182b06 + cb57082 commit f3b0a39

36 files changed

+3336
-921
lines changed

.devcontainer/devcontainer.json

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
2+
{
3+
"name": "Demo Elevation Mapping CUPY Workspace",
4+
"dockerFile": "../docker/Dockerfile.x64",
5+
"context": "../",
6+
"remoteUser": "ros",
7+
"runArgs": [
8+
"--network=host",
9+
"--cap-add=SYS_PTRACE",
10+
"--cap-add=SYS_NICE",
11+
"--security-opt=seccomp:unconfined",
12+
"--security-opt=apparmor:unconfined",
13+
// "--volume=/tmp/.X11-unix:/tmp/.X11-unix",
14+
"--volume=/mnt/wslg:/mnt/wslg",
15+
"--ipc=host",
16+
"--pid=host",
17+
"--runtime=nvidia",
18+
"--gpus=all",
19+
"--privileged",
20+
"--ulimit=rtprio=98",
21+
"--ulimit=rttime=-1",
22+
"--ulimit=memlock=8428281856",
23+
"--name=emcupy-ros2-devcontainer"
24+
],
25+
"containerEnv": {
26+
"DISPLAY": "${localEnv:DISPLAY}", // Needed for GUI try ":0" for windows
27+
"WAYLAND_DISPLAY": "${localEnv:WAYLAND_DISPLAY}",
28+
"XDG_RUNTIME_DIR": "${localEnv:XDG_RUNTIME_DIR}",
29+
"PULSE_SERVER": "${localEnv:PULSE_SERVER}",
30+
"LIBGL_ALWAYS_SOFTWARE": "1" // Needed for software rendering of opengl
31+
},
32+
"mounts": [
33+
"source=/dev,target=/dev,type=bind,consistency=cached"
34+
// "source=~/bag_files,target=/workspaces/vscode-container-workspace/bag_files,type=bind,consistency=cached"
35+
],
36+
"customizations": {
37+
"vscode": {
38+
"settings": {
39+
"remote.autoForwardPorts": false,
40+
"remote.autoForwardPortsSource": "output",
41+
"otherPortsAttributes": { "onAutoForward" : "ignore" }
42+
},
43+
"extensions": [
44+
"althack.ament-task-provider",
45+
"betwo.b2-catkin-tools",
46+
"DotJoshJohnson.xml",
47+
"ms-azuretools.vscode-docker",
48+
"ms-vscode.cmake-tools",
49+
"ms-python.python",
50+
"ms-vscode.cpptools",
51+
"redhat.vscode-yaml",
52+
"smilerobotics.urdf",
53+
"streetsidesoftware.code-spell-checker",
54+
"twxs.cmake",
55+
"yzhang.markdown-all-in-one",
56+
"zachflower.uncrustify",
57+
"mhutchie.git-graph",
58+
"eamodio.gitlens",
59+
"ms-vscode.cpptools-extension-pack",
60+
"usernamehw.errorlens",
61+
"ms-iot.vscode-ros",
62+
"alefragnani.Bookmarks",
63+
"ms-vscode.live-server"
64+
65+
]
66+
}
67+
},
68+
"workspaceMount": "source=${localWorkspaceFolder}/,target=/home/ros/workspace/src/elevation_mapping_cupy/,type=bind",
69+
"workspaceFolder": "/home/ros/workspace/src/elevation_mapping_cupy/"
70+
}

README.md

Lines changed: 137 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,140 @@
1-
# Elevation Mapping cupy
1+
# ROS2 Elevation Mapping Cupy
2+
**Status**: Under Development 🚧
3+
## Features
4+
- **Point cloud-based map update**: *Functional*
5+
- **Image-based map update**: *Ongoing development*
6+
- **C++ Node**: *Functional*
7+
- **Python Node**: *Functional*
8+
- **Docker & VS Code Devcontainer**: *Provided*
9+
10+
<!-- ![Elevation Map in ROS 2 Humble with Gazebo ](https://github.com/user-attachments/assets/0dd9ebbe-a90d-486f-9871-81921308fab9) -->
11+
12+
## Installation
13+
A docker file, installation and build scripts, and a VS Code Dev Container have all been provided to ease integration and development.
14+
This has been tested with Ubuntu 22.04, ROS 2 Humble, Zenoh RMW, CUDA 12.1, and PyTorch 2.6.0.
15+
Some dependency issues with numpy, transforms3d, scipy, and ros2_numpy arose during setup so if versions of any of these packages are changed you may run into issues.
16+
The package.xml has been updated to ensure most dependencies are automatically installed via rosdep and some extra rosdep entries are provided to ensure proper versioning.
17+
This is not possible for some packages, e.g. pytorch, due to need for providing an --extra-index-url during installation.
18+
Therefore, this requirement is satsified inside of the docker build.
19+
20+
To test out this package with the turtlebot3 Gazebo (classic) simulation you will need to install:
21+
- VS Code
22+
- Docker
23+
- NVIDIA Container Toolkit
24+
- NVIDIA CUDA Toolkit
25+
26+
### Visual Studio Code
27+
```bash
28+
sudo snap install --classic code
29+
```
30+
31+
### Docker Installation
32+
```bash
33+
# Add Docker's official GPG key
34+
sudo apt-get update
35+
sudo apt-get install ca-certificates curl gnupg -y
36+
sudo install -m 0755 -d /etc/apt/keyrings
37+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
38+
sudo chmod a+r /etc/apt/keyrings/docker.gpg
39+
40+
# Add Docker repository
41+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
42+
sudo apt-get update
43+
44+
# Install Docker
45+
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
46+
47+
```
48+
49+
### NVIDIA Container Toolkit Installation
50+
```bash
51+
# Configure the repository
52+
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
53+
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
54+
55+
# Update and install
56+
sudo apt-get update
57+
sudo apt-get install -y nvidia-container-toolkit
58+
59+
# Configure Docker for NVIDIA
60+
sudo nvidia-ctk runtime configure --runtime=docker
61+
sudo systemctl restart docker
62+
63+
# Change Docker root folder
64+
cd
65+
mkdir docker
66+
sudo tee /etc/docker/daemon.json > /dev/null <<EOT
67+
{
68+
"data-root": "$HOME/docker",
69+
"runtimes": {
70+
"nvidia": {
71+
"args": [],
72+
"path": "nvidia-container-runtime"
73+
}
74+
}
75+
}
76+
EOT
77+
```
78+
79+
### NVIDIA CUDA-Toolkit install
80+
Use the following link for install install instructions:
81+
https://developer.nvidia.com/cuda-12-1-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local
82+
83+
### Docker Configuration and Workspace Cloning
84+
```bash
85+
sudo usermod -aG docker ${USER}
86+
# Use gituser.sh for Git credential setup
87+
```
88+
### Restart Your Computer
89+
- After completing the setup and configuration steps, it is necessary to restart your computer to ensure that all changes take effect.
90+
91+
---------------------------------------------------------
92+
93+
### Run the Container
94+
95+
#### Clone the Elevation Mapping CUPY Repository
96+
```bash
97+
cd /home/<USERNAME>/
98+
git clone -b ros2_humble https://github.com/jwag/elevation_mapping_cupy.git
99+
```
100+
101+
#### Building the Docker Workspace Container
102+
- Open the folder with VS Code
103+
- Select **"Dev Containers: Reopen in container"** in the bottom left from the blue button which will build the docker image.
104+
- Setup the workspace
105+
```bash
106+
./docker/setup.sh
107+
```
108+
- Build the workspace
109+
```bash
110+
./docker/build.sh
111+
112+
#### Run The Turtlebot3 Demo
113+
The docker should set the environmental variable `TURTLEBOT3_MODEL=waffle_realsense_depth` to select the correct version of the turtlebot to simulate.
114+
115+
In the first terminal start the zenoh router:
116+
```bash
117+
ros2 run rmw_zenoh_cpp rmw_zenohd
118+
```
119+
120+
In a second terminal launch the turtlebot3 in Gazebo with the following command:
121+
```bash
122+
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
123+
```
124+
125+
In a third terminal launch the elevation mapping node with the configs for the turtle. Set use_python_node to true to override the default use of the cpp node if you wish:
126+
```bash
127+
ros2 launch elevation_mapping_cupy elevation_mapping_turtle.launch.py use_python_node:=false
128+
```
129+
130+
In a fourth terminal run the turtlebot3 teleop node if you want to drive the turtlebot around using the keyboard:
131+
```bash
132+
ros2 run turtlebot3_teleop teleop_keyboard
133+
```
134+
135+
---
136+
137+
# Elevation Mapping cupy (*Instructions Not Updated for ROS2*)
2138

3139
![python tests](https://github.com/leggedrobotics/elevation_mapping_cupy/actions/workflows/python-tests.yml/badge.svg)
4140

0 commit comments

Comments
 (0)