-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
USB camera nodelet, monocular tag detector nodelet, corresponding navigation states #640
Conversation
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.
didn't have time to finish reviewing the whole thing but here are some initial comments for some of it
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.
a few more comments. Still not through the whole thing.
src/perception/tag_detector/long_range_cam/long_range_tag_detector.hpp
Outdated
Show resolved
Hide resolved
src/perception/tag_detector/long_range_cam/long_range_tag_detector.processing.cpp
Outdated
Show resolved
Hide resolved
src/perception/tag_detector/long_range_cam/long_range_tag_detector.processing.cpp
Outdated
Show resolved
Hide resolved
src/perception/tag_detector/long_range_cam/long_range_tag_detector.processing.cpp
Outdated
Show resolved
Hide resolved
src/perception/tag_detector/long_range_cam/long_range_tag_detector.processing.cpp
Outdated
Show resolved
Hide resolved
src/perception/tag_detector/long_range_cam/long_range_tag_detector.processing.cpp
Outdated
Show resolved
Hide resolved
src/perception/tag_detector/long_range_cam/long_range_tag_detector.processing.cpp
Outdated
Show resolved
Hide resolved
src/perception/tag_detector/long_range_cam/long_range_tag_detector.processing.cpp
Outdated
Show resolved
Hide resolved
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.
a few more comments
mImgPub = mNh.advertise<sensor_msgs::Image>("long_range_image", 1); | ||
// While dtor not called | ||
while (ros::ok()) { | ||
cv::VideoCapture mCapture{std::format("v4l2src device=/dev/arducam ! videoconvert ! video/x-raw,width={},height={},format=I420,framerate={}/1 ! appsink", 1920, 1080, 5), cv::CAP_GSTREAMER}; |
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.
port should be a rosparam
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 topic name should also be a rosparam
if (frame.empty()) { | ||
break; | ||
} | ||
cv::imshow("Sender", frame); |
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 add an option to disable this right
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.
i just deleted it lol cuz it'll get published to ros anyway
src/perception/tag_detector/long_range_cam/long_range_tag_detector.hpp
Outdated
Show resolved
Hide resolved
src/perception/tag_detector/long_range_cam/long_range_tag_detector.hpp
Outdated
Show resolved
Hide resolved
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.
few more comments, almost there!
@@ -0,0 +1,86 @@ | |||
#include "long_range_cam.hpp" | |||
#include <opencv2/imgproc.hpp> |
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.
All include should go into the "pch.hpp" file
If you are curious, this is called a pre-compiled header and it speeds up successive compilations.
try { | ||
mGrabThread = std::jthread(&LongRangeCamNodelet::grabUpdate, this); | ||
} catch (std::exception const& e) { | ||
NODELET_FATAL("Exception while starting: %s", e.what()); |
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.
This won't ever get called. Starting a thread always works, and you can't catch exceptions that other threads throw. They have their own stack.
} | ||
|
||
void fillImageMessage(cv::Mat& bgra, sensor_msgs::ImagePtr const& msg) { | ||
assert(msg); |
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.
I would add a couple of asserts. You need to make sure that bgra
is continous (i.e. it is not a slice, bc then you can't just memcpy), and more importantly check the opencv mat type
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.
Also, shouldn't bgra be renamed to bgr?
} | ||
} | ||
|
||
void fillImageMessage(cv::Mat& bgra, sensor_msgs::ImagePtr const& msg) { |
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.
bgra can be ref to const
mCamInfoPub = mNh.advertise<sensor_msgs::CameraInfo>("long_range_cam/camera_info", 1); | ||
mImgPub = mNh.advertise<sensor_msgs::Image>("long_range_image", 1); | ||
// While dtor not called | ||
cv::VideoCapture mCapture{std::format("v4l2src device=/dev/arducam ! videoconvert ! video/x-raw,width={},height={},format=I420,framerate={}/1 ! appsink", 1920, 1080, 5), cv::CAP_GSTREAMER}; |
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.
m
prefix is only used for member variables
while (ros::ok()) { | ||
// while (true) { | ||
mCapture.read(frame); | ||
if (frame.empty()) { |
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 failure condition of cv::VideoCapture
? I feel like this should be an exception if empty
mCamInfoPub = mNh.advertise<sensor_msgs::CameraInfo>("long_range_cam/camera_info", 1); | ||
mImgPub = mNh.advertise<sensor_msgs::Image>("long_range_image", 1); | ||
// While dtor not called | ||
cv::VideoCapture mCapture{std::format("v4l2src device=/dev/arducam ! videoconvert ! video/x-raw,width={},height={},format=I420,framerate={}/1 ! appsink", 1920, 1080, 5), cv::CAP_GSTREAMER}; |
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.
I would make the device file configurable, same with the width and height (use rosparams). That way we can use this node for the other USB cams.
Great job, thank you for getting it working! The processing files look great. However I am a little worried about the duplicate code between long_range_tag_detector.cpp and tag_detector.cpp. They are almost identical. Perhaps after SAR I or y'all can refactor this. |
I think a solution could be making a base class between the long range detector and the zed detector. the |
9f2d260
to
cd237bc
Compare
8e721f6
to
65c9dc9
Compare
Summary
#567, #607
What features did you add, bugs did you fix, etc?
Did you add documentation to the wiki?
No
How was this code tested?
Tested in sim and with the physical long range camera to verify detection distances
Did you test this in sim?
Yes
Did you test this on the rover?
No
Did you add unit tests?
No