Integrate XYZ coordinates with pathing and add test documentation#11
Open
xingyi1145 wants to merge 10 commits into
Open
Integrate XYZ coordinates with pathing and add test documentation#11xingyi1145 wants to merge 10 commits into
xingyi1145 wants to merge 10 commits into
Conversation
…proach - Brings in ultralytics + depthai into requirements.txt from stereodepth - Drops depthai_detector.py (Pipeline 2.0 class) in favour of existing spatial_detection_node.py / object_tracker_node.py functional approach - Removes tests/unit/test_pipeline_nodes.py Co-authored-by: Yujie Meng <192458226+Yujie-Meng@users.noreply.github.com> Co-authored-by: Yujie Meng <yujiemengca@gmail.com> Co-authored-by: Yujie <yujiemengca@gmail.com>
- Fix dead xout_rgb: switch color_cam.video → preview so bbox coords align - Add rgb_queue read + cv2 bbox overlay and imshow in main loop - Make model_path required in create_spatial_detection_network (no fallback) - Drop blobconverter dep; add opencv-python to requirements-pytorch.txt - Update config.yaml: model_path now required, documents conversion path Co-authored-by: Yujie Meng <192458226+Yujie-Meng@users.noreply.github.com> Co-authored-by: Yujie Meng <yujiemengca@gmail.com> Co-authored-by: Yujie <yujiemengca@gmail.com>
Replace deprecated MonoCamera/ColorCamera with Camera.build(), YoloSpatialDetectionNetwork with SpatialDetectionNetwork.build() using Luxonis model zoo, XLinkOut with createOutputQueue(), and dai.Device with dai.Pipeline context manager. Co-authored-by: Yujie Meng <192458226+Yujie-Meng@users.noreply.github.com> Co-authored-by: Yujie Meng <yujiemengca@gmail.com> Co-authored-by: Yujie <yujiemengca@gmail.com>
Resolves missing-function-docstring warning causing CI exit code 16. Co-authored-by: Yujie Meng <192458226+Yujie-Meng@users.noreply.github.com>
…estimate Co-authored-by: Yujie Meng <192458226+Yujie-Meng@users.noreply.github.com> Co-authored-by: Yujie Meng <yujiemengca@gmail.com> Co-authored-by: Yujie <yujiemengca@gmail.com> Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Replaces the two-bucket constant offset (27/74mm split at 750mm) with a piecewise-linear interpolation over 4 measured anchors (0.5/1.0/1.5/2.0m) that tapers smoothly to zero past 2.2m, where the camera's factory calibration is trusted. The previous scheme over-corrected at 2m, turning a -31mm raw bias into -105mm; the new one avoids this by capturing the genuine non-monotonicity of the bias profile. Residual bias after calibration (vs. raw): | Distance | Raw | Calibrated | |----------|--------|------------| | 0.5m | +27.5 | -0.14 | | 1.0m | +75.1 | +0.12 | | 1.5m | +73.2 | +0.48 | | 2.0m | -48.7 | -3.61 | Also commits the underlying test logs (2026-04-30, 2026-05-07) and the calibration visualization for reproducibility.  Co-authored-by: Yujie Meng <192458226+Yujie-Meng@users.noreply.github.com> Co-authored-by: Yujie Meng <yujiemengca@gmail.com> Co-authored-by: Yujie <yujiemengca@gmail.com>
CI failed black --check on the previous commit (column-aligned tuples and an extra blank line). Reformat to satisfy the checker; no semantic change. Co-authored-by: Yujie Meng <192458226+Yujie-Meng@users.noreply.github.com> Co-authored-by: Yujie Meng <yujiemengca@gmail.com> Co-authored-by: Yujie <yujiemengca@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds a documented, manual SITL-based integration test workflow for validating MAVLink velocity control logic, and introduces helper functions intended to compute and send velocity commands.
Changes:
- Added a new SITL integration testing protocol document under
documentation/tests/unit/. - Added a new MAVLink/SITL simulation script (
tests/test_remote_integration.py) that sends velocity commands based on a simulated target path. - Added velocity calculation + MAVLink command helpers to
main_2025.pyfor reuse.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
tests/test_remote_integration.py |
Adds a manual SITL simulation script for sending MAVLink velocity commands. |
main_2025.py |
Introduces shared velocity-control helper functions intended for the main tracking pipeline. |
documentation/tests/unit/test_remote_integration.md |
Documents how to run the SITL-based integration validation. |
Comments suppressed due to low confidence (2)
main_2025.py:55
send_velocity_commandreferencesmavutilbutmain_2025.pydoes not import it anywhere, so this is a runtimeNameErrorand a pylintundefined-variable. Add the appropriatepymavlinkimport (or move it inside the function) and add required type annotations for flake8-annotations.
def send_velocity_command(master, vx, vy, vz, yaw_rate):
type_mask = 0b010111000111
master.mav.set_position_target_local_ned_send(
0,
master.target_system,
master.target_component,
mavutil.mavlink.MAV_FRAME_BODY_NED,
type_mask,
tests/test_remote_integration.py:17
calculate_velocity_commandstakestarget_y_mbut never uses it, which will raise pylintunused-argument. Use the parameter (e.g., for vertical/altitude control) or rename it to_target_y_m/ remove it from the signature and update callers.
def calculate_velocity_commands(target_x_m, target_y_m, target_z_m):
desired_z = 2.0
desired_x = 0.0
kp_z = 0.5
kp_x = 0.5
error_z = target_z_m - desired_z
error_x = target_x_m - desired_x
vx = max(-2.0, min(2.0, kp_z * error_z))
vy = max(-2.0, min(2.0, kp_x * error_x))
return vx, vy, 0.0, 0.0
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+32
to
+36
| def calculate_velocity_commands(target_x_m, target_y_m, target_z_m): | ||
| desired_z = 2.0 # Stop 2 meters away | ||
| desired_x = 0.0 # Center horizontally | ||
|
|
||
| kp_z = 0.5 |
Comment on lines
+1
to
+6
| import time | ||
| from pymavlink import mavutil | ||
|
|
||
|
|
||
| def calculate_velocity_commands(target_x_m, target_y_m, target_z_m): | ||
| desired_z = 2.0 |
| ``` | ||
| 2. Run the mock integration script: | ||
| ```bash | ||
| python3 test_remote_integration.py |
| @@ -0,0 +1,24 @@ | |||
| # Target Tracking: Integration Testing Protocol | |||
|
|
|||
| This document outlines the two-phase testing protocol for the OAK-D vision-to-MAVLink tracking pipeline. | |||
9dba12f to
a4d5d0e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a two-phase integration testing protocol for the OAK-D vision-to-MAVLink tracking pipeline, along with a new simulation test and reusable velocity control logic. The main changes add a documented testing workflow, a simulation script for validating MAVLink velocity commands, and reusable functions for velocity calculation and command sending.
Integration Testing Protocol and Documentation:
documentation/tests/unit/test_remote_integration.md) outlining the two-phase integration testing protocol, including SITL (Software-In-The-Loop) verification steps, prerequisites, execution instructions, and success criteria for validating the velocity controller and MAVLink command construction.Simulation and Test Code:
tests/test_remote_integration.py) that connects to a virtual drone using MAVLink, simulates a sequence of target detections, and sends velocity commands based on the simulated target’s position. This script helps verify the velocity controller logic and MAVLink integration in a controlled environment.Reusable Velocity Control Functions:
calculate_velocity_commandsandsend_velocity_commandfunctions in bothmain_2025.pyand the test script, encapsulating the proportional control logic and MAVLink command sending for easier reuse and maintainability. [1] [2]