Blame examples/slam/pose_graph_3d/README.md

Packit ea1746
Pose Graph 3D
Packit ea1746
----------------
Packit ea1746
Packit ea1746
The Simultaneous Localization and Mapping (SLAM) problem consists of building a
Packit ea1746
map of an unknown environment while simultaneously localizing against this
Packit ea1746
map. The main difficulty of this problem stems from not having any additional
Packit ea1746
external aiding information such as GPS. SLAM has been considered one of the
Packit ea1746
fundamental challenges of robotics. A pose graph optimization problem is one
Packit ea1746
example of a SLAM problem.
Packit ea1746
Packit ea1746
The example also illustrates how to use Eigen's geometry module with Ceres'
Packit ea1746
automatic differentiation functionality. To represent the orientation, we will
Packit ea1746
use Eigen's quaternion which uses the Hamiltonian convention but has different
Packit ea1746
element ordering as compared with Ceres's rotation representation. Specifically
Packit ea1746
they differ by whether the scalar component q_w is first or last; the element
Packit ea1746
order for Ceres's quaternion is [q_w, q_x, q_y, q_z] where as Eigen's quaternion
Packit ea1746
is [q_x, q_y, q_z, q_w].
Packit ea1746
Packit ea1746
This package defines the necessary Ceres cost functions needed to model the
Packit ea1746
3-dimensional pose graph optimization problem as well as a binary to build and
Packit ea1746
solve the problem. The cost functions are shown for instruction purposes and can
Packit ea1746
be speed up by using analytical derivatives which take longer to implement.
Packit ea1746
Packit ea1746
Packit ea1746
Running
Packit ea1746
-----------
Packit ea1746
This package includes an executable `pose_graph_3d` that will read a problem
Packit ea1746
definition file. This executable can work with any 3D problem definition that
Packit ea1746
uses the g2o format with quaternions used for the orientation representation. It
Packit ea1746
would be relatively straightforward to implement a new reader for a different
Packit ea1746
format such as TORO or others. `pose_graph_3d` will print the Ceres solver full
Packit ea1746
summary and then output to disk the original and optimized poses
Packit ea1746
(`poses_original.txt` and `poses_optimized.txt`, respectively) of the robot in
Packit ea1746
the following format:
Packit ea1746
```
Packit ea1746
pose_id x y z q_x q_y q_z q_w
Packit ea1746
pose_id x y z q_x q_y q_z q_w
Packit ea1746
pose_id x y z q_x q_y q_z q_w
Packit ea1746
...
Packit ea1746
```
Packit ea1746
where `pose_id` is the corresponding integer ID from the file definition. Note,
Packit ea1746
the file will be sorted in ascending order for the ```pose_id```.
Packit ea1746
Packit ea1746
The executable `pose_graph_3d` expects the first argument to be the path to the
Packit ea1746
problem definition. To run the executable,
Packit ea1746
```
Packit ea1746
/path/to/bin/pose_graph_3d /path/to/dataset/dataset.g2o
Packit ea1746
```
Packit ea1746
Packit ea1746
A script is provided to visualize the resulting output files. There is also an
Packit ea1746
option to enable equal axes using ```--axes_equal```.
Packit ea1746
```
Packit ea1746
/path/to/repo/examples/slam/pose_graph_3d/plot_results.py --optimized_poses ./poses_optimized.txt --initial_poses ./poses_original.txt
Packit ea1746
```