diff --git a/GPU_version/vio/include/vio/global.h b/GPU_version/vio/include/vio/global.h index 86cc64a..d3adc3c 100644 --- a/GPU_version/vio/include/vio/global.h +++ b/GPU_version/vio/include/vio/global.h @@ -91,7 +91,11 @@ namespace vio } SE2 inverse() const{ double yaw=atan2(T2_.so2().unit_complex().imag(),T2_.so2().unit_complex().real()); - return SE2(yaw+M_PI,-1.0*T2_.translation()); + if(yaw<0.0) + yaw=M_PI-yaw; + else + yaw=yaw-M_PI; + return SE2(yaw,-1.0*T2_.translation()); } double pitch()const{ return atan2(T2_.rotation_matrix()(0,1),T2_.rotation_matrix()(0,0)); diff --git a/GPU_version/vio/param/vo_fast.yaml b/GPU_version/vio/param/vo_fast.yaml index 69954f4..04d1559 100644 --- a/GPU_version/vio/param/vo_fast.yaml +++ b/GPU_version/vio/param/vo_fast.yaml @@ -12,5 +12,5 @@ svo: init_min_inliers: 30 ACC_noise: 0.5 #acc white noise in continuous in EKF GYO_noise: 0.001 #gyro white noise in continuous in EKF - svo_ekf: 1.5 #Svo noise that will be devided by number of Reprojected points after opmization in EKF + svo_ekf: 1.0 #Svo noise that will be devided by number of Reprojected points after opmization in EKF Cmd_Cov: 1.0 #control vector noise in EKF diff --git a/GPU_version/vio/src/depth_filter.cpp b/GPU_version/vio/src/depth_filter.cpp index 0a1f1e2..a02b47a 100644 --- a/GPU_version/vio/src/depth_filter.cpp +++ b/GPU_version/vio/src/depth_filter.cpp @@ -234,7 +234,7 @@ void DepthFilter::updateSeeds(FramePtr frame) continue; } // check if point is visible in the current image - SE2 T(it->ftr->frame->T_f_w_.pitch()-frame->T_f_w_.pitch(),it->ftr->frame->T_f_w_.se2().translation()- frame->T_f_w_.se2().translation()); + SE2 T(it->ftr->frame->T_f_w_.se2() * frame->T_f_w_.inverse()); Eigen::Matrix R; R<T_f_w_.se2().translation()-new_frame_->T_f_w_.se2().translation()).norm()>0.5 || + fabs(last_frame_->T_f_w_.pitch()-new_frame_->T_f_w_.pitch())>M_PI){ + return RESULT_FAILURE; + } reprojector_.reprojectMap(new_frame_, overlap_kfs_); - // assert // TODO -/* + /* std::cout<<"Reprojection Map nPoint: "<T_f_w_.se2().translation()-new_frame_->T_f_w_.se2().translation()).norm()<<'\n';*/ - if( reprojector_.n_trials_ < 10)return RESULT_FAILURE; + if( reprojector_.n_matches_ < 5)return RESULT_FAILURE; size_t sfba_n_edges_final=0; double sfba_thresh, sfba_error_init, sfba_error_final; pose_optimizer::optimizeGaussNewton( Config::poseOptimThresh(), Config::poseOptimNumIter(), false, new_frame_, sfba_thresh, sfba_error_init, sfba_error_final, sfba_n_edges_final); - if((last_frame_->T_f_w_.se2().translation()-new_frame_->T_f_w_.se2().translation()).norm()>0.5 || - fabs(last_frame_->T_f_w_.pitch()-new_frame_->T_f_w_.pitch())>M_PI){ - return RESULT_FAILURE; - } + auto result=ukfPtr_.UpdateSvo(new_frame_->T_f_w_.se2().translation()(0), new_frame_->T_f_w_.se2().translation()(1),new_frame_->T_f_w_.pitch(),sfba_n_edges_final,time_); new_frame_->T_f_w_ =result.second; diff --git a/GPU_version/vio/src/matcher.cpp b/GPU_version/vio/src/matcher.cpp index 0b9b9f7..ec16cd3 100644 --- a/GPU_version/vio/src/matcher.cpp +++ b/GPU_version/vio/src/matcher.cpp @@ -189,7 +189,7 @@ bool Matcher::findEpipolarMatchDirect( double& depth) { if(isnan(d_min) || isnan(d_max))return false; - SE2_5 T_cur_ref(SE2(cur_frame.T_f_w_.pitch() - ref_frame.T_f_w_.pitch(),cur_frame.T_f_w_.se2().translation() - ref_frame.T_f_w_.se2().translation())); + SE2_5 T_cur_ref(cur_frame.T_f_w_.se2() * ref_frame.T_f_w_.inverse()); int zmssd_best = PatchScore::threshold(); Vector2d uv_best; diff --git a/GPU_version/vio/src/sparse_img_align.cpp b/GPU_version/vio/src/sparse_img_align.cpp index ee58082..128be16 100644 --- a/GPU_version/vio/src/sparse_img_align.cpp +++ b/GPU_version/vio/src/sparse_img_align.cpp @@ -53,7 +53,7 @@ size_t SparseImgAlign::run(FramePtr ref_frame, FramePtr cur_frame) cur_frame_ = cur_frame; ref_patch_cache_ = cv::Mat(ref_frame_->fts_.size(), patch_area_, CV_32F); jacobian_cache_.resize(Eigen::NoChange, ref_patch_cache_.rows*patch_area_); - SE2 T_cur_from_ref(SE2(cur_frame->T_f_w_.pitch() - ref_frame->T_f_w_.pitch(),cur_frame->T_f_w_.se2().translation() - ref_frame->T_f_w_.se2().translation())); + SE2 T_cur_from_ref(cur_frame_->T_f_w_.se2() * ref_frame_->T_f_w_.inverse()); for(level_=max_level_; level_>=min_level_; --level_) { visible_fts_.resize(ref_patch_cache_.rows, false); // TODO: should it be reset at each level?