Skip to content

Commit 227e6be

Browse files
authored
adding setup for dev containers (#1)
1 parent a277d67 commit 227e6be

File tree

20 files changed

+856
-25
lines changed

20 files changed

+856
-25
lines changed

.devcontainer/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
USER=eddy
22
USER_UID=1000
33
USER_GID=1000
4+
ROS_DISTRO=humble

.devcontainer/Dockerfile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
ARG BASE_IMAGE
2-
FROM $BASE_IMAGE
1+
# Multi-version ROS2 development container
2+
ARG ROS_DISTRO=humble
3+
FROM ros:${ROS_DISTRO}-ros-base
34

4-
# Basic build tools
5-
RUN apt update && apt install -y \
6-
build-essential \
7-
cmake \
8-
git \
9-
wget \
10-
lsb-release \
11-
curl \
12-
sudo \
13-
python3-pip \
5+
# Install only essential ROS development tools not in base image
6+
RUN apt-get update && apt-get install -y \
7+
python3-colcon-common-extensions \
8+
python3-rosdep \
149
&& rm -rf /var/lib/apt/lists/*
1510

11+
# Initialize rosdep
12+
RUN rosdep init || true
13+
1614
# Set working dir (matches VSCode workspace)
17-
WORKDIR /workspaces/deep_ros
15+
WORKDIR /deep_ros_ws
1816

1917
# Cater image to user
2018
ARG USERNAME
@@ -34,3 +32,6 @@ RUN source /tmp/.env && rm /tmp/.env \
3432

3533
# Set the default user. Omit if you want to keep the default as root.
3634
USER $USERNAME
35+
36+
# Source ROS in user's bashrc
37+
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USERNAME/.bashrc

.devcontainer/devcontainer.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,25 @@
33
"build": {
44
"dockerfile": "Dockerfile",
55
"args": {
6+
"ROS_DISTRO": "${localEnv:ROS_DISTRO:humble}",
67
"USERNAME": "${localEnv:USER}"
78
}
89
},
10+
"containerEnv": {
11+
"ROS_DISTRO": "${localEnv:ROS_DISTRO:humble}"
12+
},
913
"customizations": {
1014
"vscode": {
1115
"extensions": [
12-
"ms-iot.vscode-ros",
1316
"ms-vscode.cpptools",
1417
"ms-vscode.cmake-tools",
15-
"twxs.cmake",
16-
"ms-azuretools.vscode-docker"
18+
"ms-python.python",
19+
"redhat.vscode-xml"
1720
]
1821
}
1922
},
20-
"workspaceFolder": "/workspaces/deep_ros"
23+
"workspaceFolder": "/deep_ros_ws",
24+
"workspaceMount": "source=${localWorkspaceFolder},target=/deep_ros_ws,type=bind",
25+
"containerName": "deep-ros-devcontainer",
26+
"hostname": "devcontainer"
2127
}

.devcontainer/gen_env.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22

33
set -e
44

5-
BASE_IMAGE="ros:humble"
5+
# Check if ROS_DISTRO was provided as argument
6+
if [ $# -eq 0 ]; then
7+
echo "Usage: $0 <ros_distro>"
8+
exit 1
9+
fi
10+
11+
ROS_DISTRO="$1"
612
ENV_FILE=".devcontainer/.env"
713

814
echo "Generating $ENV_FILE ..."
915
echo "USER=$(whoami)" > "$ENV_FILE"
1016
echo "USER_UID=$(id -u)" >> "$ENV_FILE"
1117
echo "USER_GID=$(id -g)" >> "$ENV_FILE"
12-
echo "BASE_IMAGE=$BASE_IMAGE" >> "$ENV_FILE"
18+
echo "ROS_DISTRO=$ROS_DISTRO" >> "$ENV_FILE"
1319

1420
echo "Done. Contents:"
1521
cat "$ENV_FILE"

.vscode/tasks.json

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,25 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "Generate .env for devcontainer",
5+
"label": "Setup Devcontainer",
66
"type": "shell",
7-
"command": "./.devcontainer/gen_env.sh",
7+
"command": "./.devcontainer/gen_env.sh ${input:rosDistro}",
88
"problemMatcher": [],
9-
"group": {
10-
"kind": "build",
11-
"isDefault": true
12-
}
9+
"group": "build"
10+
}
11+
],
12+
"inputs": [
13+
{
14+
"id": "rosDistro",
15+
"type": "pickString",
16+
"description": "Select ROS2 distribution",
17+
"options": [
18+
"humble",
19+
"iron",
20+
"jazzy",
21+
"rolling"
22+
],
23+
"default": "humble"
1324
}
1425
]
1526
}

DEVELOPING.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Development Guide
2+
3+
## Using Dev Containers
4+
5+
This project includes VS Code dev container configurations for easy ROS2 development across different distributions.
6+
7+
### Prerequisites
8+
9+
- Docker installed and running
10+
- VS Code with the "Dev Containers" extension installed
11+
12+
### Getting Started
13+
14+
1. **Choose ROS distribution**:
15+
- Press `Ctrl+Shift+P` and run "Tasks: Run Task"
16+
- Select "Switch ROS Distro"
17+
- Choose from: `humble`, `iron`, `jazzy`, or `rolling`
18+
19+
2. **Rebuild and open in container**:
20+
- The container will automatically rebuild and reopen with your selected ROS version
21+
22+
### Container Features
23+
24+
- **Workspace**: Your code is mounted at `/deep_ros_ws`
25+
- **ROS sourcing**: ROS is automatically sourced in your shell
26+
- **Build tools**: Includes `colcon` and `rosdep` for ROS development
27+
- **Extensions**: C++, CMake, Python, and XML support pre-installed
28+
29+
### Common Commands
30+
31+
Inside the container:
32+
33+
```bash
34+
# Update rosdep
35+
rosdep update
36+
37+
# Install dependencies
38+
rosdep install --from-paths src --ignore-src -r -y
39+
40+
# Build packages
41+
colcon build
42+
43+
# Source workspace
44+
source install/setup.bash
45+
```
46+
47+
### Troubleshooting
48+
49+
- If the container fails to build, check that Docker is running
50+
- To rebuild from scratch: "Dev Containers: Rebuild Container"

deep_tools/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# (TODO) Deep Tools - ROS CLI for ONNX Model Management
2+
3+
ROS2 CLI tool for ONNX model validation and compatibility checking.
4+
5+
## Commands
6+
7+
```bash
8+
ros2 model check model.onnx # Check compatibility with available ROS nodes
9+
ros2 model validate model.onnx # Validate ONNX structure and integrity
10+
ros2 model info model.onnx # Show model I/O shapes, operations, metadata
11+
ros2 model list-nodes # Show available Deep ROS node types
12+
```
13+
14+
## Design Principles
15+
16+
- **No conversion**: Model conversion is implementation-specific and handled by model_farm
17+
- **Framework-agnostic**: Only works with existing ONNX files
18+
- **Pure inspection**: Validates and analyzes models, doesn't modify them
19+
- **ROS integration**: Follows ROS2 CLI patterns like `ros2 bag`
20+
21+
## Architecture
22+
23+
- Compatibility checking via node specification files
24+
- Generic ONNX validation using onnx library
25+
- Model introspection for I/O analysis
26+
- Integration with Deep ROS node ecosystem

deep_tools/deep_tools/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Deep Tools - ROS CLI for ONNX Model Management
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Compatibility checking verb
2+
# ros2 model check model.onnx
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Model information verb
2+
# ros2 model info model.onnx

0 commit comments

Comments
 (0)