g2opy
g2opy copied to clipboard
How to add vertex to pose graph? (what is pose?)
https://github.com/uoip/g2opy#pose-graph-optimization gives an example of optimizer. However, how to use the functions defined is confusing. For instance, the function
add_vertex(self, id, pose, fixed=False)
requires "pose", but it is unclear what type it is. For instance, I have a 4x4 transformation matrix (or translation and orientation), how to convert it to a "pose"?
And the same issue for set_vertex() in add_edge(). These functions are just hard to understand, and the C++ documents does not have functions with same names.
it is a little bit late but here is the answer to your question.
The input ‘pose’ to the function add_vertex should be a g2o.Isometry3d object which you can instantiate in one of the following ways:
g2o.Isometry3d( a 4x4 np.ndarray transformation matrix )
g2o.Isometry3d( a 3x3 np.ndarray rotation matrix, a 3x1 np.ndarray translation matrix )
I think there are 2 more constructors for Isometry3d but these should be enough.