Skip to content

Reworked and Stable Sonar Object/Wall Detection#109

Open
AnthonZh wants to merge 79 commits intomainfrom
sonar-processing
Open

Reworked and Stable Sonar Object/Wall Detection#109
AnthonZh wants to merge 79 commits intomainfrom
sonar-processing

Conversation

@AnthonZh
Copy link
Copy Markdown

@AnthonZh AnthonZh commented Dec 6, 2025

Summary

  • Added sonar_object_detection.py for a pipeline to process raw sonar scans, segment them, and retrieve normal angles and poses
    • Primarily use the Fourier Transform to denoise images
    • Segments the image and throws out segments that don't meet certain criteria
    • Uses orthogonal regression to retrieve the normal angle
  • Updated and cleaned the sonar.py file to move utility methods to the appropriate file
    • Moved most calculation methods over to the utility file
  • Add a raw image publisher to that both the raw sonar scan and the processed sonar scan are viewable in foxglove
  • Update dockerfile to install scikit-image

Testing

  • Tested with empty data and previously collected data
  • Tested on land

AnthonZh and others added 24 commits October 24, 2025 00:10
…data. Docker-build.sh changed because of issues with personal computer.
Added Sonar Denoiser Class which can process sonar sweeps. Added a publisher to allow viewing data and testing if the processing is actually working
… with the sonar device to sonar_utils.py (#97)

- Skipping checks because this is just to merge two of my branches together so that I can work out of one.
…ressed_img, code in task_planning is from Pranav Bijith - add rotate_to_normal and rotate_to_angle_from_normal
…onstant_sweep method align with the new sonar pipeline
@nathanaelren
Copy link
Copy Markdown
Contributor

Converting to draft as has not been pool-tested yet.

@nathanaelren nathanaelren marked this pull request as draft December 7, 2025 18:31
@AnthonZh AnthonZh marked this pull request as ready for review April 2, 2026 23:35
@AnthonZh AnthonZh requested a review from nathanaelren April 2, 2026 23:35
@AnthonZh
Copy link
Copy Markdown
Author

AnthonZh commented Apr 2, 2026

I reopened the PR after thorough testing in the pool.

Copy link
Copy Markdown
Contributor

@nathanaelren nathanaelren left a comment

Choose a reason for hiding this comment

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

i'll let @ChuChuCodes0414 fully review this (I'm in Greece) but took a quick look since my flight is delayed, two quick comments, thanks for all the great work Anthony! This is awesome

Comment thread onboard/src/controls/config/oogway.yaml
Comment thread onboard/src/sonar/README.md
Copy link
Copy Markdown
Contributor

@ChuChuCodes0414 ChuChuCodes0414 left a comment

Choose a reason for hiding this comment

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

In general good PR. Some changes to be made.

I will take a closer look when these are reviewed along with Nathanael's comments. Thank you!

Comment thread onboard/src/sonar/sonar/sonar.py Outdated
Comment thread onboard/src/sonar/sonar/sonar_object_detection.py Outdated
Comment thread onboard/src/task_planning/task_planning/tasks/prequal_tasks.py Outdated
Comment thread dvl_timestamps.txt Outdated
ChuChuCodes0414
ChuChuCodes0414 previously approved these changes Apr 9, 2026
Copy link
Copy Markdown
Contributor

@ChuChuCodes0414 ChuChuCodes0414 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

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

This PR refactors the sonar pipeline to provide more stable object/wall detection, adds a new denoising/segmentation module, and exposes additional visualization/telemetry to ROS topics for easier debugging in Foxglove.

Changes:

  • Added a new sonar denoising + segmentation pipeline (sonar_object_detection.py) and updated sonar processing/utilities to support it.
  • Updated the sonar ROS node to publish both “raw” and processed scans and to return/publish a wall angle.
  • Updated task-planning to add rotate-to-normal behaviors driven by sonar results, and updated the Docker image to install scikit-image.

Reviewed changes

Copilot reviewed 12 out of 30 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
onboard/src/task_planning/task_planning/tasks/sonar_tasks.py Adds sonar-driven rotation tasks and helpers for extracting/normalizing the sonar normal angle.
onboard/src/task_planning/task_planning/task.py Updates Task awaiting behavior to handle rclpy Futures (currently breaks future result propagation).
onboard/src/task_planning/task_planning/robot/oogway.py Adjusts competition task list / parameters and adds a sonar rotation task entry point.
onboard/src/task_planning/task_planning/interface/cv.py Minor whitespace cleanup.
onboard/src/sonar/sonar/sonar_utils.py Moves sonar math/image conversion helpers into utilities (includes a critical negate math bug).
onboard/src/sonar/sonar/sonar_object_detection.py New FFT denoising + segmentation + orthogonal regression utilities.
onboard/src/sonar/sonar/sonar_image_processing.py Updates image building normalization and adds a GMM clustering helper.
onboard/src/sonar/sonar/sonar.py Reworks sonar node processing pipeline, publishes raw image + wall angle, and extends service response fields (currently contains a syntax error and a segmentation instantiation mismatch).
onboard/src/sonar/README.md Documents package structure and new topics (one message type mismatch).
onboard/src/sonar/sweep_data/data.jpeg Adds sample sonar scan data asset.
onboard/src/sonar/sweep_data/newdata.jpeg Adds sample sonar scan data asset.
docker/Dockerfile Installs scikit-image to support the new pipeline.
core/src/custom_msgs/srv/SonarSweepRequest.srv Adds angle_of_wall to service response.
core/src/custom_msgs/msg/SonarSweepResponse.msg Adds angle_of_wall field and normalizes formatting.

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

Comment thread onboard/src/sonar/sonar/sonar_utils.py Outdated
Comment thread onboard/src/sonar/sonar/sonar_object_detection.py Outdated
Comment thread onboard/src/sonar/sonar/sonar_object_detection.py Outdated
Comment thread onboard/src/sonar/sonar/sonar_object_detection.py Outdated
Comment thread onboard/src/sonar/sonar/sonar_image_processing.py Outdated
Comment thread onboard/src/task_planning/task_planning/tasks/sonar_tasks.py Outdated
Comment thread onboard/src/task_planning/task_planning/tasks/sonar_tasks.py Outdated
Comment thread onboard/src/sonar/sonar/sonar.py
Comment thread onboard/src/sonar/sonar/sonar_object_detection.py Outdated
Comment thread onboard/src/task_planning/task_planning/tasks/sonar_tasks.py Outdated
AnthonZh and others added 7 commits April 16, 2026 17:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@AnthonZh
Copy link
Copy Markdown
Author

Pool tested on 4/18, sonar works (IMU issue?)

Copy link
Copy Markdown
Contributor

@ChuChuCodes0414 ChuChuCodes0414 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sonar Object / Wall Detection

7 participants