-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
548 additions
and
56 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,75 @@ | ||
# Use the official Ubuntu 20.04 as a base image | ||
FROM ubuntu:20.04 | ||
|
||
# Set environment variables for non-interactive installation | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
ARG uid=1002:1002 | ||
ARG gid=1002:1002 | ||
ARG username=local | ||
|
||
# Update and install necessary packages | ||
RUN apt-get update && apt-get install -y \ | ||
lsb-release \ | ||
curl \ | ||
gnupg2 \ | ||
build-essential \ | ||
cmake \ | ||
git \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Setup sources for ROS Noetic | ||
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' | ||
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - | ||
|
||
# Install ROS Noetic | ||
RUN apt-get update && apt-get install -y \ | ||
ros-noetic-desktop-full \ | ||
python3-rosdep \ | ||
python3-rosinstall \ | ||
python3-rosinstall-generator \ | ||
python3-wstool \ | ||
python3-rosdep \ | ||
python3-catkin-tools \ | ||
python3-pip \ | ||
python3-rosbag \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install VIM | ||
RUN apt-get update && apt-get install -y vim | ||
|
||
# Initialize rosdep | ||
RUN rosdep init && rosdep update | ||
|
||
# Install pip requirements | ||
RUN pip3 install scipy numpy matplotlib rosbags | ||
|
||
# Setup environment | ||
RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
# User setup | ||
RUN useradd -m $username -l -u "$(echo $uid | cut -d: -f1)" \ | ||
&& usermod -u "$(echo $uid | cut -d: -f1)" $username \ | ||
&& groupmod -g "$(echo $gid | cut -d: -f2)" $username \ | ||
&& usermod -aG sudo,video,dialout,plugdev,audio $username \ | ||
&& echo $username ' ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers \ | ||
&& mkdir -p /home/$username/.cache /home/$username/.ssh \ | ||
&& ssh-keyscan github.com >> /home/$username/.ssh/known_hosts \ | ||
&& chown -R $username:$username /home/$username | ||
|
||
# install ssh | ||
RUN apt-get update && apt-get install -y openssh-server | ||
|
||
# Create a workspace | ||
USER $username | ||
RUN mkdir -p /home/local/catkin_ws/src | ||
WORKDIR /home/local/catkin_ws | ||
|
||
# Build the workspace | ||
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && catkin_make" | ||
RUN rm -rf /home/local/catkin_ws/build /home/local/catkin_ws/devel | ||
|
||
# Set the default command to run when starting the container | ||
CMD ["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,10 @@ | ||
# How to use a devcontainer for development | ||
|
||
1. Install the [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension in VSCode | ||
2. Install Docker on local machine (https://docs.docker.com/desktop/setup/install/linux/ubuntu/) | ||
3. Open the allan_variance_ros repository in VSCode | ||
4. Reopen in Container: Use the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on macOS) and select "Remote-Containers: Reopen in Container". This will build the container using the Dockerfile and open your project inside the container | ||
5. Run `catkin build allan_variance_ros` to build the package | ||
6. Run `rosrun allan_variance_ros allan_variance /path/to/rosbag.bag /path/to/config.yaml` to run the tool | ||
|
||
Once the repository is open in the container, you can develop as normal following the instructions in the [README.md](../README.md) 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,131 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/docker-from-docker-compose | ||
{ | ||
"name": "ROS Dev Container", | ||
"dockerComposeFile": [ | ||
"${localWorkspaceFolder}/.devcontainer/docker-compose.devcontainer.yaml" | ||
], | ||
"service": "devcontainer", | ||
"containerUser": "local", | ||
"workspaceFolder": "/home/local/catkin_ws/src/${localWorkspaceFolderBasename}", | ||
|
||
// Setup the environment | ||
"initializeCommand": "${localWorkspaceFolder}/.devcontainer/setup_base_env.sh", | ||
|
||
"onCreateCommand": "${containerWorkspaceFolder}/.devcontainer/setup_container.sh", | ||
|
||
// Sets or overrides environment variables for the container for supporting services/tools (or sub-processes like terminals) | ||
"remoteEnv": { | ||
"DISPLAY": "${localEnv:DISPLAY}", | ||
"XAUTHORITY": "/home/${containerEnv:USER_DOCKER}/.Xauthority", | ||
"XDG_RUNTIME_DIR": "/run/user/${containerEnv:UID}" | ||
}, | ||
|
||
// Add ptrace capability and configure security to facilitate debugging and display forwarding | ||
"capAdd": [ | ||
"SYS_PTRACE", | ||
"NET_ADMIN" | ||
], | ||
"securityOpt": [ | ||
"seccomp=unconfined", | ||
"apparmor=unconfined" // This allows RViz and other dbus-based apps to run | ||
], | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"[email protected]", | ||
"eamodio.gitlens", | ||
"hbenl.vscode-test-explorer", | ||
"llvm-vs-code-extensions.vscode-clangd", | ||
"matepek.vscode-catch2-test-adapter", | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"ms-vscode.cpptools", | ||
"ms-vscode.cpptools-themes", | ||
"ms-vscode-remote.remote-containers", | ||
"rioj7.command-variable", | ||
"streetsidesoftware.code-spell-checker", | ||
"twxs.cmake", | ||
"ms-python.debugpy" | ||
], | ||
"settings": { | ||
"bazel.queriesShareServer": false, | ||
"C_Cpp.intelliSenseEngine": "disabled", // Using clangd now! | ||
"C_Cpp.default.cppStandard": "c++17", | ||
"C_Cpp.default.cStandard": "gnu17", | ||
"[cpp]": { | ||
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd" | ||
}, | ||
"dev.containers.dockerCredentialHelper": false, | ||
"files.exclude": { | ||
"**/bazel-*": true, | ||
".devcontainer/.vscode-server": true | ||
}, | ||
"remote.localPortHost": "allInterfaces", | ||
"search.exclude": { | ||
"**/bazel-*": true, | ||
".devcontainer/.vscode-server": true | ||
}, | ||
"testExplorer.useNativeTesting": true, | ||
"testMate.cpp.test.advancedExecutables": [ | ||
{ | ||
"pattern": "bazel-bin/**/*.runfiles/**/*{test,Test,TEST,tests}", | ||
"cwd": "${absDirpath}", | ||
"executionWrapper": { | ||
"path": "${workspaceFolder}/.vscode/run_unit_test.sh", | ||
"args": [ "${workspaceFolder}", "${cmd}", "${argsFlat}" ] | ||
} | ||
} | ||
], | ||
"testMate.cpp.debug.configTemplate": { | ||
"type": "cppvsdbg", | ||
"linux": { | ||
"type": "cppdbg", "MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
}, | ||
{ | ||
"description": "Set Disassembly Flavor to Intel", | ||
"text": "-gdb-set disassembly-flavor intel", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
"darwin": { "type": "cppdbg", "MIMode": "lldb" }, | ||
"win32": { "type": "cppvsdbg" }, | ||
"program": "${exec}", | ||
"args": "${argsArray}", | ||
"cwd": "${absDirpath}", | ||
"env": "${envObj}", | ||
"environment": "${envObjArray}", | ||
"sourceFileMap": {"/proc/self/cwd" : "${workspaceFolder}"} | ||
}, | ||
"terminal.integrated.defaultProfile.linux": "custom-bash", | ||
// This setting prevents characters in the terminal from getting jumbled when characters are sent too fast | ||
"terminal.integrated.localEchoLatencyThreshold": -1, | ||
"terminal.integrated.profiles.linux": { | ||
"custom-bash": { | ||
"path": "bash", | ||
"args": ["--rcfile", "${workspaceFolder}/.vscode/.bashrc"] | ||
} | ||
}, | ||
"clangd.path": "/usr/bin/clangd", | ||
"clangd.arguments": [//"--log=verbose", // for debugging, disabled for now | ||
// "--pretty", // for debugging, disabled for now | ||
"--background-index", | ||
//"--query-driver=/bin/arm-buildroot-linux-gnueabihf-g++", //for cross compile usage | ||
"--clang-tidy", | ||
"--completion-style=detailed", | ||
"--header-insertion=never", | ||
"--compile-commands-dir=${workspaceFolder}/"] | ||
} | ||
} | ||
} | ||
} |
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.3" | ||
services: | ||
devcontainer: | ||
build: | ||
context: ./../ | ||
dockerfile: ./.devcontainer/${DOCKERFILE_BUILD} | ||
args: | ||
build_apt_deps: ${BUILD_APT_DEPS} | ||
username: ${USER_DOCKER} | ||
uid: ${CURRENT_UID} | ||
ssh_port: ${SSH_PORT} | ||
devices: | ||
- "/dev/bus/usb:/dev/bus/usb" | ||
- "/dev/video*:/dev/video*" | ||
- "/dev:/dev" | ||
ports: | ||
- "9876:9876" | ||
privileged: true | ||
user: ${USER_DOCKER} | ||
volumes: | ||
- ${WORKSPACE}:${WORKSPACE_DOCKER} | ||
- ${NETRC_FILE:-/dev/null}:${NETRC_FILE_DOCKER:-/home/$USER/.netrc-null} | ||
- ${AWS_FILE:-/dev/null}:${AWS_FILE_DOCKER:-/home/$USER/.aws-null} | ||
- ${SSH_FILE:-/dev/null}:${SSH_FILE_DOCKER:-/home/$USER/.ssh/ssh.null} | ||
- ${DOCKER_DIR:-/dev/null}:${DOCKER_DIR_DOCKER:-/home/$USER/.docker-null} | ||
- ${BAZEL_LOCAL_CACHE:-/dev/null}:${BAZEL_LOCAL_CACHE_DOCKER:-/home/$USER/.cache/bazel-null} | ||
- ${HOME}:${HOME} | ||
- ${HOME}/.config:${HOME_DOCKER}/.config | ||
- ${HOME}/.gitconfig:${HOME_DOCKER}/.gitconfig | ||
- ${WORKSPACE}/.devcontainer/.vscode-server:${HOME_DOCKER}/.vscode-server | ||
- ${SSH_AUTH_SOCK:-/dev/null}:${SSH_AUTH_SOCK:-/home/$USER_DOCKER/.ssh-auth-sock-null} | ||
- /tmp/.X11-unix:/tmp/.X11-unix | ||
- ${XAUTHORITY:-~/.Xauthority}:/home/${USER_DOCKER}/.Xauthority | ||
- ${HOME}/.Xauthority:/root/.Xauthority | ||
env_file: .env | ||
environment: | ||
ARCH: ${ARCH:-amd64} | ||
VCS_REF: ${VCS_REF:-dirty} | ||
VCS_SHORT_REF: ${VCS_SHORT_REF:-dirty} | ||
VCS_URL: ${VCS_URL:-dirty} | ||
VCS_DESCRIBE: ${GIT_DESCRIBE:-none} | ||
BUILD_NUMBER: ${BUILD_NUMBER:-non-ci} | ||
BUILD_DATE: ${BUILD_DATE:-non-ci} | ||
BRANCH_NAME: ${BRANCH_NAME:-non-ci} | ||
DOCKER_TAG: ${DOCKER_TAG:-non-ci} | ||
SSH_AUTH_SOCK: ${SSH_AUTH_SOCK} | ||
HOST_SSH_AUTH_SOCK: ${SSH_AUTH_SOCK} | ||
WORKSPACE_DOCKER: ${WORKSPACE_DOCKER} | ||
USER_HOST: ${USER} | ||
USER_DOCKER: ${USER_DOCKER} | ||
DISPLAY: ${DISPLAY} | ||
XAUTHORITY: /home/${USER_DOCKER}/.Xauthority | ||
command: /bin/sh -c "while sleep 1000; do :; done" | ||
working_dir: ${WORKSPACE_DOCKER} | ||
network_mode: host | ||
ipc: host | ||
pid: host |
Oops, something went wrong.