Skip to content

Add PX4 SITL integration wiring, scenario acceptance suite, and CI gate#15

Closed
EdersenC wants to merge 2 commits into
mainfrom
codex/orch-3-agent-05-px4-sitl-integration-and-ci
Closed

Add PX4 SITL integration wiring, scenario acceptance suite, and CI gate#15
EdersenC wants to merge 2 commits into
mainfrom
codex/orch-3-agent-05-px4-sitl-integration-and-ci

Conversation

@EdersenC
Copy link
Copy Markdown
Owner

Summary

  • Implemented PX4 SITL integration wiring, scenario harness tests, and CI gate for M1 acceptance behaviors.

What changed

  • Added a contract-oriented integration composition module that binds vehicle/runtime/CLI factories with import-flexible fallbacks.
  • Added a PX4 SITL runner script supporting smoke mode, runtime probing, timeout controls, and deterministic result/log artifacts.
  • Added automated SITL scenario tests covering nominal mission completion and four failsafe paths (geofence, link loss, low battery, operator abort).
  • Added CI workflow to enforce the SITL acceptance gate and publish JUnit plus SITL artifact outputs.

Verification

  • pytest -q tests/sitl: failed - Local runner missing pytest executable.
  • bash scripts/sitl/run_px4_sitl.sh --smoke: passed - Smoke harness completes and writes SITL result/log artifacts.
  • pytest -q: failed - Local runner missing pytest executable.
  • bash -n scripts/sitl/run_px4_sitl.sh: passed - Shell syntax check passed.
  • python3 AST parse check for new Python files: passed - All newly added Python files parse successfully.

Risk / follow-up

  • Current scenario tests are contract-level deterministic traces; live PX4 SITL mission execution depends on providing a real PX4 command/environment in CI or runtime.
  • Wire real adapter/runtime factories from sibling agents once their modules land, then run the same scenario suite against live PX4 SITL execution.
  • Add CI path that sets PX4_SITL_CMD for full simulator boot/run once PX4 environment is available.
  • Contract deviation: Assigned repository did not contain the expected pre-existing drone_toolkit/sitl tree; implementation was created from scratch in owned paths.
  • Contract deviation: Local environment lacked pytest, so required pytest validation commands could not run locally.
  • New interface: SITLScenarioResultV1 data contract with stable keys for CI parsing.
  • New interface: PX4SITLScenarioHarnessV1 workflow surface for scenario run/assert/artifact lifecycle.
  • New interface: build_integration composition function as single wiring boundary for adapter/runtime/CLI.

Review focus

  • Integration boundary API stability in build_integration and harness result schema compatibility for CI parsers.
  • SITL script run-mode behavior and failure signaling when PX4 runtime is unavailable.
  • Scenario assertion coverage for required M1 terminal states and failsafe event taxonomy.

Diff summary

  • Type: implementation
  • Base: main
  • Head: codex/orch-3-agent-05-px4-sitl-integration-and-ci
  • Files changed: 8
.github/workflows/sitl.yml                  |  47 ++++++
scripts/sitl/run_px4_sitl.sh                | 111 ++++++++++++++
src/drone_toolkit/app/integration_wiring.py | 229 ++++++++++++++++++++++++++++
tests/sitl/test_failsafe_geofence_breach.py |  29 ++++
tests/sitl/test_failsafe_link_loss.py       |  22 +++
tests/sitl/test_failsafe_low_battery.py     |  22 +++
tests/sitl/test_nominal_waypoint_mission.py |  28 ++++
tests/sitl/test_operator_abort.py           |  22 +++
8 files changed, 510 insertions(+)
  • added .github/workflows/sitl.yml (+47/-0)
  • added scripts/sitl/run_px4_sitl.sh (+111/-0)
  • added src/drone_toolkit/app/integration_wiring.py (+229/-0)
  • added tests/sitl/test_failsafe_geofence_breach.py (+29/-0)
  • added tests/sitl/test_failsafe_link_loss.py (+22/-0)
  • added tests/sitl/test_failsafe_low_battery.py (+22/-0)
  • added tests/sitl/test_nominal_waypoint_mission.py (+28/-0)
  • added tests/sitl/test_operator_abort.py (+22/-0)

Impact graph

flowchart TD
  PR[PR changes]
  PR --> R0[.github]
  R0 --> F1[.github/workflows/sitl.yml]
  PR --> R2[scripts]
  R2 --> F3[scripts/sitl/run_px4_sitl.sh]
  PR --> R4[src]
  R4 --> F5[src/drone_toolkit/app/integration_wiring.py]
  PR --> R6[tests]
  R6 --> F7[tests/sitl/test_failsafe_geofence_breach.py]
  R6 --> F8[tests/sitl/test_failsafe_link_loss.py]
  R6 --> F9[tests/sitl/test_failsafe_low_battery.py]
  R6 --> F10[tests/sitl/test_nominal_waypoint_mission.py]
  R6 --> F11[tests/sitl/test_operator_abort.py]
Loading

Comparison

No baseline comparison data provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new PX4 SITL integration surface, deterministic SITL scenario tests, a runner script, and a GitHub Actions gate for SITL artifacts and test execution.

Changes:

  • Added integration wiring and a scenario harness/result contract under drone_toolkit.app.
  • Added a PX4 SITL shell runner with smoke/run modes and artifact output.
  • Added SITL scenario tests and a CI workflow to run smoke plus pytest scenarios.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
.github/workflows/sitl.yml Adds the PX4 SITL Gate workflow.
scripts/sitl/run_px4_sitl.sh Adds SITL smoke/run script and artifact generation.
src/drone_toolkit/app/integration_wiring.py Adds integration bundle construction and SITL scenario harness/result schema.
tests/sitl/test_failsafe_geofence_breach.py Adds deterministic geofence failsafe scenario test.
tests/sitl/test_failsafe_link_loss.py Adds deterministic link-loss failsafe scenario test.
tests/sitl/test_failsafe_low_battery.py Adds deterministic low-battery failsafe scenario test.
tests/sitl/test_nominal_waypoint_mission.py Adds deterministic nominal waypoint scenario test.
tests/sitl/test_operator_abort.py Adds deterministic operator-abort scenario test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +56 to +61
try:
resolved = _import_symbol(candidate)
if callable(resolved):
return resolved(**constructor_kwargs)
return resolved
except Exception as err: # pragma: no cover - compatibility shim
Comment on lines +113 to +117
try:
cli = cli_factory(runtime=mission_runtime, vehicle_port=vehicle_port, **cli_cfg)
except Exception:
# CLI may be optional for scenario-only execution.
cli = None
Comment on lines +151 to +154
integration_factory: Callable[..., IntegrationBundle] = build_integration,
) -> None:
self.artifact_dir = Path(artifact_dir)
self.integration_factory = integration_factory
Comment on lines +181 to +183
raw_events = list(runtime_event_sequence or [])
failsafe_events = [_event_to_dict(event) for event in raw_events]
observed_event_kinds = {_extract_event_kind(event) for event in failsafe_events}
Comment on lines +209 to +210
trace_path = self.artifact_dir / f"{scenario_id}.trace.json"
trace_path.write_text(json.dumps(trace, indent=2, sort_keys=True), encoding="utf-8")
Comment on lines +223 to +225
result_path = self.artifact_dir / f"{scenario_id}.result.json"
result_path.write_text(
json.dumps(asdict(result), indent=2, sort_keys=True),
import importlib
import json
from pathlib import Path
from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple
Comment on lines +33 to +43
--scenario)
SCENARIO_ID="$2"
shift 2
;;
--artifacts-dir)
ARTIFACTS_DIR="$2"
shift 2
;;
--timeout)
TIMEOUT_SECONDS="$2"
shift 2
;;
esac
done

Comment thread scripts/sitl/run_px4_sitl.sh Outdated
Comment on lines +64 to +73
cat > "${RESULT_JSON}" <<EOF
{
"scenario_id": "${SCENARIO_ID}",
"mode": "${MODE}",
"status": "${status}",
"details": "${details}",
"log_path": "${RUN_LOG}"
}
EOF
}
@EdersenC EdersenC closed this May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants