Track Masking & Edge Detection w/ Angle Calcs#32
Conversation
| @@ -0,0 +1,21 @@ | |||
| from autonomous_kart.nodes.opencv_pathfinder import label | |||
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Do you want pytests then? I was planning on adding those in a later push
There was a problem hiding this comment.
Just removing this file is fine, tests are probably out of scope for this PR
ShayManor
left a comment
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Could also be good to put them into a utils.py file
| @@ -0,0 +1,21 @@ | |||
| from autonomous_kart.nodes.opencv_pathfinder import label | |||
| @@ -0,0 +1,21 @@ | |||
| from autonomous_kart.nodes.opencv_pathfinder import label | |||
There was a problem hiding this comment.
Just removing this file is fine, tests are probably out of scope for this PR
| @@ -1,3 +1,7 @@ | |||
| import sys | |||
| import os | |||
| sys.path.insert(0, os.path.dirname(__file__)) | |||
There was a problem hiding this comment.
This is not the ideal way of fixing the import issue. Take a look at pathfinder, it solves the same problem properly.
There was a problem hiding this comment.
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!') |
There was a problem hiding this comment.
This is incorrect and will crash in this case
| def __init__(self, node): | ||
| self.prev_right = None | ||
| self.prev_left = None | ||
| self.logger = node |
There was a problem hiding this comment.
This will crash. Nodes don't have .error or .info. Look into how its done in other nodes
No description provided.