Skip to content

fix: CSV export missing values for quaternion and RPY series#1290

Closed
pradhankukiran wants to merge 3 commits intoPlotJuggler:mainfrom
pradhankukiran:fix/csv-export-missing-values
Closed

fix: CSV export missing values for quaternion and RPY series#1290
pradhankukiran wants to merge 3 commits intoPlotJuggler:mainfrom
pradhankukiran:fix/csv-export-missing-values

Conversation

@pradhankukiran
Copy link
Copy Markdown
Contributor

Fixes #1137 - quaternion and roll/pitch/yaw columns appear in CSV export with headers but no values.
Four root causes identified and fixed:

  1. Off-by-one in index initialization (publisher_csv.cpp:291): indices[i] = index + 1 skipped the first in-range sample of every series. Changed to indices[i] = index, consistent with generateStatisticsCSV().

  2. Machine-epsilon timestamp matching (publisher_csv.cpp:328): Values from different series were merged into a CSV row only when timestamps matched within std::numeric_limits<double>::epsilon() (~2.2e-16). Real sensor data has larger floating-point drift between channels, causing cells to go blank. Replaced with an adaptive tolerance (min_dt * 0.5) derived from the minimum sample period across all exported series — mathematically guaranteed to never merge distinct adjacent samples.

  3. NaN values stalling index advancement (publisher_csv.cpp:344-348): The index only advanced when a value was not NaN, making it impossible to distinguish "no data at this timestamp" from "data is NaN at this timestamp." Added a row_used boolean vector to track participation explicitly, so indices advance correctly regardless of
    NaN status.

  4. No zero-norm quaternion guard (special_messages.cpp, quaternion_to_rpy.cpp): A zero quaternion (0,0,0,0) caused 1.0 / sqrt(0) = inf, producing NaN for all RPY values, which then triggered 3rd bug. Added an early return of (0,0,0) RPY when quat_norm2 < 1e-10.

@facontidavide
Copy link
Copy Markdown
Collaborator

CI is red sir

@facontidavide
Copy link
Copy Markdown
Collaborator

nevermind, that was my fault. for the PR, actually you should return NaN if you want plotJuggler to "skip it". do not return 0.0

@pradhankukiran
Copy link
Copy Markdown
Contributor Author

@facontidavide done, returning NaN instead of 0.0 now. thanks for finding it out.

@facontidavide
Copy link
Copy Markdown
Collaborator

this plugin has been retired

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quaternion values as well as roll/pitch/yaw are not exported to the CSV file

2 participants