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.