Skip to content

Pickling FusedPointCloud #263

@haavarpb

Description

@haavarpb

Preliminary Checks

  • This issue is not a duplicate. Before opening a new issue, please search existing issues.
  • This issue is not a question, bug report, or anything other than a feature request directly related to this project.

Proposal

Hi, unsure if this is a feature request or if a bug.

I am trying to write a couple of tests and functionality around your FusedPointCloud-class in Python.

To do this, I was thinking it would be nice to have a pickled FusedPointCloud, to load and run tests on.

So, assuming I have a FusedPointCloud in memory, I try:

import pickle

with open("pickle_this.pkl", "wb") as f:
    pickle.dump(pointcloud, f)

However, it fails:

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "<stringsource>", line 2, in pyzed.sl.FusedPointCloud.__reduce_cython__
TypeError: no default __reduce__ due to non-trivial __cinit__

I'm not super familiar with pickle internals, but my guess is that a pointcloud should be pretty straightforward and trivial to pickle, since it's not inherently an object with complex references and such (often a problem when it comes to pickling?)

If there is some solution I am missing, I'm all ears.

Cheers

Edit: To be clear, the feature request is to enable pickling.

Use-Case

Writing tests, develop functionality, TDD, more disciplined approach of iteration instead of running the whole extraction process on an SVO each time I'd like to test my code.

Anything else?

Another approach I've considered is to use your built in save(), but that doesn't work since it removes much of the information such as timestamps, and chunks.

A third option I have considered was to save points individually, thinking I could rebuild parts of the FusedPointCloud, its chunks and timestamps etc. But using the Python API I don't get access to constructor nor property setters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions