Add position to Point2 nodes in GraphViz #1058
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had the problem that with me using the Python binding the position of Point2 nodes were not present in the GraphViz code of
saveGraph
.After a little bit of debugging I knew why. When inserting values like so
the result gives a hint about the values type:
It is a gtsam::Vector which is equivalent to
(Eigen::Matrix<double, -1, 1, 0, -1, 1>)
meaning the dynamic vector type. Thus, the dynamic_casts near the diff can't capture the values I added in this way.This PR would also capture those. But I don't know if it is a good idea because maybe some other factors have this underlying type where it has no positional meaning. So that's the first point to discuss.
After having implemented this "fix", I additionally stumbled over the following difference when using this kind of value adding:
As you can see, the type has changed and it is of a fixed size Eigen matrix
(Eigen::Matrix<double, 2, 1, 0, 2, 1>).
This type also gets correctly captured by the existing GraphViz formatting code. So the second point of discussion is if this PR is needed at all then. If it is not needed, I'd argue that the examples should not use the generic insert then. And I guess it should be documented somehow such that any beginner like me is not wondering why it is not doing what it should.