34 using namespace gtsam;
44 0,
Vector2(1.0,2.0), (
Matrix(2, 2) << 3.0,4.0,0.0,6.0).finished(),
45 3, (
Matrix(2, 2) << 7.0,8.0,9.0,10.0).finished(),
46 4, (
Matrix(2, 2) << 11.0,12.0,13.0,14.0).finished());
48 1,
Vector2(15.0,16.0), (
Matrix(2, 2) << 17.0,18.0,0.0,20.0).finished(),
49 2, (
Matrix(2, 2) << 21.0,22.0,23.0,24.0).finished(),
50 4, (
Matrix(2, 2) << 25.0,26.0,27.0,28.0).finished());
52 2,
Vector2(29.0,30.0), (
Matrix(2, 2) << 31.0,32.0,0.0,34.0).finished(),
53 3, (
Matrix(2, 2) << 35.0,36.0,37.0,38.0).finished());
55 3,
Vector2(39.0,40.0), (
Matrix(2, 2) << 41.0,42.0,0.0,44.0).finished(),
56 4, (
Matrix(2, 2) << 45.0,46.0,47.0,48.0).finished());
58 4,
Vector2(49.0,50.0), (
Matrix(2, 2) << 51.0,52.0,0.0,54.0).finished());
71 VectorValues xb = DoglegOptimizerImpl::ComputeBlend(Delta, xu, xn);
98 0,
Vector2(1.0,2.0), (
Matrix(2, 2) << 3.0,4.0,0.0,6.0).finished(),
99 3, (
Matrix(2, 2) << 7.0,8.0,9.0,10.0).finished(),
100 4, (
Matrix(2, 2) << 11.0,12.0,13.0,14.0).finished());
102 1,
Vector2(15.0,16.0), (
Matrix(2, 2) << 17.0,18.0,0.0,20.0).finished(),
103 2, (
Matrix(2, 2) << 21.0,22.0,23.0,24.0).finished(),
104 4, (
Matrix(2, 2) << 25.0,26.0,27.0,28.0).finished());
106 2,
Vector2(29.0,30.0), (
Matrix(2, 2) << 31.0,32.0,0.0,34.0).finished(),
107 3, (
Matrix(2, 2) << 35.0,36.0,37.0,38.0).finished());
109 3,
Vector2(39.0,40.0), (
Matrix(2, 2) << 41.0,42.0,0.0,44.0).finished(),
110 4, (
Matrix(2, 2) << 45.0,46.0,47.0,48.0).finished());
112 4,
Vector2(49.0,50.0), (
Matrix(2, 2) << 51.0,52.0,0.0,54.0).finished());
143 for(
size_t it=0; it<10; ++it) {
147 double nonlinearError = fg.
error(config);
148 double linearError = linearized->error(config.
zeroVectors());
151 auto gbn = linearized->eliminateSequential();
155 Delta, DoglegOptimizerImpl::SEARCH_EACH_ITERATION, dx_u, dx_n, *
gbn, fg,
156 config, fg.
error(config));
172 auto model = noiseModel::Diagonal::Sigmas(
Vector3(0.2, 0.2, 0.1));
182 params.setVerbosityDL(
"VERBOSITY");
213 TEST(DogLegOptimizer, VariableUpdate) {
224 noiseModel::Isotropic::Sigma(2, 1.0);
241 ISAM2 isam2(isam2_params);
245 unordered_map<int, SmartFactor::shared_ptr> smart_factors;
246 for (
size_t j = 0;
j < points.size(); ++
j) {
251 for (
size_t i = 0;
i < poses.size(); ++
i) {
269 smart_factors[
j] = smartfactor;
276 (
Vector(6) << Vector3::Constant(0.3), Vector3::Constant(0.1)).finished());
291 for (
size_t i = 0;
i < 3; ++
i)
292 initialEstimate.insert(
i, poses[
i].compose(
delta));
304 for (
size_t j = 0;
j < points.size(); ++
j) {
314 initialEstimate.clear();
317 initialEstimate.insert(pose_idx, poses[pose_idx].
compose(
delta));