-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Appending points to PCD and Out-of-core Octree modification to use append #325
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
base: master
Are you sure you want to change the base?
Conversation
Hi @juagargi, thanks for your contribution. Could you clean up the patches a little, so we can review them easier? Have a look at git rebase -i for it. Also, please don't change the indention in unrelated files (as in outofcore/tools/outofcore_print.cpp). |
Hi @juagargi, could you give some justification why you made use_appender a template parameter instead of a parameter to the constructor, for example? |
Hi @jspricke , use_appender is a template argument because that decision is taken in compile time: one can choose to create and use the regular tree, or the one that appends data to the files. If it was a run-time argument, it'd look like you can modify its behavior during the life of the object. |
Is there any reason why you can't do it at runtime? |
Nono, let me explain my philosophy for this: that decision is taken at compile time because I believe once you've created a tree, you don't want to change it's writing mode. |
@juagargi My point is, if we just add a runtime function and a default parameter, we can leave the current API in place. Also, we could make the number of zeros an argument. I see this more like a reserve() in std::vector, what do you think? |
@jspricke I like that idea. My concern in this case would be the distinction between using the append method or the previous one (loading the compressed PCD, pushing the data and saving it again compressed). Would we like to use such two different methods based only in one parameter? If the answer is yes, I'll move the template parameter to a constructor argument. |
I think a good API should hide away those two differences. A user shouldn't worry about the underlying implementation as long as performance is not a problem and if, it should be easy to adopt the code (like calling reserve). |
This is a pretty cool contribution, thanks @juagargi ! Would it be possible to add some unit tests as well? |
I remembered I had this still open! |
Long long time no hear. Since it's been 4/5 years 😅, it might be a good idea to let the current maintainer team go through a review first before addressing any changes. The PR is already marked for a review. It's definitely a good idea to rebase it against the current master branch though. |
It's rebased now. It still builds, but I haven't found where the UTs are, to run them. To be honest, I took just a quick look to the web pages for documentation on where they are, but didn't find them either. |
PCD file tests are here: Out of core tests are here: To run the tests you first need to enable To save compilation time you can simply request to build the tests you need |
… existing PCD file, and updates the header. Added a derived class from the OutofcoreOctreeDiskContainer that doesn't use compression, and uses the appender instead. Clean up and comments added. Fix mmap in Linux. Fix Linux build.
The out of core tests seem to pass as well. I wonder if I should write one to cover this appender thing. |
io/include/pcl/io/impl/pcd_io.hpp
Outdated
data_size = cloud.points.size () * fsize; | ||
|
||
data_idx += (tmp_cloud.width - cloud.width) * fsize; | ||
if(data_idx != file_size) |
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.
Missing space before parenthese.
io/include/pcl/io/impl/pcd_io.hpp
Outdated
data_idx += (tmp_cloud.width - cloud.width) * fsize; | ||
if(data_idx != file_size) | ||
{ | ||
// warn , deleteme: do more than just warn : is the file going to end up corrupted? |
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.
It seems that it is a missing TODO.
io/include/pcl/io/impl/pcd_io.hpp
Outdated
data_idx += (tmp_cloud.width - cloud.width) * fsize; | ||
if(data_idx != file_size) | ||
{ | ||
// warn , deleteme: do more than just warn : is the file going to end up corrupted? |
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 same missing TODO here.
@@ -299,6 +299,50 @@ namespace pcl | |||
static boost::uuids::random_generator uuid_gen_; | |||
|
|||
}; | |||
|
|||
/** \class OutofcoreOctreeDiskContainer without compression |
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.
Misaligned doc string.
Also fix indentation of doc string.
Yes definitely! |
This pull request has been automatically marked as stale because it hasn't had Come back whenever you have time. We look forward to your contribution. |
Have these changes been implemented yet? |
I've attempted to implement this over the top of PCL by extending the writer class: However unfortunately after the first write the file becomes corrupted, specifically Was a nice try but PCL's probably changed a bit since 8 years ago when this was pull was made. |
The PCD writer now writes the width and number of points using 10 digits, so the header part of the PCD file is fixed.
There is a new call to append data to a PCD file.
The out-of-core octree has a specialization that is able to append data, instead of creating new point clouds and compressing them to disk.