Pose3SLAMExample_initializePose3Chordal.py
Go to the documentation of this file.
1 """
2 GTSAM Copyright 2010-2018, 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 
7 See LICENSE for the license information
8 
9 Initialize PoseSLAM with Chordal init
10 Author: Luca Carlone, Frank Dellaert (python port)
11 """
12 # pylint: disable=invalid-name, E1101
13 
14 from __future__ import print_function
15 
16 import numpy as np
17 
18 import gtsam
19 
20 # Read graph from file
21 g2oFile = gtsam.findExampleDataFile("pose3example.txt")
22 
23 is3D = True
24 graph, initial = gtsam.readG2o(g2oFile, is3D)
25 
26 # Add prior on the first key. TODO: assumes first key ios z
28  np.array([1e-6, 1e-6, 1e-6, 1e-4, 1e-4, 1e-4]))
29 firstKey = initial.keys()[0]
30 graph.add(gtsam.PriorFactorPose3(0, gtsam.Pose3(), priorModel))
31 
32 # Initializing Pose3 - chordal relaxation"
33 initialization = gtsam.InitializePose3.initialize(graph)
34 
35 print(initialization)
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
static Values initialize(const NonlinearFactorGraph &graph, const Values &givenGuess, bool useGradient=false)
GTSAM_EXPORT GraphAndValues readG2o(const std::string &g2oFile, const bool is3D=false, KernelFunctionType kernelFunctionType=KernelFunctionTypeNONE)
This function parses a g2o file and stores the measurements into a NonlinearFactorGraph and the initi...
Definition: dataset.cpp:615
static shared_ptr Variances(const Vector &variances, bool smart=true)
Definition: NoiseModel.cpp:258
GTSAM_EXPORT std::string findExampleDataFile(const std::string &name)
Definition: dataset.cpp:65


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:43:27