Skip to content
rosskidson edited this page Jan 25, 2014 · 5 revisions

Explanation of Packages

g2o is the g2o library wrapped by a ROS package. The original library code is all under g2o_src

g2o_viewer is the gui that comes with g2o. This is a great tool for visualizing and optimizing graphs. It is separate from g2o as it will have dependencies on any custom types one may define, as well as the g2o library itself

g2o_example provides examples and custom types demonstrating the library. The executable files generate g2o files that may be inspected and optimized with g2o_viewer

Examples

ba_synth_data

Intended for 3D keyframe SLAM with a monocular camera. This graph will bundle adjust keyframe positions and landmarks using reprojection error assuming a pinhole camera model. Keyframe poses, landmarks and landmark observations are all synthetically generated.

pose_adjust

Optimization of poses based on SE(3) pose estimations between poses. The edges in this case are SE(3) pose-pose constraints, describing the relative transformation between poses.

Understand the Code

Read g2o_example/src/*.cpp to see how to populate a g2o graph.

Read g2o_example/src/custom_types/* to see how to define your own types for g2o

Adding custom types

In order to define your own custom types, you need to do a few things

  • Create an equivalent of register_types.h/register_types.cpp and init_types()
  • Include register_types.h in your program and call init_types()
  • Link against the custom types lib in your own code

For g2o_viewer this is the same, and hence why g2o_viewer depends on any code that defines custom types