uoip / g2opy

Python binding of SLAM graph optimization framework g2o
668 stars 176 forks source link

How to add vertex to pose graph? (what is pose?) #32

Open lvgeng opened 5 years ago

lvgeng commented 5 years ago

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.

ylmzkaan commented 4 years ago

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.