Skip to content

Commit 42c0f1e

Browse files
committed
functional on rolling
1 parent 60b495c commit 42c0f1e

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
ARG ROS_DISTRO=rolling
2+
FROM ros:rolling
3+
4+
ARG USERNAME=ros_user
5+
ARG USER_UID=1000
6+
ARG USER_GID=$USER_UID
7+
8+
# Delete user if it exists in container (e.g Ubuntu Noble: ubuntu)
9+
RUN if id -u $USER_UID ; then userdel `id -un $USER_UID` ; fi
10+
11+
# Create the user
12+
RUN groupadd --gid $USER_GID $USERNAME \
13+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
14+
#
15+
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
16+
&& apt-get update \
17+
&& apt-get install -y sudo \
18+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
19+
&& chmod 0440 /etc/sudoers.d/$USERNAME
20+
RUN apt-get update && apt-get upgrade -y
21+
RUN apt-get install -y python3-pip
22+
23+
# Create workspace directory with proper ownership
24+
RUN mkdir -p /home/ws && chown -R $USERNAME:$USERNAME /home/ws
25+
26+
RUN git clone https://github.com/ros-navigation/navigation2.git -b main /home/ws/src/navigation2
27+
28+
ENV SHELL=/bin/bash
29+
30+
# [Optional] Set the default user. Omit if you want to keep the default as root.
31+
USER $USERNAME
32+
CMD ["/bin/bash"]

.devcontainer/devcontainer.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "Navigation2 Tutorials Development Container",
3+
"privileged": true,
4+
"remoteUser": "ros_user",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
"USERNAME": "ros_user",
9+
"ROS_DISTRO": "rolling"
10+
}
11+
},
12+
"workspaceFolder": "/home/ws",
13+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ws/src/navigation2_tutorials,type=bind",
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"ms-vscode.cpptools",
18+
"ms-vscode.cpptools-themes",
19+
"twxs.cmake",
20+
"donjayamanne.python-extension-pack",
21+
"eamodio.gitlens",
22+
"ms-iot.vscode-ros",
23+
"ms-vscode.cmake-tools",
24+
"ms-python.python",
25+
"ms-python.flake8",
26+
"charliermarsh.ruff"
27+
]
28+
}
29+
},
30+
"containerEnv": {
31+
"DISPLAY": "unix:0",
32+
"ROS_AUTOMATIC_DISCOVERY_RANGE": "LOCALHOST",
33+
"ROS_DOMAIN_ID": "42",
34+
"ROS_DISTRO": "${ROS_DISTRO}"
35+
},
36+
"runArgs": [
37+
"--net=host",
38+
"--pid=host",
39+
"--ipc=host",
40+
"-e", "DISPLAY=${env:DISPLAY}"
41+
],
42+
"mounts": [
43+
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached",
44+
"source=/dev/dri,target=/dev/dri,type=bind,consistency=cached"
45+
],
46+
"postCreateCommand": "sudo rosdep update && sudo rosdep install --from-paths src --ignore-src -r -y"
47+
}

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# navigation2_tutorials
22
Tutorial code referenced in https://docs.nav2.org/
3+
4+
## Quick Start with Dev Container
5+
6+
This repository includes a VS Code development container for easy setup. Open in VS Code and select "Reopen in Container" when prompted or by using the shortcut Ctrl+Shift+P to bring up the command palette and selecting "Dev containers: Rebuild and Reopen in Container". For detailed setup instructions, see the [official ROS 2 documentation](https://docs.ros.org/en/rolling/How-To-Guides/Setup-ROS-2-with-VSCode-and-Docker-Container.html).

0 commit comments

Comments
 (0)