Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
laser_scan_utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
labrobotica
algorithms
laser_scan_utils
Commits
cdec0e4b
Commit
cdec0e4b
authored
4 years ago
by
Sergi Pujol
Browse files
Options
Downloads
Patches
Plain Diff
code guidelines applyied
parent
3f2caf0e
No related branches found
No related tags found
1 merge request
!4
Resolve "Implementation of Falko lib"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/loop_closure_falko.h
+18
-18
18 additions, 18 deletions
src/loop_closure_falko.h
test/gtest_loop_closure_falko.cpp
+19
-57
19 additions, 57 deletions
test/gtest_loop_closure_falko.cpp
with
37 additions
and
75 deletions
src/loop_closure_falko.h
+
18
−
18
View file @
cdec0e4b
...
@@ -105,16 +105,16 @@ public:
...
@@ -105,16 +105,16 @@ public:
/** \brief Create and update the scene struct with keypoints and descriptors
/** \brief Create and update the scene struct with keypoints and descriptors
**/
**/
sceneFalkoBSCPtr
extractScene
(
LaserScan
&
scan
,
LaserScanParams
&
scan
P
arams
)
{
sceneFalkoBSCPtr
extractScene
(
LaserScan
&
_
scan
,
LaserScanParams
&
_
scan
_p
arams
)
{
auto
new
S
cene
=
std
::
make_shared
<
sceneFalko
<
D
>>
();
auto
new
_s
cene
=
std
::
make_shared
<
sceneFalko
<
D
>>
();
auto
scan
FALKO
=
auto
scan
_falko
=
loopClosureFalko
<
D
,
Extr
,
M
>::
convert2LaserScanFALKO
(
scan
,
scan
P
arams
);
convert2LaserScanFALKO
(
_
scan
,
_
scan
_p
arams
);
// Extract keypoints
// Extract keypoints
extract
(
(
*
scan
FALKO
)
,
(
new
S
cene
->
keypointsList
));
extract
(
*
scan
_falko
,
(
new
_s
cene
->
keypointsList
));
// Compute descriptors
// Compute descriptors
extractor_
.
compute
(
*
scan
FALKO
,
new
S
cene
->
keypointsList
,
extractor_
.
compute
(
*
scan
_falko
,
new
_s
cene
->
keypointsList
,
new
S
cene
->
descriptorsList
);
new
_s
cene
->
descriptorsList
);
return
new
S
cene
;
return
new
_s
cene
;
}
}
/** \brief Convert scans from laserscanutils::LaserScan to
/** \brief Convert scans from laserscanutils::LaserScan to
...
@@ -132,11 +132,11 @@ public:
...
@@ -132,11 +132,11 @@ public:
/** \brief Create and update a matchLoopClosure struct with the info that is
/** \brief Create and update a matchLoopClosure struct with the info that is
*produced when matching two given scenes
*produced when matching two given scenes
**/
**/
matchLoopClosurePtr
matchScene
(
sceneFalkoBSCPtr
scene1
,
matchLoopClosurePtr
matchScene
(
sceneFalkoBSCPtr
_
scene1
,
sceneFalkoBSCPtr
scene2
)
{
sceneFalkoBSCPtr
_
scene2
)
{
std
::
vector
<
std
::
pair
<
int
,
int
>>
asso
NN
;
std
::
vector
<
std
::
pair
<
int
,
int
>>
asso
_nn
;
int
matching_number
=
int
matching_number
=
matcher_
.
match
(
scene1
->
keypointsList
,
scene2
->
keypointsList
,
asso
NN
);
matcher_
.
match
(
_
scene1
->
keypointsList
,
_
scene2
->
keypointsList
,
asso
_nn
);
auto
new_match
=
std
::
make_shared
<
matchLoopClosure
<
D
>>
();
auto
new_match
=
std
::
make_shared
<
matchLoopClosure
<
D
>>
();
new_match
->
keypointsNumberMatch
=
matching_number
;
new_match
->
keypointsNumberMatch
=
matching_number
;
if
(
matching_number
>
keypoints_number_th
)
{
if
(
matching_number
>
keypoints_number_th
)
{
...
@@ -144,7 +144,7 @@ public:
...
@@ -144,7 +144,7 @@ public:
}
else
{
}
else
{
new_match
->
match
=
false
;
new_match
->
match
=
false
;
}
}
new_match
->
sceneTuple
=
std
::
make_tuple
(
scene1
,
scene2
);
new_match
->
sceneTuple
=
std
::
make_tuple
(
_
scene1
,
_
scene2
);
return
new_match
;
return
new_match
;
}
}
...
@@ -152,14 +152,14 @@ public:
...
@@ -152,14 +152,14 @@ public:
*closures
*closures
**/
**/
std
::
list
<
matchLoopClosurePtr
>
std
::
list
<
matchLoopClosurePtr
>
findLoopClosure
(
std
::
list
<
sceneFalkoBSCPtr
>
&
l_scenes
,
findLoopClosure
(
std
::
list
<
sceneFalkoBSCPtr
>
&
_
l_scenes
,
const
sceneFalkoBSCPtr
&
new_scene
)
{
const
sceneFalkoBSCPtr
&
_
new_scene
)
{
int
number_ref_sc
=
l_scenes
.
size
();
int
number_ref_sc
=
_
l_scenes
.
size
();
std
::
list
<
matchLoopClosurePtr
>
matchings
;
std
::
list
<
matchLoopClosurePtr
>
matchings
;
for
(
int
i
=
0
;
i
<
number_ref_sc
;
i
++
)
{
for
(
int
i
=
0
;
i
<
number_ref_sc
;
i
++
)
{
auto
l_front
=
l_scenes
.
begin
();
auto
l_front
=
_
l_scenes
.
begin
();
std
::
advance
(
l_front
,
i
);
std
::
advance
(
l_front
,
i
);
auto
new_match
=
matchScene
(
*
l_front
,
new_scene
);
auto
new_match
=
matchScene
(
*
l_front
,
_
new_scene
);
matchings
.
push_back
(
new_match
);
matchings
.
push_back
(
new_match
);
}
}
return
matchings
;
return
matchings
;
...
...
This diff is collapsed.
Click to expand it.
test/gtest_loop_closure_falko.cpp
+
19
−
57
View file @
cdec0e4b
...
@@ -6,89 +6,51 @@
...
@@ -6,89 +6,51 @@
using
namespace
laserscanutils
;
using
namespace
laserscanutils
;
TEST
(
loop_closure_falko
,
TestLoopClosureFalkoAllFunctions
)
{
TEST
(
loop_closure_falko
,
TestLoopClosureFalkoAllFunctions
)
{
int
scanSize
=
1440
;
// Initialization
int
scan_size
=
1440
;
LaserScan
scan
;
LaserScan
scan
;
LaserScanParams
laserParams
;
LaserScanParams
laser_params
;
laser_params
.
angle_min_
=
0
;
laserParams
.
angle_min_
=
0
;
laser_params
.
angle_max_
=
2.0
*
M_PI
;
laserParams
.
angle_max_
=
2.0
*
M_PI
;
for
(
int
i
=
0
;
i
<
scan_size
;
i
++
)
{
for
(
int
i
=
0
;
i
<
scanSize
;
i
++
)
{
scan
.
ranges_raw_
.
push_back
(
testRanges1
[
i
]);
scan
.
ranges_raw_
.
push_back
(
testRanges1
[
i
]);
}
}
parameterLoopClosureFalko
param
;
parameterLoopClosureFalko
param
;
loopClosureFalko
<
bsc
,
bscExtractor
,
NNMatcher
>
LCFalko
(
param
);
loopClosureFalko
<
bsc
,
bscExtractor
,
NNMatcher
>
loop_cl_falko
(
param
);
auto
new_scene
=
LCFalko
.
extractScene
(
scan
,
laserParams
);
int
detectedKeypoints
=
((
*
new_scene
).
keypointsList
).
size
();
// Test convert2LaserScanFALKO
std
::
shared_ptr
<
falkolib
::
LaserScan
>
scan_falko
=
loop_cl_falko
.
convert2LaserScanFALKO
(
scan
,
laser_params
);
int
firstPoint
=
scan_falko
->
ranges
[
0
];
ASSERT_EQ
(
firstPoint
,
250
);
// Test extractScene
auto
new_scene
=
loop_cl_falko
.
extractScene
(
scan
,
laser_params
);
int
detectedKeypoints
=
new_scene
->
keypointsList
.
size
();
int
detectedDescriptors
=
new_scene
->
descriptorsList
.
size
();
int
detectedDescriptors
=
new_scene
->
descriptorsList
.
size
();
ASSERT_EQ
(
detectedKeypoints
,
18
);
ASSERT_EQ
(
detectedKeypoints
,
18
);
ASSERT_EQ
(
detectedDescriptors
,
18
);
ASSERT_EQ
(
detectedDescriptors
,
18
);
// Test matcher
// Test matcheScene
auto
new_match
=
loop_cl_falko
.
matchScene
(
new_scene
,
new_scene
);
auto
new_match
=
LCFalko
.
matchScene
(
new_scene
,
new_scene
);
int
keypoints_matched
=
new_match
->
keypointsNumberMatch
;
int
keypoints_matched
=
new_match
->
keypointsNumberMatch
;
ASSERT_EQ
(
keypoints_matched
,
18
);
ASSERT_EQ
(
keypoints_matched
,
18
);
// TEST findLoopClosure
// TEST findLoopClosure
std
::
list
<
std
::
shared_ptr
<
sceneFalko
<
bsc
>>>
ref_scenes
;
std
::
list
<
std
::
shared_ptr
<
sceneFalko
<
bsc
>>>
ref_scenes
;
ref_scenes
.
push_back
(
new_scene
);
ref_scenes
.
push_back
(
new_scene
);
ref_scenes
.
push_back
(
new_scene
);
ref_scenes
.
push_back
(
new_scene
);
auto
matchings
=
loop_cl_falko
.
findLoopClosure
(
ref_scenes
,
new_scene
);
auto
matchings
=
LCFalko
.
findLoopClosure
(
ref_scenes
,
new_scene
);
int
matchings_number
=
matchings
.
size
();
int
matchings_number
=
matchings
.
size
();
ASSERT_EQ
(
matchings_number
,
2
);
ASSERT_EQ
(
matchings_number
,
2
);
auto
l_front
=
matchings
.
begin
();
auto
l_front
=
matchings
.
begin
();
auto
there_is_match
=
l_front
->
get
()
->
match
;
auto
there_is_match
=
l_front
->
get
()
->
match
;
ASSERT_EQ
(
there_is_match
,
true
);
ASSERT_EQ
(
there_is_match
,
true
);
// PRINTF("All good at TestTest::DummyTestExample !\n");
// PRINTF("All good at TestTest::DummyTestExample !\n");
}
}
TEST
(
loop_closure_falko2
,
convert2laserScanFalko
)
{
int
scanSize
=
1440
;
LaserScan
scan
;
LaserScanParams
laserParams
;
laserParams
.
angle_min_
=
0
;
laserParams
.
angle_max_
=
2.0
*
M_PI
;
for
(
int
i
=
0
;
i
<
scanSize
;
i
++
)
{
scan
.
ranges_raw_
.
push_back
(
testRanges1
[
i
]);
}
parameterLoopClosureFalko
param
;
loopClosureFalko
<
bsc
,
bscExtractor
,
NNMatcher
>
LCFalko
(
param
);
std
::
shared_ptr
<
falkolib
::
LaserScan
>
scanFALKO
=
LCFalko
.
convert2LaserScanFALKO
(
scan
,
laserParams
);
int
firstPoint
=
((
*
scanFALKO
).
ranges
)[
0
];
ASSERT_EQ
(
firstPoint
,
250
);
// PRINTF("All good at TestTest::DummyTestExample !\n");
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
return
RUN_ALL_TESTS
();
...
...
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