Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Dataset Utilities

The gtsam/slam/dataset.h header provides utility functions for loading and saving factor graph data, particularly in formats commonly used in the SLAM community like TORO (‘.graph’) and g2o (‘.g2o’).

Key functions include:

  • findExampleDataFile(name): Locates example dataset files distributed with GTSAM.

  • load2D(filename, ...): Loads a 2D pose graph (Poses and BetweenFactors) from TORO or g2o format.

  • load3D(filename): Loads a 3D pose graph (currently simpler than load2D, assumes specific format).

  • readG2o(filename, is3D): A more general function to read g2o files containing various factor and variable types (2D/3D poses, landmarks, measurements).

  • writeG2o(graph, initialEstimate, filename): Saves a factor graph and values to the g2o format.

  • parseVariables<T>/parseMeasurements<T>/parseFactors<T>: Lower-level parsing functions (less commonly used directly).

Open In Colab

Finding Example Datasets

Found w100.graph at: c:\Users\porte\miniconda3\envs\gtsam\Lib\site-packages\gtsam\Data\w100.graph
Found dlr.g2o at: None

Loading 2D Datasets (load2D)


Loaded c:\Users\porte\miniconda3\envs\gtsam\Lib\site-packages\gtsam\Data\w100.graph:
  Graph size: 300
  Initial estimate keys: 100

Loading/Saving G2O Files (readG2o, writeG2o)

readG2o can handle both 2D and 3D datasets and various factor types defined in the g2o format. writeG2o saves a NonlinearFactorGraph and Values into a g2o file.

Error processing None: readG2o(): incompatible function arguments. The following argument types are supported:
    1. (filename: str, is3D: bool = False, kernelFunctionType: gtsam.gtsam.KernelFunctionType = <KernelFunctionType.KernelFunctionTypeNONE: 0>) -> tuple[gtsam.gtsam.NonlinearFactorGraph, gtsam.gtsam.Values]

Invoked with: None; kwargs: is3D=True