From bfb58143f5c3158a6e44c3bb311b481e18286187 Mon Sep 17 00:00:00 2001 From: Duy-Nguyen Ta Date: Mon, 19 Sep 2016 12:39:41 -0400 Subject: [PATCH] Vector in template param: works! Also fix tests for recent changes... --- cython/gtsam.h | 2 +- cython/tests.py | 37 ++++++++++++++++++++----------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/cython/gtsam.h b/cython/gtsam.h index 8bf097153..9924eafad 100644 --- a/cython/gtsam.h +++ b/cython/gtsam.h @@ -2174,7 +2174,7 @@ class NonlinearISAM { #include #include -template +template virtual class PriorFactor : gtsam::NoiseModelFactor { PriorFactor(size_t key, const T& prior, const gtsam::noiseModel::Base* noiseModel); PriorFactor(const This& other); diff --git a/cython/tests.py b/cython/tests.py index 1df5b7f87..f4a8efcec 100644 --- a/cython/tests.py +++ b/cython/tests.py @@ -12,8 +12,8 @@ v = np.array([.1, .1, .1]) print("v = ", v) r4 = r3.retract(v) print("r4 pitch:", r4.pitch()) -r4._print(b'r4: ') -r3._print(b"r3: ") +r4.print_(b'r4: ') +r3.print_(b"r3: ") v = r3.localCoordinates(r4) print("localCoordinates:", v) @@ -23,46 +23,49 @@ Rmat = np.array([ [0.104218, 0.990074, -0.0942928], [-0.0942928, 0.104218, 0.990074] ]) -r5 = Rot3.ctor1(Rmat) -r5._print(b"r5: ") +r5 = Rot3.Rot3_1(Rmat) +r5.print_(b"r5: ") l = Rot3.Logmap(r5) print("l = ", l) noise = noiseModel_Gaussian.Covariance(Rmat) -noise._print(b"noise:") +noise.print_(b"noise:") D = np.array([1.,2.,3.]) diag = noiseModel_Diagonal.Variances(D) print("diag:", diag) -diag._print(b"diag:") +diag.print_(b"diag:") print("diag R:", diag.R()) p = Point3() -p._print("p:") -factor = BetweenFactorPoint3.ctor(1,2,p, noise) -factor._print(b"factor:") +p.print_("p:") +factor = BetweenFactorPoint3.BetweenFactorPoint3(1,2,p, noise) +factor.print_(b"factor:") vv = VectorValues() -vv._print(b"vv:") +vv.print_(b"vv:") vv.insert(1, np.array([1.,2.,3.])) vv.insert(2, np.array([3.,4.])) vv.insert(3, np.array([5.,6.,7.,8.])) -vv._print(b"vv:") +vv.print_(b"vv:") -vv2 = VectorValues.ctor1(vv) +vv2 = VectorValues.VectorValues_1(vv) vv2.insert(4, np.array([4.,2.,1])) -vv2._print(b"vv2:") -vv._print(b"vv:") +vv2.print_(b"vv2:") +vv.print_(b"vv:") vv.insert(4, np.array([1.,2.,4.])) -vv._print(b"vv:") +vv.print_(b"vv:") vv3 = vv.add(vv2) -vv3._print(b"vv3:") +vv3.print_(b"vv3:") values = Values() values.insertPoint3(1, Point3()) values.insertRot3(2, Rot3()) -values._print(b"values:") \ No newline at end of file +values.print_(b"values:") + +factor = PriorFactorVector.PriorFactorVector(1, np.array([1.,2.,3.]), diag) +factor.print_("Prior factor vector: ") \ No newline at end of file