Skip to content

add devcontainer support #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: rolling
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG ROS_DISTRO=rolling
ARG BASE_IMAGE=ghcr.io/ros-navigation/nav2_docker:${ROS_DISTRO}-nightly
FROM ${BASE_IMAGE}

ENV SHELL=/bin/bash

CMD ["/bin/bash"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can just set this in the nav2_docker files instead so that they're ready to go?

59 changes: 59 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "Nav2",
"privileged": true,
"remoteUser": "root",
"build": {
"dockerfile": "Dockerfile",
"args": {
"USERNAME": "root",
"ROS_DISTRO": "rolling"
}
},
"runArgs": [
"--name=nav2",
// "--cap-add=SYS_PTRACE", // enable debugging, e.g. gdb
"--ipc=host", // shared memory transport with host, e.g. rviz GUIs
"--network=host", // network access to host interfaces, e.g. eth0
"--pid=host", // DDS discovery with host, without --network=host
"--privileged", // device access to host peripherals, e.g. USB
// "--security-opt=seccomp=unconfined", // enable debugging, e.g. gdb
"--volume=/tmp/.X11-unix:/tmp/.X11-unix:rw", // X11 socket for GUI applications
"--shm-size=1000mb", // shared memory size for DDS/ROS communication
"--gpus=all" // access to all GPUs, e.g. for GPU-accelerated applications
],
"workspaceFolder": "/root/nav2_ws",
"workspaceMount": "source=${localWorkspaceFolder},target=/root/nav2_ws/src/navigation2_tutorials,type=bind",
"remoteEnv": {
"OVERLAY_MIXINS": "release ccache lld",
"CCACHE_DIR": "/tmp/.ccache",
"QT_X11_NO_MITSHM": "1", // disable MIT-SHM for X11 forwarding
"DISPLAY": "${localEnv:DISPLAY}" // X11 forwarding
},
"mounts": [
{
"source": "${localEnv:XAUTHORITY}",
"target": "/root/.Xauthority",
"type": "bind"
}
],
"features": {
// "ghcr.io/devcontainers/features/desktop-lite:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"customizations": {
"codespaces": {},
"vscode": {
"settings": {},
"extensions": [
"althack.ament-task-provider",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"GitHub.copilot",
"ms-iot.vscode-ros",
"streetsidesoftware.code-spell-checker",
"twxs.cmake"
]
}
},
"postCreateCommand": "sudo apt-get update && rosdep update && sudo rosdep install --from-paths src --ignore-src -y -r"
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# navigation2_tutorials
Tutorial code referenced in https://docs.nav2.org/

## Quick Start with Dev Container

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).