test_lago.py
Go to the documentation of this file.
1 """
2 GTSAM Copyright 2010, Georgia Tech Research Corporation,
3 Atlanta, Georgia 30332-0415
4 All Rights Reserved
5 Authors: Frank Dellaert, et al. (see THANKS for the full author list)
6 See LICENSE for the license information
7 
8 Author: John Lambert (Python)
9 """
10 
11 import unittest
12 
13 import numpy as np
14 
15 import gtsam
16 from gtsam import Point3, Pose2, PriorFactorPose2, Values
17 
18 
19 class TestLago(unittest.TestCase):
20  """Test selected LAGO methods."""
21 
22  def test_initialize(self) -> None:
23  """Smokescreen to ensure LAGO can be imported and run on toy data stored in a g2o file."""
24  g2oFile = gtsam.findExampleDataFile("noisyToyGraph.txt")
25 
27  graph, initial = gtsam.readG2o(g2oFile)
28 
29  # Add prior on the pose having index (key) = 0
30  priorModel = gtsam.noiseModel.Diagonal.Variances(Point3(1e-6, 1e-6, 1e-8))
31  graph.add(PriorFactorPose2(0, Pose2(), priorModel))
32 
33  estimateLago: Values = gtsam.lago.initialize(graph)
34  assert isinstance(estimateLago, Values)
35 
36 
37 if __name__ == "__main__":
38  unittest.main()
Values initialize(const NonlinearFactorGraph &graph, const Values &initialGuess)
Definition: lago.cpp:391
PriorFactor< Pose2 > PriorFactorPose2
bool isinstance(handle obj)
Definition: pytypes.h:700
def test_initialize(self)
Definition: test_lago.py:22
GraphAndValues readG2o(const std::string &g2oFile, const bool is3D, KernelFunctionType kernelFunctionType)
This function parses a g2o file and stores the measurements into a NonlinearFactorGraph and the initi...
Definition: dataset.cpp:621
GTSAM_EXPORT std::string findExampleDataFile(const std::string &name)
Definition: dataset.cpp:70
Vector3 Point3
Definition: Point3.h:38
static shared_ptr Variances(const Vector &variances, bool smart=true)
Definition: NoiseModel.cpp:258


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:37:46