-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Add PCLPointCloud2::operator+=()
and update concatenation operation
#3320
Add PCLPointCloud2::operator+=()
and update concatenation operation
#3320
Conversation
You mean Edit: you forgot to copy over CMake changes. |
Fixed that |
In principle, we can add a macro ( |
That sounds good |
Something similar this perhaps. |
I decided to use the feature test macro instead of standard switch. That allows compilers to provide it even with a lower standard (like clang and gcc with some warnings) EDIT: Did you get time to review the changes to logic I made? Are they sensible? |
139f78d
to
0dc8288
Compare
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 haven't had time to check the logic, will do later today or tomorrow.
4d07c63
to
90b002b
Compare
I had a closer look at the old code and your changes and I like the new approach, the logic is solid. Stepping back a bit though, I was wondering what is the right thing to do in the following situation. Imagine we have two point clouds with same set of fields that includes padding ("_") fields, e.g. something like:
Both the old and the new version will strip the padding field. But isn't it more logical to not do that? Firstly, it's faster (just one What's your opinion on this? Regarding deprecation, I don't have an answer. You wrote:
I assume you are talking about having an overloaded function On the other hand, do we want so many functions doing the same thing? I don't know. We could use some more opinions, e.g. @SergioRAgostinho, but he seems to currently be in hiatus. |
You'd know more about that based on the use-case. Do we have a platform where we can announce stuff like this? Opinion based polls (like future direction and questions like this), even if just for maintainers. A github team might be a good idea. Regarding your two points:
That's just a bool flag though so it'll not affect code complexity
Yes. But I guess your point stands. My opinion: I find free function based API are better for libraries since they allow users to keep on adding modifications without inheritance to third_party classes. std lib actually has free and class functions for a lot of base functions so it's not unheard of to have multiple functions. Just |
In the (very) old times pcl-devs mailing list would have been the right place, but it's long dead. So I'm not sure how to reach to the people who may be interested/affected.
I'd rather prefer that, explicit over implicit. Especially if you think about our original case of adding polygon meshes. You have two similar meshes from two files, you add them. And bam! the underlying point clouds magically changed their internal layout.
Agreed.
Also agree. Well, here is my proposal then:
What do you think? |
For those active on github, we can have teams based on functions (@PointCloudLibrary/core for maintainers, @PointCloudLibrary/poll) and ping on issues/gitter
So 'x, y, _, z, _' and 'x, y, _, _, z' will result in what? 'x, y, _, z' or 'x, y, z'? Does "rgb" and "rgba" special case apply? |
How would you imagine the procedure of "enrolling" people in such groups?
Neither. Here is my logic:
|
For maintainers, it is just creating a team from current list of people with some admin access. For larger community, it can be a voluntary "signup" to a channel where you receive polls, updates regarding future (not the current status). A separate repository can be created to discuss. Issues can have expiry dates, people will get notifications (which they can switch on/off per issue and per repo), people can have different levels of async participation (important since gitter needs somewhat people to be in sync communication). Getting people will be slow but it might be an good experiment to try to separate the 2 kinds of issues: current and meta/future
Maybe a simpler approach might be better
Your idea involves instead IMO, this gives no advantage from user perspective especially since the fields are marked as skip. We still end up memcpy part by part, and it adds complexity in case the number of skip fields are different but non-skip fields are same. |
30a13a9
to
0e8fac0
Compare
Test 16 is failing |
Thanks for suggestions regarding organizational issues, sounds interesting. Unfortunately I am currently overwhelmed with other things, so don't have time to implement these. Maybe you can create an issue and put copy your thoughts there so that they are not lost.
Probably yes. Theoretically, a user may have skip fields on purpose (no ensure alignment for SSE instructions), but I agree it's far-fetched. So 👍 to your proposal.
Yes, they should always be treated as the same field. |
I don't know if the following is a weird usage or misuse of PCL Library. There's a subtle bug that can affect users if their point clouds have the same name of the fields but different datatype. Based on the default datatypes, the field names and data types are sort of standardized, so it shouldn't be an issue. Just raising the point here in case I'm wrong |
Indeed, sort of. However, it's not impossible to have a Ideally, we should check that not only the names, but also the types match. But honestly, I'd leave this for the next time. |
Let's create an issue with "Hey, check it over here" and leave it up for the future? If someone faces issues, search engines will lead them to the right place. This patch is already a bit bigger than required. |
The squeeze function is wrong. Let me remove it from the PR and put it as a snippet in an issue as starting point for later. The last memcpy part is the issue. I can't build gtest on mac so it'll take me time to debug the failing test for the concatenate function |
@taketwo Found the source of failing test. My algorithm ensures that both clouds agree on what fields to skip. The previous algorithm would
These features fundamentally make the previous version of concatenate a rather selective_concatenate. I would view the first behavior as a bug. The second can be a feature (ease-of-use) or a bug. In the first case, we can deprecate the usage of How should I proceed? |
In my opinion, the most reasonable approach is to deprecate the old function, update its documentation to highlight the problem in its behavior, and recommend to use the new function. The implementation of the old function should be left as-is. Actually, I don't expect that the current behavior has legitimate use-cases and that someone is relying on it. But just in case there are such people, we will keep the old function in deprecated state for considerable time so that there is enough transition time for users to either reconsider their use-case or file a feature request to add functions that allow to achieve the old behavior. |
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.
Awesome, thank you for all the effort!
Concerning the #if __has_cpp_attribute(fallthrough) && !(defined(__clang__) && __cplusplus < 201703L)
# define PCL_FALLTHROUGH [[fallthrough]];
#elif defined(__clang__)
# define PCL_FALLTHROUGH [[clang::fallthrough]];
#elif defined(__GNUC__)
# if __GNUC__ >= 7
# define PCL_FALLTHROUGH [[gnu::fallthrough]];
# else
# define PCL_FALLTHROUGH ;
# endif
#else
# define PCL_FALLTHROUGH ;
#endif |
@taketwo Do we have builds with different compilers and versions to confirm this? It might be possible that compiler devs might have corrected this behavior |
@Morwenn thanks for sharing. @kunaltyagi no, we have a very limited coverage of compiler versions, just one per operating system. So we'll have to trust @Morwenn until proven otherwise. |
Better PCL_FALLTHROUGH
Added += and + operators for PCLPointCloud2 Deprecated concatenatePointCloud function Added free concatenate operation for PCLPointCloud Added free and static member function concatenate for PointCloud
e3405f4
to
0443266
Compare
PTAL |
Should have been added by PointCloudLibrary#3320
Should have been added by PointCloudLibrary#3320
Should have been added by PointCloudLibrary#3320
@kunaltyagi @taketwo It seems to me that the |
That's very unexpected. The only difference is a route to concatenate call (which shouldn't cause delays) and a switch to Are both the versions compiled with same optimization flags? |
Yes, to elaborate a bit more with a minimal example:
used to have a similar run time as
but now it becomes a lot slower. |
Thanks. I'm compiling PCL with "-O3" and will report my findings BTW do you know how to maintain a per-commit speed benchmark? I've seen some projects do that, but I don't remember which ones and how UPDATE:
For small indices, the raw for loop performs better. But for larger indices, EDIT: EDIT2: |
Here are my numbers for 10000 points on Ubuntu 18.04, GCC 7.4:
The last line is for the new version, which does I observe significant fluctuations in the measured time. However, |
Did you set the CPU frequency governor to performance? Otherwise the default scaling doesn't do well for benchmarking. You could also pin the process to one CPU (even if it's multi-threaded) using A consistent (non-existent preferred) non-benchmark load also helps to reduce noise.
Yeah, I forgot to update the pcl-bench repo |
sudo cpupower frequency-set --governor performance This seems to help a lot against fluctuations. |
I learned a couple of new tricks with this thread. 👍 |
PCLPointCloud2::operator+=
and update in concatenation operation
PCLPointCloud2::operator+=
and update in concatenation operationPCLPointCloud2::operator+=()
and update concatenation operation
Splits part of #3316
+=
and+
operations topcl::PCLPointCloud2
concatenate
(binary inplace and ternary by-copy) as main logic functionsconcatenatePointCloud
to use the static functions+=
and+
because they can't return error valueQuestions:
nothrow
noexcept
to functions moving forward?Logic discrepancies in original version:
header.stamp
to newer version as performed inPointCloud<T>
strip
or not to strip case isn't equivalent. In the former case, name must match, but in the latter case, mismatch names are skipped silently