Skip to content

Conversation

juagargi
Copy link
Contributor

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.

@jspricke
Copy link
Member

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).

@jspricke
Copy link
Member

Hi @juagargi, could you give some justification why you made use_appender a template parameter instead of a parameter to the constructor, for example?

@juagargi
Copy link
Contributor Author

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.

@jspricke
Copy link
Member

Is there any reason why you can't do it at runtime?

@juagargi
Copy link
Contributor Author

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.
If you find there are cases where we want to change the writing mode for a given tree at runtime, that parameter will have to be checked at runtime.

@jspricke
Copy link
Member

jspricke commented Nov 8, 2013

@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?

@juagargi
Copy link
Contributor Author

juagargi commented Nov 8, 2013

@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.

@jspricke
Copy link
Member

jspricke commented Nov 9, 2013

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).

@rbrusu
Copy link
Member

rbrusu commented Dec 17, 2013

This is a pretty cool contribution, thanks @juagargi ! Would it be possible to add some unit tests as well?

@SergioRAgostinho SergioRAgostinho added this to the pcl-1.9.0 milestone Aug 22, 2016
@SergioRAgostinho SergioRAgostinho added status: stale needs: author reply Specify why not closed/merged yet labels Nov 22, 2017
@SergioRAgostinho SergioRAgostinho removed this from the pcl-1.9.0 milestone Nov 22, 2017
@stale stale bot closed this Dec 14, 2017
@jspricke jspricke reopened this Dec 18, 2017
@stale stale bot removed the status: stale label Dec 18, 2017
@juagargi
Copy link
Contributor Author

I remembered I had this still open!
Do you guys still want some of these changes in? should I groom all this according to the comments?

@stale stale bot removed the status: stale label Feb 22, 2018
@taketwo taketwo added needs: code review Specify why not closed/merged yet and removed needs: author reply Specify why not closed/merged yet labels Feb 22, 2018
@SergioRAgostinho
Copy link
Member

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.

@juagargi
Copy link
Contributor Author

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.

@SergioRAgostinho
Copy link
Member

PCD file tests are here:
https://github.com/PointCloudLibrary/pcl/blob/master/test/io/test_io.cpp

Out of core tests are here:
https://github.com/PointCloudLibrary/pcl/blob/master/test/outofcore/test_outofcore.cpp

To run the tests you first need to enable BUILD_global_tests option, let CMake find googletest, and then is a matter of running make tests.

To save compilation time you can simply request to build the tests you need make test_outofcore and then run them individually build/test/outofcore/test_outofcore.

… 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.
@juagargi
Copy link
Contributor Author

juagargi commented Mar 6, 2018

The out of core tests seem to pass as well. I wonder if I should write one to cover this appender thing.

data_size = cloud.points.size () * fsize;

data_idx += (tmp_cloud.width - cloud.width) * fsize;
if(data_idx != file_size)
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing space before parenthese.

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?
Copy link
Contributor

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.

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?
Copy link
Contributor

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
Copy link
Contributor

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.
@SergioRAgostinho
Copy link
Member

The out of core tests seem to pass as well. I wonder if I should write one to cover this appender thing.

Yes definitely!

@stale
Copy link

stale bot commented Feb 21, 2020

This pull request has been automatically marked as stale because it hasn't had
any activity in the past 60 days. Commenting or adding a new commit to the
pull request will revert this.

Come back whenever you have time. We look forward to your contribution.

@stale stale bot added the status: stale label Feb 21, 2020
@taketwo taketwo added needs: more work Specify why not closed/merged yet and removed needs: code review Specify why not closed/merged yet labels Feb 29, 2020
@DanielSepeda
Copy link

Have these changes been implemented yet?

@stale stale bot removed the status: stale label Jan 25, 2021
@TaylorDale
Copy link

I've attempted to implement this over the top of PCL by extending the writer class:
https://gist.github.com/TaylorDale/49ccff40d1591db2985e36cd14a003d1

However unfortunately after the first write the file becomes corrupted, specifically
"The expected data size and the current data size are different" as the data_idx differs from the file size.

Was a nice try but PCL's probably changed a bit since 8 years ago when this was pull was made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: more work Specify why not closed/merged yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants