Skip to content

Soft Rewrite - #18

Draft
Cowboylaserkittenjetshark wants to merge 7 commits into
mainfrom
post-comp-2026/bad-decisions
Draft

Soft Rewrite#18
Cowboylaserkittenjetshark wants to merge 7 commits into
mainfrom
post-comp-2026/bad-decisions

Conversation

@Cowboylaserkittenjetshark

@Cowboylaserkittenjetshark Cowboylaserkittenjetshark commented Jul 25, 2026

Copy link
Copy Markdown
Member

Soft rewrite with the goal of removing cruft and reorganizing. This will strictly reach parity with what we currently have, there will be no new features as part of this PR.

Todo

  • main
  • comms module
    • Split control board comms into external lib
    • MEB
      • SWIX has no formal MEB at the moment, so no applicable comms
  • config module
  • vision module
    • Removing this for now because SWIX currently has no bottom cam and front cam is handled externally.
    • Gstreamer is evil
  • ros (reimplement with zenoh @SarangaR)
  • missions
    • Relevant missions will be ported
    • Bottom camera
  • Integrate ultralytics-inference

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR performs a large-scale “soft rewrite” that trims legacy subsystems (vision, ROS/docker tooling, prior mission framework, and comms) and replaces them with a smaller CLI-driven skeleton using tracing/color-eyre, Nix flake tooling, and a simplified configuration model.

Changes:

  • Introduces a new CLI entrypoint (clap) plus a new logging module (tracing, console-subscriber, color-eyre) and a minimal mission runner stub.
  • Replaces the prior multi-module config/missions/vision/comms surface with a simplified config schema and removes many legacy mission/vision/comms/video/docker files.
  • Overhauls Nix + dev tooling (flake-parts + rust-flake modules, devshell, pre-commit, CI workflows, direnv/justfile).

Reviewed changes

Copilot reviewed 130 out of 147 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vision/yolo_model.rs Removed legacy YOLO adapter code.
src/vision/slalom.rs Removed legacy OpenCV slalom detector.
src/vision/slalom_yolo.rs Removed legacy slalom YOLO model wrapper.
src/vision/octagon.rs Removed legacy OpenCV octagon detector.
src/vision/models/dummy_model.onnx Binary model file referenced by legacy vision (change/removal implied by PR).
src/vision/gate.rs Removed legacy YOLO-based gate detector.
src/vision/gate_poles.rs Removed legacy YOLO-based gate poles detector.
src/vision/gate_cv.rs Removed legacy OpenCV gate detector.
src/vision/bin.rs Removed legacy YOLO-based bin detector.
src/video_source/mod.rs Removed legacy MatSource abstractions.
src/video_source/appsink.rs Removed legacy GStreamer/OpenCV camera pipeline implementation.
src/missions/spin.rs Removed legacy procedural spin mission.
src/missions/sonar.rs Removed legacy sonar mission + logging.
src/missions/slalom.rs Removed legacy slalom mission implementation.
src/missions/reset_torpedo.rs Removed legacy torpedo reset action.
src/missions/path_align.rs Removed legacy path-align missions.
src/missions/octagon.rs Removed legacy octagon mission + tests/resources usage.
src/missions/meb.rs Removed legacy “wait for arm” MEB action.
src/missions/fire_torpedo.rs Removed legacy torpedo firing actions.
src/missions/example.rs Removed legacy action-system examples/tests.
src/missions/comms.rs Removed legacy mission comms helper actions.
src/missions/coinflip.rs Removed legacy coinflip mission.
src/missions/bin.rs Removed legacy bin mission.
src/missions/basic.rs Removed legacy basic action helpers (delay, descend, etc.).
src/missions/action_context.rs Removed legacy action context traits and implementations.
src/missions/mod.rs Replaced mission module exports with a stub run_mission entrypoint.
src/logging.rs Added centralized logging/error setup (color-eyre + tracing + console layer).
src/lib.rs Reduced crate surface to cli, config, logging, missions.
src/config/spin.rs Removed legacy spin mission config.
src/config/sonar.rs Removed legacy sonar config.
src/config/slalom.rs Removed legacy slalom config.
src/config/path_align.rs Removed legacy path-align config.
src/config/octagon.rs Removed legacy octagon config.
src/config/mod.rs Replaced prior full config schema with minimal vehicle definition-based config + helpers.
src/config/gate.rs Removed legacy gate config.
src/config/coinflip.rs Removed legacy coinflip config.
src/config/bin.rs Removed legacy bin config.
src/comms/zed_ros2.rs Removed legacy ROS2 ZED comms client.
src/comms/mod.rs Removed legacy comms module root.
src/comms/meb/response.rs Removed legacy MEB response parsing/status handling.
src/comms/meb/mod.rs Removed legacy MEB comms implementation.
src/comms/control_board/vehicle_definition.rs Removed legacy local vehicle definition tooling.
src/comms/control_board/util.rs Removed legacy control board utilities/types.
src/comms/control_board/response.rs Removed legacy control board response parsing.
src/comms/auv_control_board/util.rs Removed legacy AUV control board protocol utilities.
src/comms/auv_control_board/response.rs Removed legacy AUV control board protocol parsing/logging.
src/comms/auv_control_board/mod.rs Removed legacy AUV control board protocol implementation.
src/cli.rs Added CLI argument parsing types and subcommands (run, cfg check, cfg generate).
rust-toolchain.toml Added stable toolchain pin.
README.md Removed minimal README.
nix/modules/rust.nix Added rust-flake Nix module wiring.
nix/modules/pre-commit.nix Added Nix-managed pre-commit hooks (nixpkgs-fmt, rustfmt).
nix/modules/devshell.nix Added devshell composition (rust shell + pre-commit + tools).
night_config.toml Removed legacy example config file.
justfile Added just recipes for running and pre-commit.
flake.nix Reworked flake to flake-parts + rust-flake + git-hooks + module imports.
flake.lock Updated lockfile to new flake inputs (crane, rust-overlay, etc.).
Dockerfile Removed legacy Dockerfile.
docker/zed-entrypoint.sh Removed ZED docker entrypoint.
docker/yolo-ros/yolo_ros/yolo_ros/tracking_node.py Removed vendored yolo_ros tracking node.
docker/yolo-ros/yolo_ros/yolo_ros/init.py yolo_ros Python package file (change/removal implied by PR).
docker/yolo-ros/yolo_ros/test/test_pep257.py Removed Python linter tests.
docker/yolo-ros/yolo_ros/test/test_flake8.py Removed Python linter tests.
docker/yolo-ros/yolo_ros/test/test_copyright.py Removed Python linter tests.
docker/yolo-ros/yolo_ros/setup.py Removed yolo_ros packaging metadata.
docker/yolo-ros/yolo_ros/setup.cfg Removed yolo_ros packaging config.
docker/yolo-ros/yolo_ros/resource/yolo_ros Removed ROS resource marker file.
docker/yolo-ros/yolo_ros/package.xml Removed yolo_ros ROS package manifest.
docker/yolo-ros/yolo_msgs/srv/SetClasses.srv Removed ROS service definition.
docker/yolo-ros/yolo_msgs/package.xml Removed ROS message package manifest.
docker/yolo-ros/yolo_msgs/msg/Vector2.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/msg/Pose2D.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/msg/Point2D.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/msg/Mask.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/msg/KeyPoint3DArray.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/msg/KeyPoint3D.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/msg/KeyPoint2DArray.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/msg/KeyPoint2D.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/msg/DetectionArray.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/msg/Detection.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/msg/BoundingBox3D.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/msg/BoundingBox2D.msg Removed ROS message definition.
docker/yolo-ros/yolo_msgs/CMakeLists.txt Removed ROS msg package build script.
docker/yolo-ros/yolo_bringup/package.xml Removed ROS bringup manifest.
docker/yolo-ros/yolo_bringup/launch/yolov9.launch.py Removed YOLO bringup launch file.
docker/yolo-ros/yolo_bringup/launch/yolov8.launch.py Removed YOLO bringup launch file.
docker/yolo-ros/yolo_bringup/launch/yolov5.launch.py Removed YOLO bringup launch file.
docker/yolo-ros/yolo_bringup/launch/yolov26.launch.py Removed YOLO bringup launch file.
docker/yolo-ros/yolo_bringup/launch/yolov12.launch.py Removed YOLO bringup launch file.
docker/yolo-ros/yolo_bringup/launch/yolov11.launch.py Removed YOLO bringup launch file.
docker/yolo-ros/yolo_bringup/launch/yolov10.launch.py Removed YOLO bringup launch file.
docker/yolo-ros/yolo_bringup/launch/yoloe.launch.py Removed YOLO bringup launch file.
docker/yolo-ros/yolo_bringup/launch/yolo.launch.py Removed YOLO bringup launch file.
docker/yolo-ros/yolo_bringup/launch/yolo-world.launch.py Removed YOLO bringup launch file.
docker/yolo-ros/yolo_bringup/CMakeLists.txt Removed ROS bringup build script.
docker/yolo-ros/requirements.txt Removed Python requirements pinning.
docker/yolo-ros/Dockerfile.ARM Removed ARM Docker build.
docker/yolo-ros/Dockerfile Removed Docker build.
docker/yolo-ros/CITATION.cff Removed citation metadata.
docker/yolo-entrypoint.sh Removed YOLO entrypoint script.
docker/run.sh Removed docker compose runner.
docker/fastdds_no_shm.xml Removed DDS config.
docker/Dockerfile.ZED Removed ZED Dockerfile.
docker/docker-compose.yml Removed docker compose orchestration.
docker/depthai-entrypoint.sh Removed depthai entrypoint.
console/2026-04-13_20:42:47.txt Removed committed runtime console logs.
console/2026-04-13_20:40:51.txt Removed committed runtime console logs.
console/2026-04-13_20:38:12.txt Removed committed runtime console logs.
console/2026-04-13_20:36:12.txt Removed committed runtime console logs.
Cargo.toml Simplified crate manifest + updated dependencies + removed feature matrix.
.vscode/settings.json Added VS Code workspace settings.
.vscode/extensions.json Added VS Code extension recommendations.
.gitignore Updated ignore patterns (target/result/direnv, etc.).
.github/workflows/update-flake.yml Added scheduled flake.lock update automation.
.github/workflows/ci-nix.yml Added Nix-based CI workflow using omnix.
.gitattributes Marked flake.lock as linguist-generated.
.envrc Added direnv flake integration and watch_file list.
.cargo/config.toml Enabled tokio_unstable cfg via rustflags.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/config/mod.rs
Comment on lines +39 to 42
pub fn new(path: &Path) -> Result<Self> {
let text = std::fs::read_to_string(path).wrap_err("Failed to open config.toml")?;
toml::from_str(&text).wrap_err("Failed to parse config.toml")
}
Comment thread src/config/mod.rs
Comment on lines 27 to 33
#[derive(Debug, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Config {
/// The path to the control board serial port
pub control_board_path: String,
/// The backup path to the control board serial port
pub control_board_backup_path: String,
/// The path to the main electronics board serial port
pub meb_path: String,
/// The path to the front camera video device
pub front_cam_path: String,
/// The path to the bottom camera video device
pub bottom_cam_path: String,
/// The active color profile used for vision. Must be in `color_profiles`
pub color_profile: String,
/// The available color profiles usable for vision
pub color_profiles: HashMap<String, ColorProfile>,
/// The [`Side`] the shark prop is on
pub shark: Side,
/// The [`Side`] the saw fish prop is on
pub saw_fish: Side,
/// BlueRobotics Ping360 sonar config submodule
pub sonar: sonar::Config,
/// Missions config submodule
pub missions: Missions,
/// ZED ROS2 subsystem config submodule
pub zed_ros2: ZedRos2Config,
vehicle: Definition<8>,
}

impl Config {
Comment thread src/missions/mod.rs
Comment on lines +8 to +15
pub async fn run_mission(name: &str, shutdown_token: CancellationToken) -> Result<()> {
let mission = match name {
"gate" => sleep(Duration::from_secs(5)),
_ => {
error!("Unknown mission: {name}");
bail!("Unknown mission: {name}")
}
};
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