update namespace mEstimator for unittests
parent
e035b6e4bf
commit
6eafc9420e
|
@ -552,7 +552,7 @@ Null::shared_ptr Null::Create()
|
||||||
Fair::Fair(const double c, const ReweightScheme reweight)
|
Fair::Fair(const double c, const ReweightScheme reweight)
|
||||||
: Base(reweight), c_(c) {
|
: Base(reweight), c_(c) {
|
||||||
if ( c_ <= 0 ) {
|
if ( c_ <= 0 ) {
|
||||||
cout << "MEstimator Fair takes only positive double in constructor. forced to 1.0" << endl;
|
cout << "mEstimator Fair takes only positive double in constructor. forced to 1.0" << endl;
|
||||||
c_ = 1.0;
|
c_ = 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -583,7 +583,7 @@ Fair::shared_ptr Fair::Create(const double c, const ReweightScheme reweight)
|
||||||
Huber::Huber(const double k, const ReweightScheme reweight)
|
Huber::Huber(const double k, const ReweightScheme reweight)
|
||||||
: Base(reweight), k_(k) {
|
: Base(reweight), k_(k) {
|
||||||
if ( k_ <= 0 ) {
|
if ( k_ <= 0 ) {
|
||||||
cout << "MEstimator Huber takes only positive double in constructor. forced to 1.0" << endl;
|
cout << "mEstimator Huber takes only positive double in constructor. forced to 1.0" << endl;
|
||||||
k_ = 1.0;
|
k_ = 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -636,7 +636,7 @@ Tukey::shared_ptr Tukey::Create(const double c, const ReweightScheme reweight) {
|
||||||
return shared_ptr(new Tukey(c, reweight));
|
return shared_ptr(new Tukey(c, reweight));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace MEstimator
|
} // namespace mEstimator
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
// Robust
|
// Robust
|
||||||
|
|
|
@ -571,7 +571,7 @@ namespace gtsam {
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: should not really exist
|
// TODO: should not really exist
|
||||||
/// The MEstimator namespace contains all robust error functions (not models)
|
/// The mEstimator namespace contains all robust error functions (not models)
|
||||||
namespace mEstimator {
|
namespace mEstimator {
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
|
@ -678,7 +678,7 @@ namespace gtsam {
|
||||||
Tukey(){}
|
Tukey(){}
|
||||||
};
|
};
|
||||||
|
|
||||||
} ///\namespace MEstimator
|
} ///\namespace mEstimator
|
||||||
|
|
||||||
/// Base class for robust error models
|
/// Base class for robust error models
|
||||||
class Robust : public Base {
|
class Robust : public Base {
|
||||||
|
|
|
@ -294,7 +294,7 @@ TEST(NoiseModel, WhitenInPlace)
|
||||||
TEST(NoiseModel, robustFunction)
|
TEST(NoiseModel, robustFunction)
|
||||||
{
|
{
|
||||||
const double k = 5.0, error1 = 1.0, error2 = 10.0;
|
const double k = 5.0, error1 = 1.0, error2 = 10.0;
|
||||||
const MEstimator::Huber::shared_ptr huber = MEstimator::Huber::Create(k);
|
const mEstimator::Huber::shared_ptr huber = mEstimator::Huber::Create(k);
|
||||||
const double weight1 = huber->weight(error1),
|
const double weight1 = huber->weight(error1),
|
||||||
weight2 = huber->weight(error2);
|
weight2 = huber->weight(error2);
|
||||||
DOUBLES_EQUAL(1.0, weight1, 1e-8);
|
DOUBLES_EQUAL(1.0, weight1, 1e-8);
|
||||||
|
@ -308,7 +308,7 @@ TEST(NoiseModel, robustNoise)
|
||||||
Matrix A = Matrix_(2, 2, 1.0, 10.0, 100.0, 1000.0);
|
Matrix A = Matrix_(2, 2, 1.0, 10.0, 100.0, 1000.0);
|
||||||
Vector b = Vector_(2, error1, error2);
|
Vector b = Vector_(2, error1, error2);
|
||||||
const Robust::shared_ptr robust = Robust::Create(
|
const Robust::shared_ptr robust = Robust::Create(
|
||||||
MEstimator::Huber::Create(k, MEstimator::Huber::Scalar),
|
mEstimator::Huber::Create(k, mEstimator::Huber::Scalar),
|
||||||
Unit::Create(2));
|
Unit::Create(2));
|
||||||
|
|
||||||
robust->WhitenSystem(A,b);
|
robust->WhitenSystem(A,b);
|
||||||
|
|
|
@ -261,10 +261,10 @@ TEST(NonlinearOptimizer, MoreOptimizationWithHuber) {
|
||||||
NonlinearFactorGraph fg;
|
NonlinearFactorGraph fg;
|
||||||
fg.add(PriorFactor<Pose2>(0, Pose2(0,0,0), noiseModel::Isotropic::Sigma(3,1)));
|
fg.add(PriorFactor<Pose2>(0, Pose2(0,0,0), noiseModel::Isotropic::Sigma(3,1)));
|
||||||
fg.add(BetweenFactor<Pose2>(0, 1, Pose2(1,0,M_PI/2),
|
fg.add(BetweenFactor<Pose2>(0, 1, Pose2(1,0,M_PI/2),
|
||||||
noiseModel::Robust::Create(noiseModel::MEstimator::Huber::Create(2.0),
|
noiseModel::Robust::Create(noiseModel::mEstimator::Huber::Create(2.0),
|
||||||
noiseModel::Isotropic::Sigma(3,1))));
|
noiseModel::Isotropic::Sigma(3,1))));
|
||||||
fg.add(BetweenFactor<Pose2>(1, 2, Pose2(1,0,M_PI/2),
|
fg.add(BetweenFactor<Pose2>(1, 2, Pose2(1,0,M_PI/2),
|
||||||
noiseModel::Robust::Create(noiseModel::MEstimator::Huber::Create(3.0),
|
noiseModel::Robust::Create(noiseModel::mEstimator::Huber::Create(3.0),
|
||||||
noiseModel::Isotropic::Sigma(3,1))));
|
noiseModel::Isotropic::Sigma(3,1))));
|
||||||
|
|
||||||
Values init;
|
Values init;
|
||||||
|
|
Loading…
Reference in New Issue