test_Serialization.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 Serialization and deep copy tests.
9 
10 Author: Varun Agrawal
11 """
12 import unittest
13 
14 import numpy as np
15 from gtsam.symbol_shorthand import B, V, X
16 from gtsam.utils.test_case import GtsamTestCase
17 
18 import gtsam
19 
20 
22  """Tests for deep copy of various GTSAM objects."""
23 
25  """
26  Test the deep copy of `PreintegratedImuMeasurements`.
27  """
30 
31  self.assertDeepCopyEquality(pim)
32 
33  def test_ImuFactor(self):
34  """
35  Test the deep copy of `ImuFactor`.
36  """
38  params.setAccelerometerCovariance(1e-7 * np.eye(3))
39  params.setGyroscopeCovariance(1e-8 * np.eye(3))
40  params.setIntegrationCovariance(1e-9 * np.eye(3))
41  priorBias = gtsam.imuBias.ConstantBias(np.zeros(3), np.zeros(3))
42  pim = gtsam.PreintegratedImuMeasurements(params, priorBias)
43 
44  # Preintegrate a single measurement for serialization to work.
45  pim.integrateMeasurement(measuredAcc=np.zeros(3),
46  measuredOmega=np.zeros(3),
47  deltaT=0.005)
48 
49  factor = gtsam.ImuFactor(0, 1, 2, 3, 4, pim)
50 
51  self.assertDeepCopyEquality(factor)
52 
54  """
55  Test the deep copy of `PreintegratedCombinedMeasurements`.
56  """
57  params = gtsam.PreintegrationCombinedParams(np.asarray([0, 0, -9.81]))
59 
60  self.assertDeepCopyEquality(pim)
61 
62 
63 if __name__ == "__main__":
64  unittest.main()
test_Serialization.TestDeepCopy.test_PreintegratedImuMeasurements
def test_PreintegratedImuMeasurements(self)
Definition: test_Serialization.py:24
test_Serialization.TestDeepCopy
Definition: test_Serialization.py:21
gtsam::symbol_shorthand
Definition: inference/Symbol.h:147
gtsam::utils.test_case.GtsamTestCase.assertDeepCopyEquality
def assertDeepCopyEquality(self, obj)
Definition: test_case.py:46
gtsam::PreintegratedImuMeasurements
Definition: ImuFactor.h:68
gtsam::ImuFactor
Definition: ImuFactor.h:169
gtsam::utils.test_case
Definition: test_case.py:1
gtsam::PreintegrationParams::MakeSharedD
static std::shared_ptr< PreintegrationParams > MakeSharedD(double g=9.81)
Definition: PreintegrationParams.h:51
gtsam::imuBias::ConstantBias
Definition: ImuBias.h:32
gtsam::utils.test_case.GtsamTestCase
Definition: test_case.py:16
test_Serialization.TestDeepCopy.test_ImuFactor
def test_ImuFactor(self)
Definition: test_Serialization.py:33
test_Serialization.TestDeepCopy.test_PreintegratedCombinedMeasurements
def test_PreintegratedCombinedMeasurements(self)
Definition: test_Serialization.py:53
gtsam::PreintegrationCombinedParams
Definition: PreintegrationCombinedParams.h:36
gtsam::PreintegratedCombinedMeasurements
Definition: CombinedImuFactor.h:66


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:16:00