-
Notifications
You must be signed in to change notification settings - Fork 3
Simple Distance Target Selection #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
azhangvo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like you didn't actually push the relevant code. You pushed and made a pull request for your onboarding code, not for your new target selection code. Make sure you commit and push the correct code.
azhangvo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments above. also, this code seems to be missing all the relevant build files, like cmakelists.txt and package.xml. Make sure to include these in the new package you create.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should delete this file from this branch, it's not relevant to the merge request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move all this code to a package dedicated specifically to target selection. You should make a new package called target_selection and put this file inside the source folder of that. Refer to onboarding or any other resources you might need (ChatGPT) if needed. Once moved, this folder should be deleted.
|
|
||
| target_pub_ = this->create_publisher<vision_msgs::msg::Detection2D>("/target", 10); | ||
|
|
||
| marker_pub_ = this->create_publisher<visualization_msgs::msg::Marker>("/target_marker", 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this publisher? What is a marker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The target_pub_ publishes the best detection (closest to the center of the image) as a vision_msgs::msg::Detection2D to the /target topic. This allows other nodes in the system (e.g., decision-making, aiming, or tracking nodes) to focus only on that selected target instead of processing all detections. And the marker was for RViz visualization, but I can remove it.
| marker_pub_ = this->create_publisher<visualization_msgs::msg::Marker>("/target_marker", 10); | ||
|
|
||
| // Set your actual camera resolution here (update if different) | ||
| image_width_ = 1280.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make these ros params that default to 1280 and 720
| publish_marker(best_detection); | ||
| } | ||
|
|
||
| void publish_marker(const vision_msgs::msg::Detection2D &detection) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what this code is doing?
… for camera resolution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The files in damian_package still exist. Let's remove these from git. You'll likely have to use git remove, ask ChatGPT if needed. Also, most of the other code looks good. Can you just devise a better test case? As in, publish multiple detections to the detections topic and show that this node actually chooses the best one?
Motivation
This is my first pull request for this repository. The goal of this work was to create the initial version of the Target Selector Node for our RoboMaster CV system. This node will be responsible for selecting the most centered detection (closest to the turret's aim) from an array of detected targets.
Changes
Created a new ROS2 node: target_selector_node.cpp
Subscribed to /detections topic (Detection2DArray input)
Published selected detection to /target (Detection2D output)
Published visualization marker to /target_marker for RViz
Selected "best" target by computing distance from the center of a 1280x720 image
Testing
Successfully built the node using colcon build
Ran the node with ros2 run damian_package target_selector_node
Manually published test detections using:
ros2 topic pub /detections vision_msgs/msg/Detection2DArray ...
Verified:
Node published to /target with expected detection
Console logs showed correct detection coordinates