Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g2o_viewer fails to load graphs with high-digit IDs from GTSAM LabeledSymbol #864

Closed
sanderboers48 opened this issue Jan 8, 2025 · 2 comments

Comments

@sanderboers48
Copy link

Problem

g2o_viewer cannot load graph files containing high-digit vertex/edge IDs generated by GTSAM's LabeledSymbol. Example IDs: 27303072740933634.
When these high-digit IDs are shortened to just their last few digits (e.g., 3634), g2o_viewer loads the graphs without issues.

Failing vs Working Format:

# Current (fails in g2o_viewer):
VERTEX_SE3:QUAT 27303072740933632 0 0 0 0 0 0 1
VERTEX_SE3:QUAT 27303072740933633 1 0 0 0 0 0 1
VERTEX_SE3:QUAT 27303072740933634 2 0 0 0 0 0 1
EDGE_SE3:QUAT 27303072740933632 27303072740933633 1 0 0 0 0 0 1 100 0 0 0 0 0 100 0 0 0 0 100 0 0 0 100 0 0 100 0 100
EDGE_SE3:QUAT 27303072740933633 27303072740933634 1 0 0 0 0 0 1 100 0 0 0 0 0 100 0 0 0 0 100 0 0 0 100 0 0 100 0 100

# Desired (works in g2o_viewer):
VERTEX_SE3:QUAT 3632 0 0 0 0 0 0 1
VERTEX_SE3:QUAT 3633 1 0 0 0 0 0 1
VERTEX_SE3:QUAT 3634 2 0 0 0 0 0 1
EDGE_SE3:QUAT 3632 3633 1 0 0 0 0 0 1 100 0 0 0 0 0 100 0 0 0 0 100 0 0 0 100 0 0 100 0 100
EDGE_SE3:QUAT 3633 3634 1 0 0 0 0 0 1 100 0 0 0 0 0 100 0 0 0 0 100 0 0 0 100 0 0 100 0 100

Does anybody know why this is an issue? And if it can be fixed?

@RainerKuemmerle
Copy link
Owner

Do you have under control which keys are assigned to the LabeledSymbol?
Currently, g2o has ID modeled as int which typically is a 32 bit signed integer value (standard requires it to be 16-bit only).

Quickly googling, GTSAM seems to have a std::uint64_t as key. If you have under control that the key stays in the range of 32bit the files should be working.

The issue in g2o code is among others

In particular the last line sets fail bits of the stream and we fail to parse also the remainder of the line.

Fixing this in g2o would require to introduce some typedef and use this consistently in the code.

Would it be an option for you to investigate controlling the range of Keys assigned to the LabeledSymbol?
Alternatively, if the viewer only serves as a debug tool to visualize a small Python script could re-assign numbers in the supported 32-bit range.

@sanderboers48
Copy link
Author

Thank you for your clear and helpful response! I opted to write my own function to generate a 32-bit key, which resolved the issue. Your detailed references to the g2o code were very insightful—much appreciated!

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

No branches or pull requests

2 participants