20 using namespace gtsam;
60 double prior_outlier = 0.5;
61 double prior_inlier = 0.5;
65 prior_inlier, prior_outlier);
67 prior_inlier, prior_outlier);
93 double prior_outlier = 0.5;
94 double prior_inlier = 0.5;
97 prior_inlier, prior_outlier);
101 Vector3 actual_err_wh_inlier =
Vector3(actual_err_wh[0], actual_err_wh[1], actual_err_wh[2]);
102 Vector3 actual_err_wh_outlier =
Vector3(actual_err_wh[3], actual_err_wh[4], actual_err_wh[5]);
115 prior_inlier, prior_outlier);
119 actual_err_wh_inlier =
Vector3(actual_err_wh[0], actual_err_wh[1], actual_err_wh[2]);
120 actual_err_wh_outlier =
Vector3(actual_err_wh[3], actual_err_wh[4], actual_err_wh[5]);
132 prior_inlier, prior_outlier);
134 actual_err_wh_inlier =
Vector3(actual_err_wh[0], actual_err_wh[1], actual_err_wh[2]);
165 double prior_outlier = 0.0;
166 double prior_inlier = 1.0;
169 prior_inlier, prior_outlier);
171 std::vector<gtsam::Matrix> H_actual(2);
174 Matrix H1_actual = H_actual[0];
175 Matrix H2_actual = H_actual[1];
180 Vector actual_err_wh_inlier =
Vector3(actual_err_wh[0], actual_err_wh[1], actual_err_wh[2]);
182 std::vector<gtsam::Matrix> H_actual_stnd_unwh(2);
184 Matrix H1_actual_stnd_unwh = H_actual_stnd_unwh[0];
185 Matrix H2_actual_stnd_unwh = H_actual_stnd_unwh[1];
186 Matrix H1_actual_stnd = model_inlier->Whiten(H1_actual_stnd_unwh);
187 Matrix H2_actual_stnd = model_inlier->Whiten(H2_actual_stnd_unwh);
191 double stepsize = 1.0e-9;
192 using std::placeholders::_1;
193 Matrix H1_expected = gtsam::numericalDerivative11<Vector, Pose2>(std::bind(&
predictionError, _1, p2, key1, key2, f),
p1, stepsize);
194 Matrix H2_expected = gtsam::numericalDerivative11<Vector, Pose2>(std::bind(&
predictionError, p1, _1, key1, key2, f),
p2, 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;
243 Vector3 actual_err_wh_inlier =
Vector3(actual_err_wh[0], actual_err_wh[1], actual_err_wh[2]);
244 Vector3 actual_err_wh_outlier =
Vector3(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);
SharedGaussian get_model_outlier() const
SharedGaussian get_model_inlier() const
static int runAllTests(TestResult &result)
A non-templated config holding any types of Manifold-group elements.
noiseModel::Diagonal::shared_ptr model
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Some functions to compute numerical derivatives.
NonlinearFactorGraph graph
void g(const string &key, int i)
static constexpr bool debug
Vector predictionError(const Pose2 &p1, const Pose2 &p2, const gtsam::Key &key1, const gtsam::Key &key2, const BetweenFactorEM< gtsam::Pose2 > &factor)
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
const Symbol key1('v', 1)
Vector whitenedError(const Values &x, OptionalMatrixVecType H=nullptr) const
TEST(BetweenFactorEM, ConstructorAndEquals)
Vector predictionError_standard(const Pose2 &p1, const Pose2 &p2, const gtsam::Key &key1, const gtsam::Key &key2, const BetweenFactor< gtsam::Pose2 > &factor)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Class compose(const Class &g) const
void updateNoiseModels(const Values &values, const NonlinearFactorGraph &graph)
typedef and functions to augment Eigen's VectorXd
Vector unwhitenedError(const Values &x, OptionalMatrixVecType H=nullptr) const override
Class between(const Class &g) const
void insert(Key j, const Value &val)
Vector unwhitenedError(const Values &x) const
Vector whitenedError(const Values &c) const
std::uint64_t Key
Integer nonlinear key type.
noiseModel::Gaussian::shared_ptr SharedGaussian
const Symbol key2('v', 2)
Vector calcIndicatorProb(const Values &x) const