Skip to content

Commit ea067a5

Browse files
committed
add loop use threshold
1 parent 1236fa7 commit ea067a5

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

VINS_ios/ViewController.mm

+6
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,12 @@ -(void)process
746746
if(vins.Headers[i] == vins.front_pose.header)
747747
{
748748
KeyFrame* cur_kf = keyframe_database.getKeyframe(vins.front_pose.cur_index);
749+
if (abs(vins.front_pose.relative_yaw) > 30.0 || vins.front_pose.relative_t.norm() > 10.0)
750+
{
751+
printf("Wrong loop\n");
752+
cur_kf->removeLoop();
753+
break;
754+
}
749755
cur_kf->updateLoopConnection(vins.front_pose.relative_t,
750756
vins.front_pose.relative_q,
751757
vins.front_pose.relative_yaw);

VINS_ios/loop/keyframe.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,11 @@ void KeyFrame::detectLoop(int index)
359359
loop_index = index;
360360
}
361361

362+
void KeyFrame::removeLoop()
363+
{
364+
has_loop = false;
365+
}
366+
362367
int KeyFrame::HammingDis(const BRIEF::bitset &a, const BRIEF::bitset &b)
363368
{
364369
BRIEF::bitset xor_of_bitset = a ^ b;

VINS_ios/loop/keyframe.h

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ class KeyFrame
8686

8787
void detectLoop(int index);
8888

89+
void removeLoop();
90+
8991
int HammingDis(const BRIEF::bitset &a, const BRIEF::bitset &b);
9092

9193
// data

0 commit comments

Comments
 (0)