python
gtsam
tests
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
26
graph =
gtsam.NonlinearFactorGraph
()
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()
gtsam::lago::initialize
Values initialize(const NonlinearFactorGraph &graph, const Values &initialGuess)
Definition:
lago.cpp:391
gtsam::readG2o
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
PriorFactorPose2
PriorFactor< Pose2 > PriorFactorPose2
Definition:
serialization.cpp:37
isinstance
bool isinstance(handle obj)
Definition:
pytypes.h:842
gtsam::NonlinearFactorGraph
Definition:
NonlinearFactorGraph.h:55
test_lago.TestLago
Definition:
test_lago.py:19
gtsam::Point3
Vector3 Point3
Definition:
Point3.h:38
gtsam::findExampleDataFile
GTSAM_EXPORT std::string findExampleDataFile(const std::string &name)
Definition:
dataset.cpp:70
test_lago.TestLago.test_initialize
None test_initialize(self)
Definition:
test_lago.py:22
gtsam::noiseModel::Diagonal::Variances
static shared_ptr Variances(const Vector &variances, bool smart=true)
Definition:
NoiseModel.cpp:284
gtsam::Pose2
Definition:
Pose2.h:39
gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:15:58