Skip to content
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

Port stereo_image_proc to ROS 2 #486

Merged
merged 21 commits into from
Dec 17, 2019
Merged

Conversation

jacobperron
Copy link
Contributor

Connects to #360.

I think the majority of the port is complete. Opening this PR for visibility/early feedback. I've removed OpenCV 2 support in an attempt to simplify the code.

In addition to the port, I've added some simple launch tests that can be expanded upon in the future.
Test data taken from OpenCV (from here).

Here's what's missing:

  • Monitoring the status of connected publishers to dynamically subscribe/unsubscribe as needed

// TODO(jacobperron): Monitoring subscriber status is currently not possible in ROS 2
// std::lock_guard<std::mutex> lock(connect_mutex_);
// Monitor whether anyone is subscribed to the output
// ros::SubscriberStatusCallback connect_cb = std::bind(&DisparityNode::connectCb, this);

This feature doesn't exist in ROS 2, so I've left TODOs in the code (similar to what was done in other image_pipeline packages).

  • Reconfigurable callbacks for parameters. This should be achievable since parameters are configurable by default. I'll proceed replacing the use of dynamic reconfigure using the rclcpp API. I can add it to this PR or after it is merged, whatever comes first.

  • I should also double-check QoS compatibility with other parts of image_pipeline (mentioned in Port Image_pipeline on ROS2 #360 (comment)).

  • Windows support. E.g add missing visibility flags, cmake commands, etc.


I've been building/testing with ROS 2 Eloquent and the latest ROS 2 source code.

@jacobperron jacobperron mentioned this pull request Dec 13, 2019
7 tasks
@jacobperron
Copy link
Contributor Author

rclcpp_components_register_node was recently backported to Dashing. It should be available in the next patch release and then hopefully CI will be happy.

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple comments

int left = block_matcher_.getDisparityRange() + block_matcher_.getMinDisparity() + border - 1;
int wtf;
if (block_matcher_.getMinDisparity() >= 0) {
wtf = border + block_matcher_.getMinDisparity();
Copy link
Member

Choose a reason for hiding this comment

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

What does wtf represent? I think that could be named clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wish I knew, haha. I didn't touch the logic that was here since ROS 1. Any suggestions are appreciated.

Copy link
Member

@SteveMacenski SteveMacenski Dec 16, 2019

Choose a reason for hiding this comment

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

I... don't even know what that is doing (or why there isn't one of those for the height). I'm going to just back away slowly before I go too far down a rabbithole

@jacobperron
Copy link
Contributor Author

Note, I also did some minor refactoring a25372d

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

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

Any other changes you'd like to make?

We should wait until we pass CI though,

@jacobperron
Copy link
Contributor Author

I want to add the reconfigurable parameters, and figure out what wtf is.. but I can make changes in separate PRs.

It'd be nice if CI was green though before this one goes in. I figured since the latest dashing sync it should be working... 🤔

@JWhitleyWork
Copy link
Collaborator

@jacobperron / @SteveMacenski - They have to manually re-build the Docker containers with the updated packages for CI to pass.

@SteveMacenski
Copy link
Member

Looks like it was updated 3 days ago https://hub.docker.com/_/ros?tab=tags

@SteveMacenski
Copy link
Member

Potentially do it the more nasty way to get CI to build?

@JWhitleyWork
Copy link
Collaborator

@SteveMacenski - You're right. I checked the SHA hash of the image it pulled and CI must be using a cached copy somewhere. I don't know that there is anyway to update this from our end.

@jacobperron
Copy link
Contributor Author

I don't think the image has been updated yet. If I pull ros:dashing-ros-base locally, it doesn't contain the latest version of ros_base (0.7.3).

@SteveMacenski
Copy link
Member

SteveMacenski commented Dec 16, 2019

https://circleci.com/docs/2.0/caching/#clearing-cache

@jacobperron try adding a cache variable we can increment, ei CACHE_VERSION=v1

Edit: ah, ok

@jacobperron
Copy link
Contributor Author

Also, I just noticed that my tests aren't compatible with Dashing, so I'll update those in the meantime.

@jacobperron
Copy link
Contributor Author

@SteveMacenski I've updated the tests so they're backwards compatible with Dashing (ecce41b). PTAL.

@jacobperron
Copy link
Contributor Author

TL;DR It doesn't seem like the Docker image will be updated any time soon. Not until the underlying Ubuntu image gets rebuilt: osrf/docker_images#112

It's a bit annoying, but I can refactor the CMakeLists.txt to see if we can make CI happy.

@jacobperron
Copy link
Contributor Author

See #487 for a proposed fix for failing CI.

@SteveMacenski
Copy link
Member

SteveMacenski commented Dec 17, 2019

Merged.

More descriptive names that will match the classes contained inside.
Also moved all source files associated with the library into a directory of the same name.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Made some minimum changes required for compilation. Not feature-complete yet.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
The test simply checks if the disparity node publishes to the expected topic when it received input.
Made some fixes added to CMakeLists.txt to get node to run probably and pass the test.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Similar to the test for the disparity node.
Fix bug in PointCloudNode.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Replaces the old ROS 1 XML launch file.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
This form of manual composition seems redundant to me and can be done with a launch file.
The only thing it appeared to add was the 'advertisement checker', which was not ported.

If there is strong objection to removing this executable, we can add it back.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
There are a few cases where we discard the const-qualifier for the image data.
This happens because OpenCV won't accend const pointers to data.
Rather than changing the API, I've introduced a const_cast instead.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Fix lint error.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
The code removed was never being used.
Added a TODO regarding the use of an unset variable. This has been here since the ROS 1 implementation,
I'm not sure what the logic is intended to do so I've left it for now.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Save on some vertical space.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Remove commented code related to subscriber status since this may look different in ROS 2.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Now the launch tests should work for both Dashing and Eloquent.
I left some TODO's where we can simplify once we diverge from Dashing.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@jacobperron
Copy link
Contributor Author

Rebased 🤞

@JWhitleyWork JWhitleyWork merged commit 144c704 into ros2 Dec 17, 2019
@JWhitleyWork JWhitleyWork deleted the jacob/port_stereo_image_proc branch December 17, 2019 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants