19 using namespace gtsam;
61 double prior_outlier = 0.5;
62 double prior_inlier = 0.5;
66 prior_inlier, prior_outlier);
68 prior_inlier, prior_outlier);
94 double prior_outlier = 0.5;
95 double prior_inlier = 0.5;
98 prior_inlier, prior_outlier);
100 Vector actual_err_wh =
f.whitenedError(values);
102 Vector actual_err_wh_inlier = (
Vector(3) << actual_err_wh[0], actual_err_wh[1], actual_err_wh[2]);
103 Vector actual_err_wh_outlier = (
Vector(3) << actual_err_wh[3], actual_err_wh[4], actual_err_wh[5]);
116 prior_inlier, prior_outlier);
118 actual_err_wh =
g.whitenedError(values);
120 actual_err_wh_inlier = (
Vector(3) << actual_err_wh[0], actual_err_wh[1], actual_err_wh[2]);
121 actual_err_wh_outlier = (
Vector(3) << actual_err_wh[3], actual_err_wh[4], actual_err_wh[5]);
133 prior_inlier, prior_outlier);
134 actual_err_wh = h_EM.whitenedError(values);
135 actual_err_wh_inlier = (
Vector(3) << actual_err_wh[0], actual_err_wh[1], actual_err_wh[2]);
138 Vector actual_err_wh_stnd =
h.whitenedError(values);
166 double prior_outlier = 0.0;
167 double prior_inlier = 1.0;
170 prior_inlier, prior_outlier);
172 std::vector<gtsam::Matrix> H_actual(2);
173 Vector actual_err_wh =
f.whitenedError(values, H_actual);
175 Matrix H1_actual = H_actual[0];
176 Matrix H2_actual = H_actual[1];
180 Vector actual_err_wh_stnd =
h.whitenedError(values);
181 Vector actual_err_wh_inlier = (
Vector(3) << actual_err_wh[0], actual_err_wh[1], actual_err_wh[2]);
183 std::vector<gtsam::Matrix> H_actual_stnd_unwh(2);
184 (void)
h.unwhitenedError(values, H_actual_stnd_unwh);
185 Matrix H1_actual_stnd_unwh = H_actual_stnd_unwh[0];
186 Matrix H2_actual_stnd_unwh = H_actual_stnd_unwh[1];
187 Matrix H1_actual_stnd = model_inlier->Whiten(H1_actual_stnd_unwh);
188 Matrix H2_actual_stnd = model_inlier->Whiten(H2_actual_stnd_unwh);
192 double stepsize = 1.0e-9;
193 Matrix H1_expected = gtsam::numericalDerivative11<LieVector, Pose2>(boost::bind(&
predictionError, _1, p2, key1, key2,
f),
p1, stepsize);
194 Matrix H2_expected = gtsam::numericalDerivative11<LieVector, Pose2>(boost::bind(&
predictionError, p1, _1, key1, key2,
f),
p2, stepsize);
198 Matrix H1_expected_stnd = gtsam::numericalDerivative11<LieVector, Pose2>(boost::bind(&predictionError_standard, _1, p2, key1, key2,
h),
p1, stepsize);
220 gtsam::Pose2 rel_pose_msr(0.0316191379, 0.0247539161, 0.004102182);
229 double prior_outlier = 0.5;
230 double prior_inlier = 0.5;
233 prior_inlier, prior_outlier);
236 cout <<
"==== inside CaseStudy ===="<<endl;
240 Vector actual_err_unw =
f.unwhitenedError(values);
241 Vector actual_err_wh =
f.whitenedError(values);
243 Vector actual_err_wh_inlier = (
Vector(3) << actual_err_wh[0], actual_err_wh[1], actual_err_wh[2]);
244 Vector actual_err_wh_outlier = (
Vector(3) << actual_err_wh[3], actual_err_wh[4], actual_err_wh[5]);
247 cout <<
"p_inlier_outler: "<<p_inlier_outler[0]<<
", "<<p_inlier_outler[1]<<endl;
248 cout<<
"actual_err_unw: "<<actual_err_unw[0]<<
", "<<actual_err_unw[1]<<
", "<<actual_err_unw[2]<<endl;
249 cout<<
"actual_err_wh_inlier: "<<actual_err_wh_inlier[0]<<
", "<<actual_err_wh_inlier[1]<<
", "<<actual_err_wh_inlier[2]<<endl;
250 cout<<
"actual_err_wh_outlier: "<<actual_err_wh_outlier[0]<<
", "<<actual_err_wh_outlier[1]<<
", "<<actual_err_wh_outlier[2]<<endl;
273 double prior_outlier = 0.0;
274 double prior_inlier = 1.0;
277 prior_inlier, prior_outlier);
285 f.updateNoiseModels(values, graph);
290 model_inlier->print(
"model_inlier:");
291 model_outlier->print(
"model_outlier:");
292 model_inlier_new->print(
"model_inlier_new:");
293 model_outlier_new->print(
"model_outlier_new:");
static int runAllTests(TestResult &result)
A non-templated config holding any types of Manifold-group elements.
noiseModel::Diagonal::shared_ptr model
void insert(Key j, const Value &val)
Pose2_ Expmap(const Vector3_ &xi)
Some functions to compute numerical derivatives.
NonlinearFactorGraph graph
void g(const string &key, int i)
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
const Symbol key1('v', 1)
Vector whitenedError(const Values &x, boost::optional< std::vector< Matrix > & > H=boost::none) const
Class compose(const Class &g) const
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
LieVector predictionError(const LieVector &v1, const LieVector &v2, const GaussMarkovFactor factor)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
const Symbol key2('v', 2)
Class between(const Class &g) const
Vector whitenedError(const Values &c) const
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
#define TEST(testGroup, testName)
std::uint64_t Key
Integer nonlinear key type.
noiseModel::Gaussian::shared_ptr SharedGaussian