MCPcopy Create free account
hub / github.com/Robotics-STAR-Lab/H2-Mapping / optimize4DoF

Method optimize4DoF

src/dvins/pose_graph/src/pose_graph.cpp:403–579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401}
402
403void PoseGraph::optimize4DoF()
404{
405 while(true)
406 {
407 int cur_index = -1;
408 int first_looped_index = -1;
409 m_optimize_buf.lock();
410 while(!optimize_buf.empty())
411 {
412 cur_index = optimize_buf.front();
413 first_looped_index = earliest_loop_index;
414 optimize_buf.pop();
415 }
416 m_optimize_buf.unlock();
417 if (cur_index != -1)
418 {
419 printf("optimize pose graph \n");
420 TicToc tmp_t;
421 m_keyframelist.lock();
422 KeyFrame* cur_kf = getKeyFrame(cur_index);
423
424 int max_length = cur_index + 1;
425
426 // w^t_i w^q_i
427 double t_array[max_length][3];
428 Quaterniond q_array[max_length];
429 double euler_array[max_length][3];
430 double sequence_array[max_length];
431
432 ceres::Problem problem;
433 ceres::Solver::Options options;
434 options.linear_solver_type = ceres::SPARSE_NORMAL_CHOLESKY;
435 //options.minimizer_progress_to_stdout = true;
436 //options.max_solver_time_in_seconds = SOLVER_TIME * 3;
437 options.max_num_iterations = 5;
438 ceres::Solver::Summary summary;
439 ceres::LossFunction *loss_function;
440 loss_function = new ceres::HuberLoss(0.1);
441 //loss_function = new ceres::CauchyLoss(1.0);
442 ceres::LocalParameterization* angle_local_parameterization =
443 AngleLocalParameterization::Create();
444
445 list<KeyFrame*>::iterator it;
446
447 int i = 0;
448 for (it = keyframelist.begin(); it != keyframelist.end(); it++)
449 {
450 if ((*it)->index < first_looped_index)
451 continue;
452 (*it)->local_index = i;
453 Quaterniond tmp_q;
454 Matrix3d tmp_r;
455 Vector3d tmp_t;
456 (*it)->getVioPose(tmp_t, tmp_r);
457 tmp_q = tmp_r;
458 t_array[i][0] = tmp_t(0);
459 t_array[i][1] = tmp_t(1);
460 t_array[i][2] = tmp_t(2);

Callers

nothing calls this directly

Calls 10

beginMethod · 0.80
endMethod · 0.80
getVioPoseMethod · 0.80
xMethod · 0.80
yMethod · 0.80
getLoopRelativeTMethod · 0.80
getLoopRelativeYawMethod · 0.80
updatePoseMethod · 0.80
getPoseMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected