-
Notifications
You must be signed in to change notification settings - Fork 734
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
image_proc for ros2 #369
image_proc for ros2 #369
Conversation
find_package(OpenCV REQUIRED) | ||
find_package(Boost REQUIRED COMPONENTS thread) | ||
find_package(image_geometry REQUIRED) | ||
|
||
if(cv_bridge_VERSION VERSION_GREATER "1.12.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.
This should be unnecessary now, since we are already setting standard to 14
const image_geometry::PinholeCameraModel& model, | ||
ImageSet& output, int flags = ALL) const; | ||
}; | ||
// Processing state (note: only safe because we're using single-threaded NodeHandle!) |
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 don't believe the single-threaded assumption holds anymore, this may need to be protected via mutex.
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.
these code is just same as ros branch did, so i am not change it in ros2 version.
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.
Sorry, to be clear, this was previously using single threaded NodeHandle's in the ROS1/Nodelet paradigm. Because this is now inheriting from an rclcpp::Node, we can't make the same guarantees about this only executing in a single-threaded context (people could add the Node to a multi-threaded executor). Since that assumption no longer holds, I believe that we need to add some locking here to guarantee safety.
@mjcarroll already create a new commit for your suggestions, thanks :) |
@ahuizxc I had some issues getting your fork of image_proc working. First it only starts the first node. Second it can't be shutdown using ctrl+c. I'm suspecting some lock/thread/callback issue, but I'm really just a C++ beginner so. However I rewrote some of it to use the Ros2 built-in namespacing instead of a custom namespace argument which I think makes more sense. Allthough, perhaps removing the parameter service is a bad idea, but I can't really judge that. this seems to work now: just start it using: would love to understand what the benefits of the parameter/callback approach ? :) feel free to provide some feedback on my branch as well. If you want to I can create an additional PR to better and easier be able to compare. |
I also ported image_view for ros2, I think we should see what advice is given in the community and then focus on the details, thanks :) |
Yes great job! However I don't really understand how it relates to this PR (except for it being in the same image_pipeline package) ? Since this is open source, my definition of community is whoever might be using the package and feel that they want to contribute to it, but perhaps you have a more narrow definition of it? :) Also you already got a couple of comments from mjcarrol who is one of the owners which should qualify as "advice is given in the community". I think not doing it the ROS2 way merits an explanation. But as I said before, I'm just a C++ novice, so I could very well be missing a very obvious reason for it, should be easy enough to just point it out to me. Many thanks for putting in the hard work of contributing this, I made good use of it after my minor changes. |
@ahuizxc See the file May I suggest to keep the same folder structure and file name while port code. It would be helpful for other package porting on ROS2 without interface changes. And also be easy for code review. |
Hi @JWhitleyAStuff @ahuizxc has ported image_proc and image_view from ROS1 to ROS2. This PR is for image_proc and #374 is for image_view. These patches are waiting for review, hope someone could give some comments, and then approve and merge. We took effort on image_pipeline ROS2 porting, here is the status with Todo list. most of the modules ready and waiting for maintainer's review, not sure if you would please help to review the PRs, we'll update the patch if need any changes. |
We should be able to continue to release for ros2, and I plan on doing it for @yechun1 and his team have done a great job contributing here, I just haven't had the bandwidth to keep up with reviews. @JWhitleyAStuff if you and your team have some spare cycles, getting these things reviewed and in would be awesome! |
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 my comments. Also, why are a bunch of files/nodes missing from this PR like rectify, advertisement_checker, processor, crop_decimate, and crop_non_zero?
endif() | ||
install(TARGETS | ||
image_proc | ||
DESTINATION lib/${PROJECT_NAME}) |
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.
In ROS1, this would have been installed under lib/ but the convention for ROS2 seems to be bin/ for executables and lib/ only for libraries.
@@ -31,47 +31,43 @@ | |||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||
* POSSIBILITY OF SUCH DAMAGE. | |||
*********************************************************************/ | |||
#ifndef IMAGE_PROC_PROCESSOR_H | |||
#define IMAGE_PROC_PROCESSOR_H | |||
#include <thread> |
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.
Good work on adding includes for the std:: objects that you use. However, you seem to have lost the header-guard in the process. Please re-add.
@@ -39,8 +39,8 @@ | |||
#define WAVG4(a,b,c,d,x,y) ( ( ((int)(a) + (int)(b)) * (int)(x) + ((int)(c) + (int)(d)) * (int)(y) ) / ( 2 * ((int)(x) + (int(y))) ) ) | |||
using namespace std; |
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.
For the love of Pete, please fix this.
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 don't know how to change this, do you mean this code is too long?
// limitations under the License. | ||
|
||
#ifdef __clang__ | ||
// TODO(dirk-thomas) custom implementation until we can use libc++ 3.9 |
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 version of clang included with Ubuntu Bionic (target for Crystal) is v7. I think we can likely remove this section and test with clang/libc++.
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 functionality has actually been refactored into rcpputils
, so I would suggest using that. https://github.com/ros2/rcpputils/blob/master/include/rcpputils/filesystem_helper.hpp
Supporting macOS still presents issues when using std::filesystem
, so this is currently the suggested approach.
#include <image_geometry/pinhole_camera_model.h> | ||
#include <cv_bridge/cv_bridge.h> | ||
#include "visibility.h" | ||
#include "../include/rectify.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.
Please use local-relative paths here (e.g. "rectify.hpp"). CMake should take care of the include paths.
@yechun1, @mjcarroll, and @ahuizxc - Are you all OK with me rebasing the |
|
||
void DebayerNodelet::onInit() | ||
namespace enc = sensor_msgs::image_encodings; | ||
DebayerNode::DebayerNode() |
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.
Nodes should take const rclcpp::NodeOptions&
in order to make them composable (replacement for nodelets)
@JWhitleyAStuff @mjcarroll thank you for take time to review our patches. @ahuizxc would you please help to check the comments and give some changes? thanks. |
@ahuizxc - Please rebase your branch on the |
Closing in favor of #426. |
image_proc for ros2