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

Updated ROS2 PR: pcl_conversion only to ROS2 (dashing) #244

Merged
merged 14 commits into from
Oct 29, 2019

Conversation

klintan
Copy link
Contributor

@klintan klintan commented Aug 21, 2019

@LucidOne I made another branch on my fork for (dashing compatible) which only contains the pcl_conversion part and not pcl_ros (COLCON_IGNORE added).

Maybe this could be a first step to a ROS2 version, before the type masquerading etc is implemented in ROS2 ?

Would love some feedback on this,

@klintan klintan changed the title pcl_conversion to ROS2 (dashing) Updated ROS2 PR: pcl_conversion only to ROS2 (dashing) Aug 21, 2019
@klintan
Copy link
Contributor Author

klintan commented Aug 23, 2019

Perhaps someone can take a quick look at the updated travis config: It seems it's just picking up the old master-branch (aka ros1). Haven't used travis much so not sure where and how the code is fetched.

@mabelzhang
Copy link

There is currently a version of pcl_conversions that is released into Dashing (Debian ros-dashing-pcl-conversions).

As mentioned here ros2/pcl_conversions#5, the opinion from the creator @clalancette of that version is that, that version can be somehow merged with this PR and deprecated, before this repo can be released into Dashing. We can continue to port the rest of this repo (pcl_ros) to Dashing.

@mabelzhang
Copy link

I made a PR to merge the ros2/pcl_conversions that is officially released into Dashing but a bit dated, into this PR.
klintan#1

Merge with pcl_conversions officially released in Dashing
@klintan
Copy link
Contributor Author

klintan commented Sep 25, 2019

I made a PR to merge the ros2/pcl_conversions that is officially released into Dashing but a bit dated, into this PR.
klintan#1

Awesome thanks! I merged that one without any review so we can keep the review here (or wherever the final review takes place)

pcl_conversions/CMakeLists.txt Show resolved Hide resolved
pcl_conversions/CMakeLists.txt Show resolved Hide resolved
{
fromPCL(pcl_header.stamp, header.stamp);
header.seq = pcl_header.seq;
auto time_stamp = std::make_shared<rclcpp::Time>(header.stamp);
Copy link
Member

Choose a reason for hiding this comment

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

You make a shared pointer to deference it, you just need the object. If for some reason you need a pointer, use the unique_ptr

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 was thinking just to make sure it gets freed when we go out of the scope. Is there another way without using new and delete ?

Copy link
Member

Choose a reason for hiding this comment

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

Why do you need a pointer at all? You just dereference it soon after

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No probably not. I was just thinking that if I use a smart pointer, it will automatically delete the object after the function scope is gone, no ?

Constructing a new object would mean I need to do something like:

auto time_stamp = new rclcpp::Time(header.stamp);
fromPCL(pcl_header.stamp, time_stamp);
delete time_stamp;

But maybe that is not the way smart ptrs are intended to be used. Do you have any other recommendations on how to write this or is the code sample above an OK approach?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can just make a stack variable:

fromPCL(pcl_header.stamp, rclcpp::Time(header.stamp));

No smart pointers, pointers, or heap allocations required, and a single line of code :).

Copy link
Member

Choose a reason for hiding this comment

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

There's a number of reasons to do one versus the other, but that is one reason, yes.

There's a real performance downside with using heap memory so its best to not do it unless you require it. Plus if you look at what you actually ended up doing:

  • create pointer
  • dereference pointer to pass to a method

There wasn't anything that used it in pointer format, so there wasn't anything to be derived from the allocation

Copy link
Contributor

Choose a reason for hiding this comment

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

Typically, if you are only going to use it in this function (i.e. this stack frame), you do a stack allocation. If it needs to live beyond this function, then you do a heap allocation (either with a "raw" pointer or a smart pointer). Size can also come into it, as on Linux the default stack size is limited by default (8MB if I remember correctly, but don't quote me).

Copy link
Member

Choose a reason for hiding this comment

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

Not to pile on, but also if you're concerned about real-time or software certifications, heap allocations are the devil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for all elaborate examples and explanations, really valuable!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Stack variable worked, however couldn't get it to compile using the one-liner
fromPCL(pcl_header.stamp, rclcpp::Time(header.stamp));

pcl_conversions/include/pcl_conversions/pcl_conversions.h Outdated Show resolved Hide resolved
pcl_conversions/package.xml Show resolved Hide resolved
perception_pcl/CMakeLists.txt Outdated Show resolved Hide resolved
perception_pcl/package.xml Outdated Show resolved Hide resolved
} // namespace ros::serialization

} // namespace ros
// template<>
Copy link
Member

Choose a reason for hiding this comment

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

This is for type masquerading?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm good question, I don't have an answer to that.

Copy link
Member

Choose a reason for hiding this comment

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

@clalancette that's what this is for, correct?

@SteveMacenski
Copy link
Member

I'm going to assume all the time conversions with ns / us / s were done correctly or my brain will start hurting from looking at docs...

@SteveMacenski
Copy link
Member

Another good question is where are the maintainers here? @wjwwood @wkentaro do you guys need some assistance to keep this going in ROS2?

@clalancette
Copy link
Contributor

I'll point out that CI is failing here, because of this message:

ERROR: the following packages/stacks could not have their rosdep keys resolved

to system dependencies:

pcl_conversions: Cannot locate rosdep definition for [pcl_msgs]

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Function 'install_target_dependencies' returned with code '1' after 0 min 1 sec

The command ".industrial_ci/travis.sh" exited with 1.

It looks like someone needs to release pcl_msgs into dashing first.

@SteveMacenski
Copy link
Member

SteveMacenski commented Sep 26, 2019

@clalancette this is sounding a whole lot like my robot_localization ongoing effort. You just want to add me to ros-perception and I can hammer this all out?

I dont like the idea of blocking process for msgs ;-) also I'm already maintaining image_pipeline and there's a bunch of PRs / issues in the SLAM projects I want to fix

@SteveMacenski
Copy link
Member

SteveMacenski commented Sep 26, 2019

So I'm trying to understand where things are at right now and I'm a bit confused.

@mabelzhang you did some work to update @klintan branch, which as been merged and is represented in this PR, correct?

@mabelzhang your PR homologates the ros2/pcl_conversions repository, correct?

So now if we merge this (into what needs to be a new ros2/dashing branch, not crystal) and release it, we can nuke the ros2 fork (IMO not even archive it, delete it from existence since pcl_conversions perception_pcl were confusing enough in ROS1, now add in ROS2 some forks, some branches, etc....)

Is that a correct assessment?

Action item I can take

  • It doesnt look like there have been maintainers around in this for a while, I can try to get on that
  • PCL msgs aren't released, I can get on that
  • Make ros2/dashing branches
  • Merge this PR
  • Either begin porting pcl ros, which I probably can't commit to doing right at this moment, or make active inquires to parties I know have resources to do it

@clalancette
Copy link
Contributor

So now if we merge this (into what needs to be a new ros2/dashing branch, not crystal) and release it, we can nuke the ros2 fork (IMO not even archive it, delete it from existence since pcl_conversions perception_pcl were confusing enough in ROS1, now add in ROS2 some forks, some branches, etc....)

Just FYI, I'll do with the old ros2/pcl_conversions what I've done elsewhere, which is to do a "final" commit on the repository, removing all of the content and adding a README pointing to here. Then I'll archive it. At the very least we still need to keep it around for historical purposes and since we still support Crystal.

@SteveMacenski
Copy link
Member

When's crystals cut off date?

Fair enough

@mabelzhang
Copy link

mabelzhang commented Sep 26, 2019

I'm going to assume all the time conversions with ns / us / s were done correctly or my brain will start hurting from looking at docs...

I will leave that for @klintan to answer. The only changes I made to time were the rclcpp::Time(uint sec, uint nanosec) things in the test script, adding 0s to the calls to ros::Time(double) till there are 9 digits after the decimals for nanoseconds.

It looks like someone needs to release pcl_msgs into dashing first.

That explains why I had to check out the pcl_msgs repo in order for colcon to find its headers.

@mabelzhang you did some work to update @klintan branch, which as been merged and is represented in this PR, correct?

Yes.

@mabelzhang your PR homologates the ros2/pcl_conversions repository, correct?

Yes.
I thought it might be hard to review the diffs since GitHub doesn't show diff between two different repos... So here's a list for reference. The only 6 differences between the two versions of pcl_conversions.h are as follows, and are resolved in my PRs:

  1. Add #include for <rclcpp/rclcpp.hpp> and message_filters (present in perception_pcl PR, not present in pcl_conversions)
  2. Use rclcpp::Time (in perception_pcl PR) instead of builtin_interfaces::msg::Time (in pcl_conversions). The latter used that type because rclcpp::Time didn't exist when that was ported. melodic-devel uses ros::Time, so the better replacement is rclcpp::Time.
  3. In PCLHeader <=> Header toPCL(), set seq field to 0 (present in pcl_conversions, not present in perception_pcl PR)
  4. Uncommented everything related to pcl_msgs (commented out in pcl_conversions, uncommented in perception_pcl PR)
  5. Minor change in this comment (in perception_pcl PR), added msg:: (in pcl_conversions):
    /** Provide to/fromROSMsg for sensor_msgs::PointCloud2 <=> pcl::PointCloud<T> **/
  6. Added commented code (in pcl_conversions) for the last block related to message_traits, because the convention for porting is to comment out ROS 1 code rather than to remove, so that when it's ready to port, there's an existing framework to base off of.

The test script, package.xml, and CMakeLists.txt were also merged.

Either begin porting pcl ros, which I probably can't commit to doing right at this moment, or make active inquires to parties I know have resources to do it

We might be able to do this. That's my next thing to do.

When's crystals cut off date?

Looks like Crystal EOL is Dec 2019 https://index.ros.org/doc/ros2/Releases/

@SteveMacenski
Copy link
Member

@mabelzhang I'll take your word on the porting, everything I saw in this composite PR looks fine to me except for the things I pointed out, I just wanted to know if that was still a pending item on top of this PR or not. I assume you ran those tests and they came out clean?

With December 2019 being the cut off, and its essentially October 1 before this gets merged it, I'd even say we can just delete the pcl_conversions fork, but I don't really care that much to fight one way or another. Whatever's easiest.

@mabelzhang
Copy link

mabelzhang commented Sep 26, 2019

I assume you ran those tests and they came out clean?

Yes, those tests in test/ passed.

@klintan
Copy link
Contributor Author

klintan commented Sep 26, 2019

I've been super busy this week, but will fix all the outstanding issue on Saturday.

@mabelzhang
Copy link

I won't be able to get back to this till next week if there are things specific to my merge.

@klintan
Copy link
Contributor Author

klintan commented Oct 1, 2019

I'm going to assume all the time conversions with ns / us / s were done correctly or my brain will start hurting from looking at docs...

Which ones are you referring to?

I think the rest should be addressed except for the few follow up question I posed. (Namespace question and if everything looks OK in the CMakelists.txt file)

Let me know if there is still something outstanding on this.

@SteveMacenski
Copy link
Member

SteveMacenski commented Oct 1, 2019

Releasing PCL msgs to https://github.com/ros2-gbp/pcl_msgs-release

@clalancette @wjwwood can you add me to the pcl_msgs repo so I can cut a new release on the ROS2 branch? Or just do it yourself if you have access

@mabelzhang
Copy link

mabelzhang commented Oct 2, 2019

@paulbovbel @wkentaro This PR is almost ready to go. The pcl_conversions fork officially released in Dashing is merged to here too. We want to get perception_pcl released in Eloquent, even if it requires putting COLCON_IGNORE in pcl_ros. We're just waiting on dependency pcl_msgs to be released. Could you take a look at this PR and add any comments regarding merging it?

@SteveMacenski
Copy link
Member

PCL msgs are released now for dashing and eloquent. Still need a maintainer here to review this

@SteveMacenski SteveMacenski changed the base branch from crystal-devel to dashing-devel October 15, 2019 19:26
@SteveMacenski
Copy link
Member

SteveMacenski commented Oct 15, 2019

Created dashing branch and retargeted PR to it, @klintan I see another draft PR, is that necessary?

I have write access to this repo now to help get this over the line

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.

nice nice, we're super close!

std_msgs
)

set(includes
Copy link
Member

Choose a reason for hiding this comment

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

I dont think you require this with the dependencies variable and the ament depends call

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to include the non-ROS package here (PCL) otherwise I got an error, couldn't find the header.

Maybe I'm missing something ? since I had the same issue for the navsat_transform_node in the robot_localization package.

pcl_conversions/CMakeLists.txt Outdated Show resolved Hide resolved
pcl_conversions/include/pcl_conversions/pcl_conversions.h Outdated Show resolved Hide resolved
pcl_conversions/include/pcl_conversions/pcl_conversions.h Outdated Show resolved Hide resolved
pcl_conversions/package.xml Outdated Show resolved Hide resolved
@klintan
Copy link
Contributor Author

klintan commented Oct 24, 2019

Created dashing branch and retargeted PR to it, @klintan I see another draft PR, is that necessary?

I have write access to this repo now to help get this over the line

We could close that one, that one contains some changes to pcl_ros as well to try to convert to ROS2, but the effort stalled a bit (mostly because of the type masquerading not being available yet). My c++ skills are not on the level yet to be able to workaround that.

@SteveMacenski
Copy link
Member

Got it, I guess just leave it there for now and I can close the draft PR when there's motion to getting pcl ros ported. An example still have alot of value

pcl_conversions/CMakeLists.txt Show resolved Hide resolved
namespace message_traits
{
template<>
Copy link
Member

Choose a reason for hiding this comment

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

Sorry maybe I was too non-specific, can you add ALL of this stuff back in, but then just comment it ALL out since there is no type masquerading yet? Revert to namespace ros {...} and just block comment it all out with a TODO on type masquerading.

pcl_conversions/package.xml Show resolved Hide resolved

<build_export_depend>eigen</build_export_depend>
<build_depend>eigen3</build_depend>
Copy link
Member

Choose a reason for hiding this comment

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

Oops this should be eigen please change back :-)

Copy link
Member

Choose a reason for hiding this comment

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

pcl_conversions/package.xml Outdated Show resolved Hide resolved
@SteveMacenski
Copy link
Member

Last few things to dot our 'I' and cross out 't'

@klintan
Copy link
Contributor Author

klintan commented Oct 26, 2019

Last few things to dot our 'I' and cross out 't'

Yeah thanks for hanging in there, I think I got most of the kinks ironed out now, but if you find something new or if I missed something let me know.

@SteveMacenski
Copy link
Member

This looks good to me. Let me look at this on Monday and play with on my machine.

CI is failing, which seems related to switching to industrial ci. If you could make that pass that’d be great but I’ll also look into it

@klintan
Copy link
Contributor Author

klintan commented Oct 27, 2019

This looks good to me. Let me look at this on Monday and play with on my machine.

CI is failing, which seems related to switching to industrial ci. If you could make that pass that’d be great but I’ll also look into it

Yeah I saw that
pcl_conversions: No definition of [ament_cmake_gtest] for OS [debian]
failing on debian.
Do you know if there is a docker for debian and dashing? Looking here https://github.com/osrf/docker_images/tree/1eb48f1275f0a9153d0b0ed088bed338f1a79ead/ros and docker hub I could only find ubuntu :( So I couldn't test it ( I mean I can always build my own, but just wanted to ask first if there might be one already out there, I'm guessing Travis is using one for instance)

@SteveMacenski
Copy link
Member

I know alot of repos use the industrial CI so there must be a way to stop that. Otherwise everyone would be broken, those ament cmake packages are super low dependencies. For right now just targeting ubuntu is fine

@SteveMacenski
Copy link
Member

@klintan just remove - OS_NAME=debian OS_CODE_NAME=stretch from your updated CI file. You don't need to run that

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.

Just remove the matrix build for debian and make the matrix builds expandable, and we can merge this guy

.travis.yml Outdated Show resolved Hide resolved
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.

@clalancette want to give this another once over? I'm happy with it

@clalancette
Copy link
Contributor

@clalancette want to give this another once over? I'm happy with it

Honestly, I'm not going to have time this week with ROSCon. I've verified that cartographer_ros still builds with it, so that's going to have to be good enough. Anything else we can fix in a follow-up.

@SteveMacenski SteveMacenski merged commit a1fd4d2 into ros-perception:dashing-devel Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants