Skip to content
Merged
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
4 changes: 0 additions & 4 deletions .devcontainer/.env

This file was deleted.

50 changes: 46 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
# Multi-version ROS2 development container
# Multi-stage ROS2 development container (CPU/GPU compatible)
ARG ROS_DISTRO=humble
FROM ros:${ROS_DISTRO}-ros-base
ARG CUDA_VERSION=12.4.0
ARG UBUNTU_VERSION=22.04

# ===============================================
# CPU Base - Standard ROS2 image
# ===============================================
FROM ros:${ROS_DISTRO}-ros-base as cpu-base

# ===============================================
# GPU Base - CUDA with manual ROS2 install
# ===============================================
FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION} as gpu-base
ARG ROS_DISTRO

# Install ROS2 manually since we're not using the ros: base image
# Set non-interactive to avoid geographic area prompts
ENV DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
gnupg2 \
lsb-release \
tzdata \
&& ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo "$UBUNTU_CODENAME") main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null \
&& apt-get update && apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-ros-base \
&& rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=interactive

# ===============================================
# Install Common Development Tools from Either Base
# ===============================================
FROM ${TARGETARCH:-cpu}-base as dev-tools

# Install development tools not in base image
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-pip \
python3-colcon-common-extensions \
python3-rosdep \
openssh-client \
git \
curl \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -21,17 +57,23 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
rm -rf /var/lib/apt/lists/*

# Install Claude Code CLI via npm
RUN npm install -g @anthropic-ai/claude-code@1.0.0
# hadolint ignore=DL3016
RUN npm install -g @anthropic-ai/claude-code

# Initialize rosdep
RUN rosdep init || true

# Set working dir (matches VSCode workspace)
WORKDIR /deep_ros_ws

# Cater image to user
# ===============================================
# Add User Configuration
# ===============================================
FROM dev-tools as user-conf
ARG USERNAME
ARG ROS_DISTRO

# Cater image to user
SHELL ["/bin/bash", "-c"]
COPY .env /tmp/.env
# hadolint ignore=SC2086
Expand Down
34 changes: 0 additions & 34 deletions .devcontainer/devcontainer.json

This file was deleted.

36 changes: 0 additions & 36 deletions .devcontainer/gen_env.sh

This file was deleted.

102 changes: 102 additions & 0 deletions .devcontainer/generate_devcontainer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/bin/bash

# Copyright (c) 2025-present WATonomous. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# generate_devcontainer.sh
# Usage:
# ./generate_devcontainer.sh <ros_distro> <container_type> [cuda_version] [ubuntu_version]

set -e

ROS_DISTRO=${1:-humble}
CONTAINER_TYPE=${2:-cpu}
CUDA_VERSION=${3:-12.4.0}
UBUNTU_VERSION=${4:-22.04}
USERNAME=${USER:-vscode}

echo "Generating devcontainer configuration..."
echo "ROS Distribution: $ROS_DISTRO"
echo "Container Type: $CONTAINER_TYPE"

if [ "$CONTAINER_TYPE" = "gpu" ]; then
echo "CUDA Version: $CUDA_VERSION"
echo "Ubuntu Version: $UBUNTU_VERSION"
fi

# Generate container name and build args based on type
if [ "$CONTAINER_TYPE" = "gpu" ]; then
CONTAINER_NAME="ROS2 Development Container (GPU)"
BUILD_ARGS='"ROS_DISTRO": "'$ROS_DISTRO'",
"USERNAME": "'$USERNAME'",
"TARGETARCH": "gpu",
"CUDA_VERSION": "'$CUDA_VERSION'",
"UBUNTU_VERSION": "'$UBUNTU_VERSION'",
"USER_UID": "'$(id -u)'",
"USER_GID": "'$(id -g)'"'
RUN_ARGS='"--network=host",
"--gpus=all"'
else
CONTAINER_NAME="ROS2 Development Container (CPU)"
BUILD_ARGS='"ROS_DISTRO": "'$ROS_DISTRO'",
"USERNAME": "'$USERNAME'",
"TARGETARCH": "cpu",
"USER_UID": "'$(id -u)'",
"USER_GID": "'$(id -g)'"'
RUN_ARGS='"--network=host"'
fi

# Generate the devcontainer.json with shared structure
cat > .devcontainer/devcontainer.json << EOF
{
"name": "$CONTAINER_NAME",
"build": {
"dockerfile": "Dockerfile",
"args": {
$BUILD_ARGS
}
},
"runArgs": [
$RUN_ARGS
],
"mounts": [
"source=\${localWorkspaceFolder},target=/deep_ros_ws,type=bind,consistency=cached"
],
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-python.python",
"ms-vscode.cmake-tools",
"redhat.vscode-yaml",
"ms-iot.vscode-ros"
],
"settings": {
"python.defaultInterpreterPath": "/usr/bin/python3",
"terminal.integrated.shell.linux": "/bin/bash"
}
}
},
"remoteUser": "$USERNAME"
}
EOF

echo "Devcontainer configuration generated successfully!"
echo "Files created:"
echo " - .devcontainer/devcontainer.json"
echo ""
echo "Environment variables set for this session"
echo ""
echo "You can now:"
echo " 1. Open the command palette (Ctrl+Shift+P)"
echo " 2. Run 'Dev Containers: Rebuild and Reopen in Container'"
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
.claude/
# ROS2 build artifacts
build/
install/
log/

# Autogenerated devcontainer files
.devcontainer/devcontainer.json
.devcontainer/.env

# Claude helpers
.claude/
CLAUDE.md
30 changes: 30 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"configurations": [
{
"name": "ROS2 Humble",
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/onnx_example_node/include/**",
"${workspaceFolder}/onnx_example_node/third_party/onnxruntime-linux-x64-1.16.3/include/**",
"${workspaceFolder}/deep_core/include/**",
"${workspaceFolder}/deep_backends/**/include/**",
"/opt/ros/humble/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "c99",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64",
"browse": {
"path": [
"${workspaceFolder}",
"/opt/ros/humble/include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db"
}
}
],
"version": 4
}
84 changes: 84 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"C_Cpp.default.compileCommands": "${workspaceFolder}/build/compile_commands.json",
"C_Cpp.intelliSenseEngine": "default",
"C_Cpp.errorSquiggles": "enabled",
"C_Cpp.autocomplete": "default",
"files.associations": {
"*.hpp": "cpp",
"*.h": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"array": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
},
"cmake.configureOnOpen": false,
"cmake.buildDirectory": "${workspaceFolder}/build",
"ros.distro": "humble"
}
Loading
Loading