Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
objectslam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
plugins
objectslam
Commits
687ddf7c
Commit
687ddf7c
authored
3 years ago
by
Mederic Fourmy
Browse files
Options
Downloads
Patches
Plain Diff
Refactor voteForKeyframe
parent
273eadad
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Resolve "Adapt to core cmake refactor"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/processor/processor_tracker_landmark_object.cpp
+46
-29
46 additions, 29 deletions
src/processor/processor_tracker_landmark_object.cpp
with
46 additions
and
29 deletions
src/processor/processor_tracker_landmark_object.cpp
+
46
−
29
View file @
687ddf7c
...
@@ -161,25 +161,43 @@ unsigned int ProcessorTrackerLandmarkObject::detectNewFeatures(const int& _max_n
...
@@ -161,25 +161,43 @@ unsigned int ProcessorTrackerLandmarkObject::detectNewFeatures(const int& _max_n
bool
ProcessorTrackerLandmarkObject
::
voteForKeyFrame
()
const
bool
ProcessorTrackerLandmarkObject
::
voteForKeyFrame
()
const
{
{
WOLF_INFO
(
"voteForKeyFrame"
)
WOLF_INFO
(
"voteForKeyFrame"
)
// if no detections in last capture, no case where it is usefull to create a KF from last
if
(
detections_last_
.
empty
())
return
false
;
auto
origin
=
getOrigin
();
auto
incoming
=
getIncoming
();
// A few variables to examine the state of the system
// Feature detection wise
bool
too_few_detections_last
=
detections_last_
.
size
()
<
min_features_for_keyframe_
;
bool
too_few_detections_incoming
=
detections_incoming_
.
size
()
<
min_features_for_keyframe_
;
// Feature-Landmark matching wise
// TODO:
// Ideally we would need to use the size of the output of findLandmarks: _features_out
// -> number of matched features after processKnown
// Stored in matches_landmark_from_incoming_ (ProcessorTrackerLandmark)
// Time wise
double
dt_incoming_origin
=
getIncoming
()
->
getTimeStamp
().
get
()
-
getOrigin
()
->
getTimeStamp
().
get
();
double
dt_incoming_origin
=
getIncoming
()
->
getTimeStamp
().
get
()
-
getOrigin
()
->
getTimeStamp
().
get
();
WOLF_INFO
(
origin
->
id
(),
" -> "
,
incoming
->
id
(),
" dt : "
,
dt_incoming_origin
)
bool
enough_time_vote
=
dt_incoming_origin
>
min_time_vote_
;
bool
enough_time_vote
=
dt_incoming_origin
>
min_time_vote_
;
bool
too_long_since_last_KF
=
dt_incoming_origin
>
max_time_vote_
;
bool
too_long_since_origin_KF
=
dt_incoming_origin
>
max_time_vote_
;
WOLF_INFO
(
getOrigin
()
->
id
(),
" -> "
,
getIncoming
()
->
id
(),
" dt : "
,
dt_incoming_origin
)
// the elapsed time since last KF is too long
if
(
too_long_since_last_KF
){
// if not enough detections in LAST capture for some reason, useless to create a KF from LAST
return
true
;
if
(
too_few_detections_last
)
{
WOLF_DEBUG
(
"Not enough features in last to vote: "
,
detections_last_
.
size
(),
" < "
,
min_features_for_keyframe_
)
return
false
;
}
}
// no detection in incoming capture and a minimum time since last KF has past
// voting needs to be done, after checking there is enough features in LAST to vote
if
((
detections_incoming_
.
size
()
<
min_features_for_keyframe_
)
and
enough_time_vote
){
// 2 cases in which we want to vote for a Keyframe:
// - number of detections in INCOMING are too few and enough time has passed since ORIGIN
if
(
enough_time_vote
&&
too_few_detections_incoming
){
return
true
;
}
// - the time elapsed since ORIGIN is too long
if
(
too_long_since_origin_KF
){
return
true
;
return
true
;
}
}
...
@@ -196,10 +214,25 @@ unsigned int ProcessorTrackerLandmarkObject::findLandmarks(const LandmarkBasePtr
...
@@ -196,10 +214,25 @@ unsigned int ProcessorTrackerLandmarkObject::findLandmarks(const LandmarkBasePtr
FeatureBasePtrList
&
_features_out
,
FeatureBasePtrList
&
_features_out
,
LandmarkMatchMap
&
_feature_landmark_correspondences
)
LandmarkMatchMap
&
_feature_landmark_correspondences
)
{
{
// world to rob
Vector3d
pos_rob
=
getLast
()
->
getFrame
()
->
getP
()
->
getState
();
Quaterniond
quat_rob
(
getLast
()
->
getFrame
()
->
getO
()
->
getState
().
data
());
Eigen
::
Isometry3d
w_M_r
=
Eigen
::
Translation
<
double
,
3
>
(
pos_rob
.
head
(
3
))
*
quat_rob
;
// rob to sensor
Vector3d
pos_sen
=
getSensor
()
->
getP
()
->
getState
();
Quaterniond
quat_sen
(
getSensor
()
->
getO
()
->
getState
().
data
());
Eigen
::
Isometry3d
r_M_c
=
Eigen
::
Translation
<
double
,
3
>
(
pos_sen
.
head
(
3
))
*
quat_sen
;
for
(
auto
feat
:
detections_incoming_
)
for
(
auto
feat
:
detections_incoming_
)
{
{
std
::
string
object_type
=
std
::
static_pointer_cast
<
FeatureObject
>
(
feat
)
->
getObjectType
();
std
::
string
object_type
=
std
::
static_pointer_cast
<
FeatureObject
>
(
feat
)
->
getObjectType
();
// camera to feat
Vector3d
pos_obj
=
feat
->
getMeasurement
().
head
(
3
);
Quaterniond
quat_obj
(
feat
->
getMeasurement
().
tail
(
4
).
data
());
Eigen
::
Isometry3d
c_M_f
=
Eigen
::
Translation
<
double
,
3
>
(
pos_obj
)
*
quat_obj
;
if
(
feat
->
getCapture
()
!=
nullptr
){
if
(
feat
->
getCapture
()
!=
nullptr
){
break
;
break
;
}
}
...
@@ -210,22 +243,6 @@ unsigned int ProcessorTrackerLandmarkObject::findLandmarks(const LandmarkBasePtr
...
@@ -210,22 +243,6 @@ unsigned int ProcessorTrackerLandmarkObject::findLandmarks(const LandmarkBasePtr
if
(
lmk_obj
!=
nullptr
and
lmk_obj
->
getObjectType
()
==
object_type
)
if
(
lmk_obj
!=
nullptr
and
lmk_obj
->
getObjectType
()
==
object_type
)
{
{
// world to rob
Vector3d
pos
=
getLast
()
->
getFrame
()
->
getP
()
->
getState
();
Quaterniond
quat
(
getLast
()
->
getFrame
()
->
getO
()
->
getState
().
data
());
Eigen
::
Isometry3d
w_M_r
=
Eigen
::
Translation
<
double
,
3
>
(
pos
.
head
(
3
))
*
quat
;
// rob to sensor
pos
=
getSensor
()
->
getP
()
->
getState
();
quat
.
coeffs
()
=
getSensor
()
->
getO
()
->
getState
();
Eigen
::
Isometry3d
r_M_c
=
Eigen
::
Translation
<
double
,
3
>
(
pos
.
head
(
3
))
*
quat
;
// camera to feat
pos
=
feat
->
getMeasurement
().
head
(
3
);
quat
.
coeffs
()
=
feat
->
getMeasurement
().
tail
(
4
);
Eigen
::
Isometry3d
c_M_f
=
Eigen
::
Translation
<
double
,
3
>
(
pos
)
*
quat
;
// world to feat
// world to feat
Eigen
::
Isometry3d
w_M_f
=
w_M_r
*
r_M_c
*
c_M_f
;
Eigen
::
Isometry3d
w_M_f
=
w_M_r
*
r_M_c
*
c_M_f
;
Quaterniond
quat_feat
;
Quaterniond
quat_feat
;
...
@@ -243,7 +260,7 @@ unsigned int ProcessorTrackerLandmarkObject::findLandmarks(const LandmarkBasePtr
...
@@ -243,7 +260,7 @@ unsigned int ProcessorTrackerLandmarkObject::findLandmarks(const LandmarkBasePtr
if
(
e_rot
<
e_rot_thr_
&&
e_pos
<
e_pos_thr_
){
if
(
e_rot
<
e_rot_thr_
&&
e_pos
<
e_pos_thr_
){
_features_out
.
push_back
(
feat
);
_features_out
.
push_back
(
feat
);
double
score
(
1.0
);
double
score
(
1.0
);
// not used
LandmarkMatchPtr
matched_landmark
=
std
::
make_shared
<
LandmarkMatch
>
(
lmk
,
score
);
LandmarkMatchPtr
matched_landmark
=
std
::
make_shared
<
LandmarkMatch
>
(
lmk
,
score
);
_feature_landmark_correspondences
.
emplace
(
feat
,
matched_landmark
);
_feature_landmark_correspondences
.
emplace
(
feat
,
matched_landmark
);
feat
->
link
(
_capture
);
// since all features are created in preProcess() are unlinked
feat
->
link
(
_capture
);
// since all features are created in preProcess() are unlinked
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment