We are asked: "Design a reproducible hardware-in-the-loop CI system for robotics: virtualization strategy, telemetry capture, failure triage, and scheduling." It's a design question, likely expecting a detailed plan describing an architecture and components. We need to cover virtualization strategy (how to simulate or use real hardware), telemetry capture (logging and monitoring), failure triage (how to handle failures, categorize, and notify), and scheduling (how to manage multiple test jobs). Should produce a reproducible system (so that tests can be run identically multiple times). It's for robotics, so involves hardware-in-the-loop (HIL) testing, which means testing software (like control algorithms) with real hardware or simulated hardware. But we need to design a CI system. So think of a pipeline: code commit, trigger tests, allocate resources, run tests, capture data, analyze, report. The system must be reproducible, meaning tests can be repeated with the same conditions. Virtualization strategy: perhaps use virtualization of hardware via simulators or use real hardware with standardized test benches. Use containerization (Docker) for software components, but hardware is tricky: either use real hardware (robots) or simulated hardware (Gazebo, etc.). Possibly use a hybrid: for CI, mostly use simulation to get quick feedback, but also run on real hardware occasionally (like nightly). Telemetry capture: capture logs, video, sensor data, maybe using ROS topics, etc. Need to store data for analysis and reproducibility. Failure triage: categorize failures (simulation crash, test assertion failure, hardware failure) and assign to appropriate teams. Might use automated analysis to detect flaky tests. Scheduling: need to schedule jobs on limited hardware resources, prioritize, manage queuing, handle dependencies. Could use a CI system like Jenkins, GitLab CI, or custom. But design includes specifics: maybe an orchestrator that can schedule on a pool of machines (both simulated and real). The system should be scalable.
We must produce a coherent answer. Probably the user expects a system design document style. We'll produce a detailed response with sections: Overview, Virtualization Strategy, Telemetry Capture, Failure Triage, Scheduling, and maybe Implementation considerations. Use bullet points and diagrams? Could describe components: CI server, test executor, simulation environment, real robot farm, telemetry DB, analysis engine, notification system. Emphasize reproducibility: use versioned simulation environments, containerized software, deterministic seeds, fixed initial conditions. For virtualization: we could use Docker for ROS nodes, and for the robot simulation, we could use Gazebo with fixed world and models; maybe use Vagrant/VirtualBox for full system. Or use a cloud-based approach: spin up VMs with GPU for simulation? But for robotics, simulation may be CPU heavy.
Also consider hardware-in-the-loop: may involve actual hardware controllers (like motor drivers) interfaced with simulation? Actually HIL typically means the software under test interacts with a simulated environment but through real hardware interfaces (like a real motor controller connected to a simulated plant). Or it could be full real robot with sensors and actuators in a controlled environment. But for CI, we likely use simulation for speed. But the title says "hardware-in-the-loop CI system", so we need to incorporate real hardware. So we need to design a system that runs tests that involve both hardware and software. Could be like: the CI job runs on a machine that controls a test robot (maybe a small robot like a Turtlebot) in a lab. The test environment is reproducible: same starting pose, same obstacles, same initial battery level, etc. We need to handle the fact that hardware can be flaky, so we need to detect failures and maybe retry. Also need to telemetry capture: video, sensor data, logs.
We'll structure:
-
Introduction: Goal: ensure robotics software changes are validated via automated tests that involve both simulation and real hardware in a reproducible manner.
-
System Architecture:
- CI server (e.g., Jenkins/GitLab) that detects commits, triggers pipelines.
- Job Scheduler: manages allocation of test resources (simulation nodes, robot stations).
- Test Executors: run on worker nodes; could be physical robot stations or virtual simulation environments.
- Artifact Storage: stores logs, data, videos, results.
- Telemetry Database: for querying test results and metrics.
- Notification/Triage Service.
-
Virtualization Strategy:
- Goal: Provide controlled, reproducible environment for the software under test.
- For pure software (ROS nodes, algorithms): use Docker containers to isolate dependencies. Base images versioned, with ROS distro, etc.
- For robot simulation: use Gazebo (or similar) with deterministic physics (fixed time step, same random seeds). Use containerized Gazebo? Possibly using Docker with --privileged, or better use a VM (KVM) to isolate GPU? Actually Gazebo can run in Docker with proper setup. However, for reproducible, we need same versions of URDF, world files, models. So store all assets in repo or versioned storage.
- For hardware-in-the-loop: we can have physical robot stations that are identical. Each station comprises a robot (e.g., a standard test robot), a charging dock, a controlled environment (closed room with markers), and a host PC. The host PC runs Docker containers for the software under test, and interfaces with robot via standard ROS interfaces. To ensure reproducibility, we maintain each robot's firmware version constant, and calibrate sensors regularly. The environment is controlled: same starting pose, obstacles placed at fixed positions using markers, battery level above threshold. The host PC image is kept consistent via configuration management (Ansible) and uses versioned container images.
- For scalability: use a mix: most PRs run only simulation (fast), while merges to main run on hardware (nightly). Or schedule hardware tests based on queue.
- Virtualization of hardware: We might also use hardware simulators (e.g., dSPACE, NI VeriStand) to emulate sensors/actuators in real-time. But that's more for embedded ECU HIL. For robotics, we could use a real-time simulator that runs the robot dynamics and interacts with real controllers. But maybe too complex. We'll assume we have a limited number of physical test benches.
-
Telemetry Capture:
- Capture multiple sources:
- ROS bag files: record all topics at sufficient frequency.
- Videos: from robot's camera(s) and possibly overhead camera.
We'll now produce a concise but thorough answer. The user likely expects a design document. We'll structure with headings. Might also mention specific tools: Docker, ROS, Gazebo, Jenkins, Kubernetes, S3, InfluxDB, Slack. But keep general.
Also consider that virtualization strategy may include using digital twins? Possibly but stick to typical.
We'll produce answer with bullet points and paragraphs.
Let's start:
We'll also include a diagram description? Could but text is fine.
Let's craft the final answer.
Overview
The goal is to design a reproducible hardware‑in‑the‑loop (HIL) continuous integration (CI) system for robotics software. The system must automatically build, deploy, and test code changes in environments that range from pure software simulation to real‑hardware test benches. Key pillars are:
- Virtualization strategy – isolate and control both software and hardware environments.
- Telemetry capture – collect exhaustive logs, sensor data, and video for every run.
- Failure triage – automatically classify, report, and manage test failures.
- Scheduling – allocate scarce hardware resources efficiently while providing fast feedback.
The design is modular, so each piece can be upgraded independently.
1. System Architecture
┌────────────┐ ┌───────────────┐ ┌──────────────┐
│ Git Repo │ │ CI Server │ │ Scheduler │
│ (code+cfg) │──▶│ (Jenkins/CI) │──▶│ (Resource │
└────────────┘ └───────────────┘ │ Manager) │
└──────┬───────┘
│
┌─────────────────────────▼──────────────────────────┐
│ Test Execution Cluster │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Simulation │ │ Simulation │ │ Robot Bench │ │
│ │ Node (Docker)│ │ Node (Docker)│ │ (Docker) │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────┬──────────────────────────┘
│
┌────────────────────────▼─────────────────────┐
│ Telemetry & Artifact Store │
│ (S3 / NFS + Metadata DB) │
└─────────────────────┬───────────────────────┘
│
┌─────────────────────▼───────────────────────┐
│ Triage & Notification Service │
└─────────────────────────────────────────────┘
2. Virtualization Strategy
2.1 Software‑Only Components (Containers)
- All user code (ROS nodes, perception pipelines, control algorithms) runs inside Docker containers built from a version‑controlled Dockerfile.
- Base images pin the OS, ROS distribution, and third‑party libraries.
- Each container has a fixed environment: same compiler flags, same library versions → reproducibility.
2.2 Simulation Environment
- Use Gazebo (or a similar physics simulator) wrapped in a Docker container.
- Determinism: fixed physics time step, deterministic random seed (recorded), identical world/URDF/Mesh assets (all versioned in the repo or via a hash‑referenced artifact store).
- The simulation node runs alongside the software container on the same Docker network; they communicate via ROS topics/services.
- For heavy simulations (e.g., large maps, many sensors) allocate dedicated VM/KVM instances with pass‑through GPU if needed. All VM images are immutable and versioned.
2.3 Physical Test Benches (Hardware‑In‑the‑Loop)
- Standardized robot platforms (e.g., TurtleBot3, custom platforms) are kept identical: same motors, sensors, firmware versions.
- Each bench consists of:
- The physical robot in a controlled environment (e.g., a lab with fiducial markers, known obstacle layout).
- A host PC that runs Docker containers (same as simulation). It connects to the robot via USB/ethernet/ROS serial.
- Peripheral sensors (e.g., Vicon motion capture, depth cameras) are mounted fixedly and calibrated offline.
- Before every test, an automated calibration routine:
- Checks sensor health (battery, IMU bias, camera resolution).
- Places the robot at a known start pose using a mechanical jig or magnetic docking.
- Resets the environment to a pristine state (e.g., obstacles positioned by a 3‑D‑printed guide).
- All firmware and host‑PC OS images are managed by Ansible/Puppet and rolled back/forward atomically to guarantee consistency.
2.4 Hybrid Pipeline
- Pull request (PR) builds → only simulation (fast, parallel, no hardware).
- Merges to
main → schedule hardware tests (nightly or as capacity allows).
- Optional canary: after a PR passes simulation, it is promoted to a “hardware‑candidate” queue; if a hardware slot is free, it runs immediately; otherwise it waits for off‑peak.
3. Telemetry Capture
Every test run generates a set of immutable artifacts:
| Source | Capture Method | Storage |
|---|
| ROS Messages | rosbag record – all topics (configurable) | S3 (bucket per run) |
| Video | H.264 streams from robot/overhead cameras | S3 + thumbnail generated |
| System logs | Docker stdout/stderr, dmesg, syslog | Text files in S3 |
| Hardware sensors | Direct acquisition via ROS or serial drivers | ROS bag or CSV |
| Test metadata | JSON file (git SHA, docker image IDs, seed, bench ID, start/stop times, test script) | S3 + Metadata DB |
| Performance metrics | CPU/Memory/Network usage (cAdvisor, node‑exporter) | InfluxDB/Prometheus |
Process:
- The test executor (a small script inside the container) sets up logging: starts
rosbag, video capture, etc.
- On completion (normal or failure) it stops all recorders, compresses the data (tarball), and uploads to central artifact storage (S3 or a replicated NFS). Upload is done with checksum verification.
- The metadata DB (PostgreSQL) stores a row per run with SHA, branch, test outcome, and pointers to the artifact location.
- A background job indexes logs for quick search and generates a human‑readable report (HTML) summarising the run.
4. Failure Triage
4.1 Automated Classification
After a run finishes, the CI server triggers the triage service which:
-
Parses logs for known error patterns:
- Infrastructure: worker node offline, Docker daemon error, ROS master not reachable, robot communication timeout.
- Simulation crash: Gazebo segmentation fault, physics explosion (NaN values), out‑of‑memory.
- Test assertion: custom test script exit code ≠ 0, goal not reached, metric out of tolerance.
- Flaky indicator: test fails but subsequent retry succeeds.
-
Assigns a label (infrastructure, simulation, test, flaky) and determines owner:
- Infrastructure → platform/devops team.
- Simulation → simulation team (if model issue).
- Test → code owner of the failing test.
-
Retry logic:
- For infrastructure or flaky, automatically re‑queue the same commit on a different bench (or a second time on the same bench) once. If it passes, mark as “flaky‑recovered”; if it fails again, keep original classification.
4.2 Integration with Issue Trackers
- For PRs: post a comment with the label, a link to the full report, and a snippet of the failure.
- For
main failures: automatically create a JIRA/GitHub issue with severity (e.g., P1 for test failure on final hardware) and assign to the responsible team.
- All classifications are stored in the metadata DB for later trend analysis.
4.3 Dashboard & Accountability
- Grafana dashboards display:
- Pass/fail rates over time (by test suite, by bench).
- Flakiness percentage.
- Mean Time To Repair (MTTR) per category.
- Resource utilisation (hardware bench idle time).
- Teams can drill down to individual runs and view telemetry (video, bag playback) directly from the UI.
5. Scheduling
A dedicated Scheduler (could be implemented with Jenkins agents, Kubernetes, or a custom broker) manages resource allocation.
5.1 Resource Model
- Resource Types:
SIM: CPU‑only simulator node (Docker host).
SIM_GPU: GPU‑accelerated simulator.
ROBOT_BENCH: physical test bench (identified by bench_id).
- Each job declares required resources (e.g., 1×SIM, 1×ROBOT_BENCH{A,B}) and an estimated runtime (from historical data).
5.2 Queuing & Prioritisation
- Priority classes:
PR_SIM: high priority, pre‑emptible, uses only SIM resources.
MERGE_HARDWARE: medium, reserved for main/release branches, requires a ROBOT_BENCH.
NIGHTLY: low priority, runs only during off‑peak hours (e.g., 01:00‑06:00).
- The scheduler maintains separate queues per priority. Higher‑priority jobs pre‑empt lower‑priority ones if a required resource becomes free (pre‑emption happens only for simulation; hardware pre‑emption is avoided due to test disruption).
5.3 Reservation & Timeouts
- When a robot bench is allocated, the job receives an exclusive lock.
- Watchdog: monitors heartbeats; if the test exceeds its predicted runtime + safety margin (e.g., +20%), it is killed and the bench released. This prevents hung tests from blocking the bench indefinitely.
- Maximum hold time: even a running job can be pre‑empted after a hard deadline (e.g., 2 h) to keep bench utilisation reasonable.
5.4 Fairness & Utilisation
- Quotas: each team gets a share of robot bench time per week (configurable). The scheduler tracks usage and can throttle submissions when quotas are exceeded.
- Batching: multiple independent tests can be packed on the same bench sequentially in one reservation (a “suite”), reducing setup overhead (e.g., calibration once for a suite).
- Dynamic scaling: simulation nodes can be auto‑scaled in the cloud (Kubernetes). Robot benches are fixed.
6. Ensuring Reproducibility
-
Versioned everything:
- Code + test definitions + CI config (
Jenkinsfile, gitlab-ci.yml) reside in the same repo.
- All external models (URDF, world files, meshes) are stored in a versioned artifact store with immutable references (content‑addressed).
- Docker images are built with
--build-arg that includes the git SHA and tagged with both latest and the SHA. Images never get overwritten; they are pushed to a registry.
-
Deterministic seeds:
- A fresh random seed is generated per run (recorded) and passed to all stochastic components (Gazebo noise, perception algorithms). For PR builds, the seed is fixed (e.g.,
0) to compare against baseline; for hardware runs, the seed is random but recorded.
-
Hardware state capture:
- Before each test, the calibration routine records the actual start pose (via motion capture) and stores it. Any deviation beyond tolerance aborts the run and flags infrastructure.
-
Full snapshot:
- The metadata DB entry includes hashes of:
- Code commit (git SHA).
- Docker image IDs (host, simulation, software).
- Gazebo world/model versions.
- Firmware version on the robot.
- Host OS image (cloud-init config hash).
- This snapshot allows anyone to reconstruct the exact environment (by pulling the same images, checking out the SHA, and using the same calibration data).
-
Auditable artifacts:
- All telemetry (bags, video) are retained for a configurable period (e.g., 30 days). They are accessible via a web UI and can be downloaded for offline replay.
7. Implementation Sketch
- CI Server: GitLab CI or Jenkins, triggered by webhook on push/PR. The pipeline definition is a YAML file in the repo.
- Scheduler: For simulation nodes, a Kubernetes cluster with pod‑based workers; for robot benches, a stand‑alone agent that registers itself as a resource to the CI server (e.g., Jenkins “label”
bench-01). The CI server’s built‑in queue works, or a custom broker using RabbitMQ + worker service.
- Docker Images: Multi‑stage Dockerfile installs ROS, test frameworks (rostest, gtest), and the
rosbag tools. The test executor entrypoint runs rostest and handles telemetry.
- Telemetry Storage: MinIO/S3 for binaries; PostgreSQL for metadata; Prometheus for metrics; Grafana for dashboards.
- Triage Service: Python/Go microservice that consumes the metadata DB, runs pattern matching, and posts to Slack/GitHub. It also schedules retries via the CI API.
- Safety: All robot benches are behind a network firewall; only the CI orchestrator can issue move commands. An e‑stop button is hard‑wired to cut power; the host PC monitors a heartbeat and will safely halt the robot if the test process dies.
8. Example CI Flow (Pull Request)
- Developer pushes commit → CI server detects change.
- Pipeline step
build → compile code, create Docker image, push to registry.
- Pipeline step
simulation → scheduler assigns a free SIM node.
- Node pulls the image, starts container with Gazebo and the test suite.
- All telemetry captured and uploaded.
- Triage service runs: if any test fails, classify as
test or flaky (retry once).
- If simulation passes, pipeline posts green check on PR.
- On merge to
main, a separate hardware pipeline is triggered:
- Scheduler waits for a free
ROBOT_BENCH (respecting off‑peak policy).
- Same Docker image is deployed on the bench host.
- Calibration routine runs; if successful, test suite runs.
- Upload telemetry, triage, and report outcome.
- If hardware fails, create issue and block further merges until resolved.
9. Benefits & Trade‑offs
- Reproducibility: thanks to containers, versioned assets, and deterministic seeds, any failure can be reproduced exactly.
- Fast feedback: PRs get simulation results in minutes; hardware feedback within a few hours.
- Resource efficiency: simulation scales horizontally; hardware usage is maximised by smart queuing and batching.
- Maintainability: clear separation of concerns; each component can be replaced (e.g., swap Gazebo for Isaac Sim) without affecting others.
- Challenges:
- Hardware flakiness requires robust retry and quarantine mechanisms.
- Calibration and environment control need periodic manual oversight.
- Initial setup cost (robot benches, network isolation) is non‑trivial.
10. Conclusion
This design provides a complete, end‑to‑end CI system for robotics that integrates both virtual and physical testing. By combining containerization, deterministic simulation, comprehensive telemetry, automated triage, and careful scheduling, the system ensures that every code change is validated in a repeatable manner while making the best use of expensive hardware resources. The modular nature allows teams to adopt the parts that fit their current setup and evolve incrementally toward full HIL automation.