Skip to content

Commit c89ca9f

Browse files
authored
Add VSCode dev container configuration and enhance Docker setup for development (#1)
* Add soccer strategy components and team communication package - Implement unit tests for role auction logic in `test_role_auction.cpp`. - Define behavior trees for goalie, striker, and supporter roles in XML format. - Create a new package `soccer_teamcomm` for decentralized team communication. - Implement `teamcomm_node.py` to publish team data including self pose and role bids. - Add scripts for sim training, including domain randomization and residual policy training. - Introduce tools for camera calibration and mock game controller for testing. * Add VSCode dev container configuration and enhance Docker setup for development
1 parent c8cc01c commit c89ca9f

157 files changed

Lines changed: 6876 additions & 287 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/README.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# VSCode Dev Container Setup
2+
3+
This directory configures VSCode to develop inside a container with the full ROS 2 Jazzy + build toolchain pre-installed.
4+
5+
## Quick Start
6+
7+
### Option 1: VSCode Dev Container (Recommended)
8+
9+
1. Install the **Dev Containers** extension in VSCode (ms-vscode-remote.remote-containers)
10+
2. Open this repo in VSCode
11+
3. Click the green `><` icon in the bottom-left → **Reopen in Container**
12+
4. VSCode opens the folder **inside** the container automatically
13+
14+
Then in the integrated terminal:
15+
16+
```bash
17+
cd ros2_ws
18+
colcon build --symlink-install
19+
source install/setup.bash
20+
ros2 launch soccer_bringup robot.launch.py sim:=true
21+
```
22+
23+
**Benefits:**
24+
25+
- Full ROS 2 environment without local install
26+
- All extensions (CMake, C++, Python, ROS) work inside the container
27+
- Code editing on Windows; compilation/execution in Linux
28+
- One-click setup for new team members
29+
30+
### Option 2: Compose CLI (Lightweight)
31+
32+
```bash
33+
# Start an interactive dev shell
34+
docker compose -f deploy/compose/sim.compose.yaml run dev bash
35+
36+
# Inside the container:
37+
cd ros2_ws
38+
colcon build --symlink-install
39+
source install/setup.bash
40+
41+
# Run tests, launch nodes, etc.
42+
ros2 launch soccer_bringup robot.launch.py sim:=true
43+
```
44+
45+
## What's Pre-installed
46+
47+
- ROS 2 Jazzy + `ros2_control` framework
48+
- C++ build tools (CMake, GCC, Clang)
49+
- Python 3.12 + NumPy, OpenCV, ruff
50+
- BehaviorTree.CPP
51+
- Git
52+
53+
## File Syncing
54+
55+
The container mounts your Windows repo as a volume (`-v ../..:/ws`). Any edits on Windows are **instantly visible** inside the container — no manual sync needed.
56+
57+
```
58+
Windows (C:\dev\soccer-software)
59+
↓ (Docker volume mount)
60+
Linux container (/ws)
61+
```
62+
63+
## Persistent Build Cache
64+
65+
The `.devcontainer/devcontainer.json` runs `colcon build --symlink-install` on container creation. Subsequent edits trigger incremental builds — not full rebuilds.
66+
67+
## Requirements
68+
69+
- **Docker Desktop for Windows** with WSL2 backend
70+
- **VSCode** + **Dev Containers extension** (for Option 1)
71+
72+
## Troubleshooting
73+
74+
**Container won't start:**
75+
76+
```bash
77+
# Check Docker is running
78+
docker ps
79+
80+
# Rebuild from scratch
81+
docker compose -f deploy/compose/sim.compose.yaml build --no-cache dev
82+
```
83+
84+
**ROS 2 commands not found:**
85+
86+
```bash
87+
# Re-source the setup scripts in your shell
88+
source /opt/ros/jazzy/setup.bash
89+
source ~/ws/install/setup.bash
90+
```
91+
92+
**Volume mount not updating:**
93+
94+
```bash
95+
# Restart the container
96+
docker compose -f deploy/compose/sim.compose.yaml restart dev
97+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"features": {
3+
"ghcr.io/devcontainers/features/git:1": {
4+
"version": "1.3.5",
5+
"resolved": "ghcr.io/devcontainers/features/git@sha256:27905dc196c01f77d6ba8709cb82eeaf330b3b108772e2f02d1cd0d826de1251",
6+
"integrity": "sha256:27905dc196c01f77d6ba8709cb82eeaf330b3b108772e2f02d1cd0d826de1251"
7+
}
8+
}
9+
}

.devcontainer/devcontainer.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "soccer-dev",
3+
"build": {
4+
"dockerfile": "../deploy/docker/Dockerfile.dev",
5+
"context": ".."
6+
},
7+
"workspaceFolder": "/ws",
8+
"mounts": [
9+
"source=${localWorkspaceFolder},target=/ws,type=bind,consistency=cached"
10+
],
11+
"remoteEnv": {
12+
"ROS_DOMAIN_ID": "42"
13+
},
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"ms-vscode.cmake-tools",
18+
"ms-vscode.cpptools-extension-pack",
19+
"ms-vscode.cpptools",
20+
"ms-python.python",
21+
"ms-python.vscode-pylance",
22+
"ms-ros.ros",
23+
"dotjoshjohnson.xml",
24+
"ms-vscode-remote.remote-containers"
25+
],
26+
"settings": {
27+
"python.defaultInterpreterPath": "/usr/bin/python3",
28+
"cmake.cmakePath": "/usr/bin/cmake",
29+
"[python]": {
30+
"editor.formatOnSave": true,
31+
"editor.defaultFormatter": "ms-python.python"
32+
}
33+
}
34+
}
35+
},
36+
"postCreateCommand": "bash -c 'source /opt/ros/jazzy/setup.bash && cd ros2_ws && colcon build --symlink-install'",
37+
"postStartCommand": "bash -c 'source /opt/ros/jazzy/setup.bash && if [ -f /ws/ros2_ws/install/setup.bash ]; then source /ws/ros2_ws/install/setup.bash; fi'",
38+
"features": {
39+
"ghcr.io/devcontainers/features/git:1": {}
40+
}
41+
}

.dockerignore

Lines changed: 0 additions & 10 deletions
This file was deleted.

.gitattributes

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Large binary assets tracked with Git LFS so the robot runtime clone stays lean.
2+
# (See blueprint §11 — heavy Isaac Lab assets and CAD use LFS.)
3+
sim/assets/**/*.usd filter=lfs diff=lfs merge=lfs -text
4+
sim/assets/**/*.usdc filter=lfs diff=lfs merge=lfs -text
5+
hardware/**/*.step filter=lfs diff=lfs merge=lfs -text
6+
hardware/**/*.stp filter=lfs diff=lfs merge=lfs -text
7+
hardware/**/*.f3d filter=lfs diff=lfs merge=lfs -text
8+
hardware/**/*.kicad_pcb filter=lfs diff=lfs merge=lfs -text
9+
**/*.onnx filter=lfs diff=lfs merge=lfs -text
10+
**/*.engine filter=lfs diff=lfs merge=lfs -text
11+
12+
# Normalize line endings for source.
13+
*.py text eol=lf
14+
*.cpp text eol=lf
15+
*.hpp text eol=lf
16+
*.c text eol=lf
17+
*.h text eol=lf
18+
*.sh text eol=lf

.github/workflows/ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: ci
2+
3+
# Git holds the recipe; the registry holds the baked cake (blueprint §12).
4+
# This pipeline builds + lints + tests the ROS 2 workspace and publishes a
5+
# lean multi-arch runtime image that robots pull via Ansible.
6+
7+
on:
8+
push:
9+
branches: [main]
10+
pull_request:
11+
branches: [main]
12+
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
jobs:
18+
# ── 1. Build + test the ROS 2 workspace ──
19+
ros2-build-test:
20+
runs-on: ubuntu-24.04
21+
container: ros:jazzy-ros-base
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Install dependencies (rosdep)
26+
run: |
27+
apt-get update
28+
rosdep update
29+
rosdep install --from-paths ros2_ws/src --ignore-src -r -y
30+
31+
- name: colcon build
32+
working-directory: ros2_ws
33+
run: |
34+
. /opt/ros/jazzy/setup.sh
35+
colcon build --symlink-install --event-handlers console_direct+
36+
37+
- name: colcon test
38+
working-directory: ros2_ws
39+
run: |
40+
. /opt/ros/jazzy/setup.sh
41+
. install/setup.sh
42+
colcon test --event-handlers console_direct+
43+
colcon test-result --verbose
44+
45+
# ── 2. Python lint (perception / localization / tooling) ──
46+
python-lint:
47+
runs-on: ubuntu-24.04
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: actions/setup-python@v5
51+
with:
52+
python-version: "3.12"
53+
- run: pip install ruff
54+
- run: ruff check ros2_ws/src sim tools
55+
56+
# ── 3. Firmware build (host unit tests of the 1 kHz control math) ──
57+
firmware-build:
58+
runs-on: ubuntu-24.04
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Build host-side firmware unit tests
62+
working-directory: firmware/motor_controller
63+
run: |
64+
cmake -S . -B build -DBUILD_HOST_TESTS=ON
65+
cmake --build build
66+
ctest --test-dir build --output-on-failure
67+
68+
# ── 4. Build + push lean arm64 runtime image (only on main) ──
69+
docker-image:
70+
needs: [ros2-build-test, python-lint, firmware-build]
71+
if: github.ref == 'refs/heads/main'
72+
runs-on: ubuntu-24.04
73+
steps:
74+
- uses: actions/checkout@v4
75+
- uses: docker/setup-qemu-action@v3
76+
- uses: docker/setup-buildx-action@v3
77+
- name: Log in to GitHub Container Registry
78+
uses: docker/login-action@v3
79+
with:
80+
registry: ghcr.io
81+
username: ${{ github.actor }}
82+
password: ${{ secrets.GITHUB_TOKEN }}
83+
- name: Build + push runtime image (arm64 for Jetson)
84+
uses: docker/build-push-action@v6
85+
with:
86+
context: .
87+
file: deploy/docker/Dockerfile.runtime
88+
platforms: linux/arm64
89+
push: true
90+
tags: ghcr.io/${{ github.repository }}/minibot-runtime:${{ github.sha }}

.gitignore

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,50 @@
1-
build/
2-
install/
3-
log/
4-
# Python
1+
# ── ROS 2 / colcon ──
2+
ros2_ws/build/
3+
ros2_ws/install/
4+
ros2_ws/log/
5+
*.colcon
6+
7+
# ── Python ──
58
__pycache__/
6-
*.pyc
9+
*.py[cod]
10+
*.egg-info/
11+
.eggs/
12+
.venv/
13+
venv/
714
.pytest_cache/
8-
# C++ / build
15+
.mypy_cache/
16+
.ruff_cache/
17+
18+
# ── C/C++ / firmware ──
19+
build/
20+
Debug/
21+
Release/
922
*.o
10-
*.so
11-
# Editor / OS
23+
*.d
24+
*.su
25+
*.elf
26+
*.bin
27+
*.hex
28+
*.map
29+
30+
# ── ML / sim artifacts ──
31+
sim/runs/
32+
sim/logs/
33+
*.onnx
34+
*.engine
35+
*.pt
36+
*.ckpt
37+
38+
# ── DevOps / secrets ──
39+
*.env
40+
.env
41+
!*.env.example
42+
deploy/ansible/inventory.local.ini
43+
44+
# ── Editors / OS ──
1245
.vscode/
1346
.idea/
14-
*.swp
1547
.DS_Store
16-
# ROS
17-
*.bag
48+
*.swp
49+
50+
# ── Git LFS-tracked large binaries are NOT ignored; see .gitattributes ──

Dockerfile

Lines changed: 0 additions & 6 deletions
This file was deleted.

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2026, The RoboCup Humanoid Team
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)