Fixed more default constructor calls

release/4.3a0
dellaert 2016-02-11 23:27:58 -08:00
parent 7fd838611e
commit 56dbf487ee
8 changed files with 22 additions and 28 deletions

View File

@ -76,7 +76,7 @@ public:
boost::optional<Matrix&> H = boost::none) const { boost::optional<Matrix&> H = boost::none) const {
// measured bM = nRb<52> * nM + b // measured bM = nRb<52> * nM + b
Point3 hx = unrotate(nRb, nM_, H) + bias_; Point3 hx = unrotate(nRb, nM_, H) + bias_;
return (hx - measured_).vector(); return (hx - measured_);
} }
}; };
@ -114,7 +114,7 @@ public:
boost::optional<Matrix&> H = boost::none) const { boost::optional<Matrix&> H = boost::none) const {
// measured bM = nRb<52> * nM + b // measured bM = nRb<52> * nM + b
Point3 hx = nRb.unrotate(nM_, H, boost::none) + bias_; Point3 hx = nRb.unrotate(nM_, H, boost::none) + bias_;
return (hx - measured_).vector(); return (hx - measured_);
} }
}; };
@ -155,7 +155,7 @@ public:
Point3 hx = bRn_.rotate(nM, boost::none, H1) + bias; Point3 hx = bRn_.rotate(nM, boost::none, H1) + bias;
if (H2) if (H2)
*H2 = eye(3); *H2 = eye(3);
return (hx - measured_).vector(); return (hx - measured_);
} }
}; };
@ -197,7 +197,7 @@ public:
Unit3 rotated = bRn_.rotate(direction, boost::none, H2); Unit3 rotated = bRn_.rotate(direction, boost::none, H2);
Point3 hx = scale * rotated.point3() + bias; Point3 hx = scale * rotated.point3() + bias;
if (H1) if (H1)
*H1 = rotated.point3().vector(); *H1 = rotated.point3();
if (H2) // H2 is 2*2, but we need 3*2 if (H2) // H2 is 2*2, but we need 3*2
{ {
Matrix H; Matrix H;
@ -206,7 +206,7 @@ public:
} }
if (H3) if (H3)
*H3 = eye(3); *H3 = eye(3);
return (hx - measured_).vector(); return (hx - measured_);
} }
}; };

View File

@ -140,7 +140,7 @@ TEST(ScenarioRunner, Loop) {
/* ************************************************************************* */ /* ************************************************************************* */
namespace initial { namespace initial {
const Rot3 nRb; const Rot3 nRb;
const Point3 P0; const Point3 P0(0,0,0);
const Vector3 V0(0, 0, 0); const Vector3 V0(0, 0, 0);
} }
@ -259,7 +259,7 @@ namespace initial3 {
// Rotation only // Rotation only
// Set up body pointing towards y axis. The body itself has Z axis pointing down // Set up body pointing towards y axis. The body itself has Z axis pointing down
const Rot3 nRb(Point3(0, 1, 0), Point3(1, 0, 0), Point3(0, 0, -1)); const Rot3 nRb(Point3(0, 1, 0), Point3(1, 0, 0), Point3(0, 0, -1));
const Point3 P0; const Point3 P0(0,0,0);
const Vector3 V0(0, 0, 0); const Vector3 V0(0, 0, 0);
} }

View File

@ -19,7 +19,7 @@ namespace gtsam {
*/ */
class EssentialMatrixFactor: public NoiseModelFactor1<EssentialMatrix> { class EssentialMatrixFactor: public NoiseModelFactor1<EssentialMatrix> {
Vector vA_, vB_; ///< Homogeneous versions, in ideal coordinates Vector3 vA_, vB_; ///< Homogeneous versions, in ideal coordinates
typedef NoiseModelFactor1<EssentialMatrix> Base; typedef NoiseModelFactor1<EssentialMatrix> Base;
typedef EssentialMatrixFactor This; typedef EssentialMatrixFactor This;
@ -107,9 +107,7 @@ public:
*/ */
EssentialMatrixFactor2(Key key1, Key key2, const Point2& pA, const Point2& pB, EssentialMatrixFactor2(Key key1, Key key2, const Point2& pA, const Point2& pB,
const SharedNoiseModel& model) : const SharedNoiseModel& model) :
Base(model, key1, key2) { Base(model, key1, key2), dP1_(EssentialMatrix::Homogeneous(pA)), pn_(pB) {
dP1_ = Point3(pA.x(), pA.y(), 1);
pn_ = pB;
f_ = 1.0; f_ = 1.0;
} }
@ -125,11 +123,8 @@ public:
template<class CALIBRATION> template<class CALIBRATION>
EssentialMatrixFactor2(Key key1, Key key2, const Point2& pA, const Point2& pB, EssentialMatrixFactor2(Key key1, Key key2, const Point2& pA, const Point2& pB,
const SharedNoiseModel& model, boost::shared_ptr<CALIBRATION> K) : const SharedNoiseModel& model, boost::shared_ptr<CALIBRATION> K) :
Base(model, key1, key2) { Base(model, key1, key2), dP1_(
assert(K); EssentialMatrix::Homogeneous(K->calibrate(pA))), pn_(K->calibrate(pB)) {
Point2 p1 = K->calibrate(pA);
dP1_ = Point3(p1.x(), p1.y(), 1); // d*P1 = (x,y,1)
pn_ = K->calibrate(pB);
f_ = 0.5 * (K->fx() + K->fy()); f_ = 0.5 * (K->fx() + K->fy());
} }

View File

@ -154,7 +154,7 @@ TEST( GeneralSFMFactor, error ) {
Point3 t1(0, 0, -6); Point3 t1(0, 0, -6);
Pose3 x1(R, t1); Pose3 x1(R, t1);
values.insert(X(1), GeneralCamera(x1)); values.insert(X(1), GeneralCamera(x1));
Point3 l1; Point3 l1(0,0,0);
values.insert(L(1), l1); values.insert(L(1), l1);
EXPECT( EXPECT(
assert_equal(((Vector ) Vector2(-3., 0.)), assert_equal(((Vector ) Vector2(-3., 0.)),
@ -451,7 +451,7 @@ TEST(GeneralSFMFactor, BinaryJacobianFactor) {
Point3 t1(0, 0, -6); Point3 t1(0, 0, -6);
Pose3 x1(R, t1); Pose3 x1(R, t1);
values.insert(X(1), GeneralCamera(x1)); values.insert(X(1), GeneralCamera(x1));
Point3 l1; Point3 l1(0,0,0);
values.insert(L(1), l1); values.insert(L(1), l1);
vector<SharedNoiseModel> models; vector<SharedNoiseModel> models;

View File

@ -107,7 +107,7 @@ TEST( GeneralSFMFactor_Cal3Bundler, error ) {
Point3 t1(0, 0, -6); Point3 t1(0, 0, -6);
Pose3 x1(R, t1); Pose3 x1(R, t1);
values.insert(X(1), GeneralCamera(x1)); values.insert(X(1), GeneralCamera(x1));
Point3 l1; Point3 l1(0,0,0);
values.insert(L(1), l1); values.insert(L(1), l1);
EXPECT(assert_equal(Vector2(-3., 0.), factor->unwhitenedError(values))); EXPECT(assert_equal(Vector2(-3., 0.), factor->unwhitenedError(values)));
} }

View File

@ -610,11 +610,11 @@ TEST( SmartProjectionCameraFactor, noiselessBundler ) {
double expectedError = 0.0; double expectedError = 0.0;
DOUBLES_EQUAL(expectedError, actualError, 1e-3); DOUBLES_EQUAL(expectedError, actualError, 1e-3);
Point3 oldPoint; // this takes the point stored in the factor (we are not interested in this) Point3 oldPoint(0,0,0); // this takes the point stored in the factor (we are not interested in this)
if (factor1->point()) if (factor1->point())
oldPoint = *(factor1->point()); oldPoint = *(factor1->point());
Point3 expectedPoint; Point3 expectedPoint(0,0,0);
if (factor1->point(values)) if (factor1->point(values))
expectedPoint = *(factor1->point(values)); expectedPoint = *(factor1->point(values));
@ -636,10 +636,9 @@ TEST( SmartProjectionCameraFactor, comparisonGeneralSfMFactor ) {
smartGraph.push_back(factor1); smartGraph.push_back(factor1);
double expectedError = factor1->error(values); double expectedError = factor1->error(values);
double expectedErrorGraph = smartGraph.error(values); double expectedErrorGraph = smartGraph.error(values);
Point3 expectedPoint; Point3 expectedPoint(0,0,0);
if (factor1->point()) if (factor1->point())
expectedPoint = *(factor1->point()); expectedPoint = *(factor1->point());
// cout << "expectedPoint " << expectedPoint.vector() << endl;
// COMMENTS: // COMMENTS:
// 1) triangulation introduces small errors, then for a fair comparison we use expectedPoint as // 1) triangulation introduces small errors, then for a fair comparison we use expectedPoint as
@ -677,7 +676,7 @@ TEST( SmartProjectionCameraFactor, comparisonGeneralSfMFactor1 ) {
smartGraph.push_back(factor1); smartGraph.push_back(factor1);
Matrix expectedHessian = smartGraph.linearize(values)->hessian().first; Matrix expectedHessian = smartGraph.linearize(values)->hessian().first;
Vector expectedInfoVector = smartGraph.linearize(values)->hessian().second; Vector expectedInfoVector = smartGraph.linearize(values)->hessian().second;
Point3 expectedPoint; Point3 expectedPoint(0,0,0);
if (factor1->point()) if (factor1->point())
expectedPoint = *(factor1->point()); expectedPoint = *(factor1->point());
@ -720,7 +719,7 @@ TEST( SmartProjectionCameraFactor, comparisonGeneralSfMFactor1 ) {
// smartGraph.push_back(factor1); // smartGraph.push_back(factor1);
// GaussianFactorGraph::shared_ptr gfgSmart = smartGraph.linearize(values); // GaussianFactorGraph::shared_ptr gfgSmart = smartGraph.linearize(values);
// //
// Point3 expectedPoint; // Point3 expectedPoint(0,0,0);
// if(factor1->point()) // if(factor1->point())
// expectedPoint = *(factor1->point()); // expectedPoint = *(factor1->point());
// //
@ -773,7 +772,7 @@ TEST( SmartProjectionCameraFactor, computeImplicitJacobian ) {
cameras.push_back(level_camera_right); cameras.push_back(level_camera_right);
factor1->error(values); // this is important to have a triangulation of the point factor1->error(values); // this is important to have a triangulation of the point
Point3 point; Point3 point(0,0,0);
if (factor1->point()) if (factor1->point())
point = *(factor1->point()); point = *(factor1->point());
vector<Matrix29> Fblocks; vector<Matrix29> Fblocks;

View File

@ -108,7 +108,7 @@ private:
const Velocity3& v1 = x1.v(), v2 = x2.v(); const Velocity3& v1 = x1.v(), v2 = x2.v();
const Point3& p1 = x1.t(), p2 = x2.t(); const Point3& p1 = x1.t(), p2 = x2.t();
Point3 hx; Point3 hx(0,0,0);
switch(mode) { switch(mode) {
case dynamics::TRAPEZOIDAL: hx = p1 + Point3((v1 + v2) * dt *0.5); break; case dynamics::TRAPEZOIDAL: hx = p1 + Point3((v1 + v2) * dt *0.5); break;
case dynamics::EULER_START: hx = p1 + Point3(v1 * dt); break; case dynamics::EULER_START: hx = p1 + Point3(v1 * dt); break;

View File

@ -44,7 +44,7 @@ static SharedNoiseModel model(noiseModel::Isotropic::Sigma(1, 0.5 * ms));
static const double timeOfEvent = 25; static const double timeOfEvent = 25;
static const Event exampleEvent(timeOfEvent, 1, 0, 0); static const Event exampleEvent(timeOfEvent, 1, 0, 0);
static const Point3 microphoneAt0; static const Point3 microphoneAt0(0,0,0);
//***************************************************************************** //*****************************************************************************
TEST( TOAFactor, NewWay ) { TEST( TOAFactor, NewWay ) {