Azure_Kinect_ROS_Driver icon indicating copy to clipboard operation
Azure_Kinect_ROS_Driver copied to clipboard

Fix Unordered Point Clouds

Open exo-core opened this issue 3 years ago • 13 comments

Fixes

Description of the changes:

Fixed the wrong size information in published point clouds (see #227 and #163).

Required before submitting a Pull Request:

I tested changes on:

  • [ ] Windows
  • [x] Linux
  • [x] ROS1
  • [ ] ROS2

exo-core avatar Mar 02 '22 15:03 exo-core

For my understanding, does this essentially "reshape" the unstructured point cloud (list of points) into a structured point cloud (grid of points in the image domain)?

christian-rauch avatar Apr 06 '22 12:04 christian-rauch

For my understanding, does this essentially "reshape" the unstructured point cloud (list of points) into a structured point cloud (grid of points in the image domain)?

Yes. Actually the correct width and height values are already being set in lines 669/670 and 727/728, respectively, but the call to pcd_modifier.resize(n) resets the point cloud back to n times 1.

exo-core avatar Apr 06 '22 12:04 exo-core

For my understanding, does this essentially "reshape" the unstructured point cloud (list of points) into a structured point cloud (grid of points in the image domain)?

Yes. Actually the correct width and height values are already being set in lines 669/670 and 727/728, respectively, but the call to pcd_modifier.resize(n) resets the point cloud back to n times 1.

I see. In this case, you could also move all of: https://github.com/microsoft/Azure_Kinect_ROS_Driver/blob/c0742b9e470c9e688d796029f10cb52e1a763a4a/src/k4a_ros_device.cpp#L727-L730 to after the pcd_modifier.resize(point_count); so that setting point_cloud->height and point_cloud->width does not appear twice.

christian-rauch avatar Apr 06 '22 13:04 christian-rauch

Also... can you squash your commits? :-) Your third commit reverts your second commit. Such commits should not appear at all in the git history. And I think you can also squash your last commit into the first commit as they touch the same things.

christian-rauch avatar Apr 06 '22 13:04 christian-rauch

Thank you for tracking this down @exo-core ! It works.

@christian-rauch It's rather annoying that this is not the default behavior upstream yet. Can't you just squash-commit and maybe add your own cleanup commit?

v4hn avatar Aug 17 '22 12:08 v4hn

Thank you for tracking this down @exo-core ! It works.

@christian-rauch It's rather annoying that this is not the default behavior upstream yet. Can't you just squash-commit and maybe add your own cleanup commit?

Which commit? I don't have a commit in this PR and I also cannot squash or change other people's PRs.

christian-rauch avatar Aug 18 '22 07:08 christian-rauch

I guess we are a little spoiled from Gitlab, which has a "squash commits" option in the merge menu... (no clue what kind of back magic it does in the background)

I'm quite busy, finalizing my Ph.D. thesis at present, but I'll try to squeeze in a some time next week to update my PRs. For this one it should be straightforward. #240 seems to need some more thought and discussion though...

exo-core avatar Aug 19 '22 06:08 exo-core

I'm quite busy, finalizing my Ph.D. thesis at present

Good luck with your thesis writeup :-)

christian-rauch avatar Aug 19 '22 07:08 christian-rauch

I guess the PR should be fine now ;-)

Good luck with your thesis writeup :-)

Thanks!

exo-core avatar Aug 25 '22 08:08 exo-core

The process died after modifying and compiling the package in accordance with this commit. However I published ordered point clouds by simply remove the following line:

pcd_modifier.resize(point_count);

I am not familiar with point cloud representation in ROS, so I'm wondering if it's a valid solution.

CalaW avatar Sep 22 '22 09:09 CalaW

I guess we are a little spoiled from Gitlab, which has a "squash commits" option in the merge menu

The same is true for github. Also, unless the pr author explicitly disabled it, repository authors are able to push (and force-push) to remote branches that belong to pull-requests and can thus clean up history themselves. Even if the PR author disabled it, it's straight-forward to open a new PR for it (but a bit more work).

I'm quite busy, finalizing my Ph.D. thesis at present

Hang in there and congrats on getting that far! :-)

v4hn avatar Oct 11 '22 07:10 v4hn

The process died after modifying and compiling the package in accordance with this commit. However I published ordered point clouds by simply remove the following line:

pcd_modifier.resize(point_count);

I am not familiar with point cloud representation in ROS, so I'm wondering if it's a valid solution.

Thanks for pointing this out. I was able to get a camera in the lab today and could reproduce the issue.

exo-core avatar Oct 24 '22 16:10 exo-core

Ok, so turned out the initial resize wasn't save to remove after all, since resizing at the end invalidated the iterators. Guess, skipping the resize entirely isn't a good idea either, so I just moved the iterator initializations behind the resize operation.

Sorry, I didn't run detailed tests before; it seemed trivial and I did not have a camera at hand...

exo-core avatar Oct 24 '22 16:10 exo-core