test_VisualISAMExample.py
Go to the documentation of this file.
1 """
2 GTSAM Copyright 2010-2019, Georgia Tech Research Corporation,
3 Atlanta, Georgia 30332-0415
4 All Rights Reserved
5 
6 See LICENSE for the license information
7 
8 visual_isam unit tests.
9 Author: Frank Dellaert & Duy Nguyen Ta (Python)
10 """
11 import unittest
12 
13 import numpy as np
14 
15 import gtsam
16 import gtsam.utils.visual_data_generator as generator
17 import gtsam.utils.visual_isam as visual_isam
18 from gtsam import symbol
19 from gtsam.utils.test_case import GtsamTestCase
20 
21 
23 
25  # Data Options
26  options = generator.Options()
27  options.triangle = False
28  options.nrCameras = 20
29 
30  # iSAM Options
31  isamOptions = visual_isam.Options()
32  isamOptions.hardConstraint = False
33  isamOptions.pointPriors = False
34  isamOptions.batchInitialization = True
35  isamOptions.reorderInterval = 10
36  isamOptions.alwaysRelinearize = False
37 
38  # Generate data
39  data, truth = generator.generate_data(options)
40 
41  # Initialize iSAM with the first pose and points
42  isam, result, nextPose = visual_isam.initialize(data, truth, isamOptions)
43 
44  # Main loop for iSAM: stepping through all poses
45  for currentPose in range(nextPose, options.nrCameras):
46  isam, result = visual_isam.step(data, isam, result, truth, currentPose)
47 
48  for i in range(len(truth.cameras)):
49  pose_i = result.atPose3(symbol('x', i))
50  self.gtsamAssertEquals(pose_i, truth.cameras[i].pose(), 1e-5)
51 
52  for j in range(len(truth.points)):
53  point_j = result.atPoint3(symbol('l', j))
54  self.gtsamAssertEquals(point_j, truth.points[j], 1e-5)
55 
56 if __name__ == "__main__":
57  unittest.main()
def gtsamAssertEquals(self, actual, expected, tol=1e-9)
Definition: test_case.py:18
static const Pose3 pose(Rot3(Vector3(1,-1,-1).asDiagonal()), Point3(0, 0, 0.5))
Key symbol(unsigned char c, std::uint64_t j)
size_t len(handle h)
Definition: pytypes.h:1514


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:46:04