Write out full resolution floats in flatbuffer to JSON
It turns out that we were missing a 1--2 digits of precision
necessary to fully represent floats/doubles. In most cases where we
would care about bit-perfect
This moves all of our flatbuffer->JSON conversion to use
std::format/std::to_chars, which specifically guarantee that you will be
able to read the number back fully, while truncating numbers reasonably
so that e.g. 0.1 actually renders reasonably to the human eye.
In doing so, this also reduces some of the inconsistencies between the
two FlatbufferToJson methods.
This forces updates in a variety of tests that make use of this code and
which check for exactly identical serialized JSON values.
Change-Id: Idbf6a5614043ce4d6c02f3104991e30fdca23334
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/y2023/vision/calibrate_multi_cameras_test.py b/y2023/vision/calibrate_multi_cameras_test.py
index 2b54355..1586775 100755
--- a/y2023/vision/calibrate_multi_cameras_test.py
+++ b/y2023/vision/calibrate_multi_cameras_test.py
@@ -75,12 +75,12 @@
calc_file = calc_calib_dir + file
# Next find the "ground truth" file with this pi_name
- external_dir = 'external/calibrate_multi_cameras_data/'
- files = os.listdir(external_dir)
+ expected_dir = 'y2023/vision/test_data/'
+ files = os.listdir(expected_dir)
gt_file = ""
for file in files[::-1]:
if pi_name in file:
- gt_file = external_dir + file
+ gt_file = expected_dir + file
if calc_file != "" and gt_file != "":
if not compare_files(gt_file, calc_file):