  We present X-SLAM, a real-time dense differentiable SLAM system that
leverages the complex-step finite difference (CSFD) method for efficient
calculation of numerical derivatives, bypassing the need for a large-scale
computational graph. The key to our approach is treating the SLAM process as a
differentiable function, enabling the calculation of the derivatives of
important SLAM parameters through Taylor series expansion within the complex
domain. Our system allows for the real-time calculation of not just the
gradient, but also higher-order differentiation. This facilitates the use of
high-order optimizers to achieve better accuracy and faster convergence.
Building on X-SLAM, we implemented end-to-end optimization frameworks for two
important tasks: camera relocalization in wide outdoor scenes and active
robotic scanning in complex indoor environments. Comprehensive evaluations on
public benchmarks and intricate real scenes underscore the improvements in the
accuracy of camera relocalization and the efficiency of robotic navigation
achieved through our task-aware optimization. The code and data are available
at https://gapszju.github.io/X-SLAM.
