Skip to content

Track Masking & Edge Detection w/ Angle Calcs#32

Open
DanielProano wants to merge 24 commits intomainfrom
dproano/masking
Open

Track Masking & Edge Detection w/ Angle Calcs#32
DanielProano wants to merge 24 commits intomainfrom
dproano/masking

Conversation

@DanielProano
Copy link
Copy Markdown

No description provided.

@DanielProano DanielProano requested a review from ShayManor March 20, 2026 03:08
Comment thread src/autonomous_kart/autonomous_kart/nodes/opencv_pathfinder/convert.sh Outdated
Comment thread src/autonomous_kart/autonomous_kart/nodes/opencv_pathfinder/label.py Outdated
Comment thread src/autonomous_kart/autonomous_kart/nodes/opencv_pathfinder/label.py Outdated
Comment thread src/autonomous_kart/autonomous_kart/nodes/opencv_pathfinder/label.py Outdated
Comment thread src/autonomous_kart/autonomous_kart/nodes/opencv_pathfinder/profiler.py Outdated
Comment thread src/autonomous_kart/test/test_label.py Outdated
@@ -0,0 +1,21 @@
from autonomous_kart.nodes.opencv_pathfinder import label
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When writing tests, ROS2 standards suggest using pytest and having a test suite. Great to write tests, but need them properly or it's not useful. Also, if images are used, they should be pushed (and put into LFS if > 1mb).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment as above.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Do you want pytests then? I was planning on adding those in a later push

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just removing this file is fine, tests are probably out of scope for this PR

Copy link
Copy Markdown
Contributor

@ShayManor ShayManor left a comment

Choose a reason for hiding this comment

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

This PR crashes the kart stack. I recommend running the devcontainer to see what the issue is.

[opencv_pathfinder_node-5]     from autonomous_kart.autonomous_kart.nodes.opencv_pathfinder.angle import AngleFinder
[opencv_pathfinder_node-5] ModuleNotFoundError: No module named 'autonomous_kart.autonomous_kart'


# @param: Photo matrix
# @ret: HSV representation
def get_hsv(self, img: np.ndarray):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These helper functions don't need self and be moved out of the AngleFinder class?

I would also rename the get_* functions something more like convert_bgr_to_hsv and convert_bgr_to_greyscale.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could also be good to put them into a utils.py file

Comment thread src/autonomous_kart/test/test_label.py Outdated
@@ -0,0 +1,21 @@
from autonomous_kart.nodes.opencv_pathfinder import label
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment as above.

Comment thread src/autonomous_kart/autonomous_kart/nodes/opencv_pathfinder/angle.py Outdated
Comment thread src/autonomous_kart/test/test_label.py Outdated
@@ -0,0 +1,21 @@
from autonomous_kart.nodes.opencv_pathfinder import label
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just removing this file is fine, tests are probably out of scope for this PR

Comment thread src/autonomous_kart/autonomous_kart/nodes/opencv_pathfinder/angle.py Outdated
Comment thread src/autonomous_kart/autonomous_kart/nodes/opencv_pathfinder/angle.py Outdated
@@ -1,3 +1,7 @@
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not the ideal way of fixing the import issue. Take a look at pathfinder, it solves the same problem properly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The issue with this is that it causes issues with colcon and ament. They move the files and expect a certain form, so this could cause unexpected errors later

# @ret Masked image mage or None
def get_img_mask(self, img: np.ndarray, debug=False, percent=0.0, pixel_range=3, pic_offset=5):
if img is None:
self.error.logger('Error opening image!')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is incorrect and will crash in this case

def __init__(self, node):
self.prev_right = None
self.prev_left = None
self.logger = node
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will crash. Nodes don't have .error or .info. Look into how its done in other nodes

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.

3 participants