PointCloudLibrary / PointCloudLibrary/pcl

[io] origin and orientation precision when writing to file can be too low

Open
#4,842 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: bug module: io needs: author reply
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

Describe the bug

The precision in PCD (and PLY) files of the origin and orientation is not the one provided to PCDWriter::writeASCII (and PLY equivalent).

Context

I get the origin of my sensor from RTK GPS and therefore get it at high precision. These are converted to UTM, leading to large numbers (see below).

Expected behavior

When saving a PCD file with PCDWriter::writeASCII() or writeBinary() (although in this case it is not possible to specify a precision), I would expect the precision in the header (for origin and orientation) to be the one that is specified.

Current Behavior

Currently I get the default (6 on my computer):

VIEWPOINT 492818 5.52752e+06 -0.483211 1 -0 -0 -0.000667558

when provided with (and this is only a print on a screen so also with limited but higher precision):

- Translation: [492818.039, 5527515.847, -0.483]

The default precision is not high enough for my application.

To Reproduce

Just save a PCD (or PLY) file with an origin that is a large number (more than your default precision).

Your Environment (please complete the following information):

  • OS: Ubuntu 20.04
  • Compiler: GCC 9.3.0
  • PCL Version 1.10 from Ubuntu package

Possible Solution

The problem is due to the fact that the origin is written in a string using generateHeaderASCII() that does not use the precision.

The functions that generate the header either need to use the precision from the functions that call them or write directly in the file that is used by writeASCII() (and similar) rather than in a string.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

First reproduce the precision loss with a large origin, then inspect PCDWriter::writeASCII(), writeBinary(), and generateHeaderASCII(); compare the corresponding PLY header-generation path. Done means the requested precision is preserved for origin and orientation in ASCII headers, with binary behavior addressed as specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-vision
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.