Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
wolf
Commits
7a0a5a09
Commit
7a0a5a09
authored
3 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
working on processor gtest
parent
3a1b1bbe
No related branches found
No related tags found
1 merge request
!419
Resolve "Processor motion model"
Pipeline
#6750
failed
3 years ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/processor/processor_fix_wing_model.cpp
+3
-0
3 additions, 0 deletions
src/processor/processor_fix_wing_model.cpp
test/CMakeLists.txt
+4
-0
4 additions, 0 deletions
test/CMakeLists.txt
test/gtest_processor_fix_wing_model.cpp
+29
-128
29 additions, 128 deletions
test/gtest_processor_fix_wing_model.cpp
with
36 additions
and
128 deletions
src/processor/processor_fix_wing_model.cpp
+
3
−
0
View file @
7a0a5a09
...
...
@@ -34,6 +34,9 @@ void ProcessorFixWingModel::processKeyFrame(FrameBasePtr _keyframe_ptr, const do
if
(
_keyframe_ptr
->
getV
()
->
isFixed
())
return
;
if
(
_keyframe_ptr
->
getFactorOf
(
shared_from_this
())
!=
nullptr
)
return
;
// emplace capture
auto
cap
=
CaptureBase
::
emplace
<
CaptureBase
>
(
_keyframe_ptr
,
"CaptureBase"
,
_keyframe_ptr
->
getTimeStamp
(),
getSensor
());
...
...
This diff is collapsed.
Click to expand it.
test/CMakeLists.txt
+
4
−
0
View file @
7a0a5a09
...
...
@@ -234,6 +234,10 @@ wolf_add_gtest(gtest_param_prior gtest_param_prior.cpp)
target_link_libraries
(
gtest_param_prior
${
PLUGIN_NAME
}
)
# ProcessorDiffDriveSelfcalib class test
wolf_add_gtest
(
gtest_processor_fix_wing_model gtest_processor_fix_wing_model.cpp
)
target_link_libraries
(
gtest_processor_fix_wing_model
${
PLUGIN_NAME
}
)
# ProcessorFixWingModel class test
wolf_add_gtest
(
gtest_processor_diff_drive gtest_processor_diff_drive.cpp
)
target_link_libraries
(
gtest_processor_diff_drive
${
PLUGIN_NAME
}
)
...
...
This diff is collapsed.
Click to expand it.
test/gtest_processor_fix_wing_model.cpp
+
29
−
128
View file @
7a0a5a09
...
...
@@ -55,155 +55,56 @@ TEST_F(ProcessorFixWingModelTest, setup)
EXPECT_TRUE
(
problem
->
check
());
}
TEST_F
(
ProcessorFixWingModelTest
,
frame_stored
)
TEST_F
(
ProcessorFixWingModelTest
,
keyFrameCallback
)
{
// new frame
auto
frm1
=
emplaceFrame
(
1
,
Vector3d
::
Zero
());
// keyframecallback
problem
->
keyFrameCallback
(
frm1
,
nullptr
,
0.5
);
EXPECT_EQ
(
processor
->
getNStoredFrames
(),
1
);
EXPECT_EQ
(
processor
->
getNStoredCaptures
(),
0
);
}
TEST_F
(
ProcessorFixWingModelTest
,
capture_stored
)
{
// new capture
auto
cap1
=
createCapture
(
1
);
// captureCallback
processor
->
captureCallback
(
cap1
);
EXPECT_EQ
(
processor
->
getNStoredFrames
(),
0
);
EXPECT_EQ
(
processor
->
getNStoredCaptures
(),
1
);
}
TEST_F
(
ProcessorFixWingModelTest
,
captureCallbackCase1
)
{
// emplace frame and capture
auto
frm1
=
emplaceFrame
(
1
,
Vector3d
::
Zero
());
auto
cap1
=
emplaceCapture
(
frm1
);
// captureCallback
processor
->
captureCallback
(
cap1
);
EXPECT_EQ
(
cap1
->
getFeatureList
().
size
(),
1
);
// capture processed by the processor
EXPECT_EQ
(
processor
->
getNStoredFrames
(),
0
);
EXPECT_EQ
(
processor
->
getNStoredCaptures
(),
0
);
}
TEST_F
(
ProcessorFixWingModelTest
,
captureCallbackCase2
)
{
// new frame
auto
frm1
=
emplaceFrame
(
1
,
Vector3d
::
Zero
());
// new capture
auto
cap1
=
createCapture
(
1
);
// keyframecallback
problem
->
keyFrameCallback
(
frm1
,
nullptr
,
0.5
);
// captureCallback
processor
->
captureCallback
(
cap1
);
EXPECT_EQ
(
cap1
->
getFrame
(),
frm1
);
// capture processed by the processor
EXPECT_EQ
(
cap1
->
getFeatureList
().
size
(),
1
);
// capture processed by the processor
EXPECT_EQ
(
processor
->
getNStoredFrames
(),
0
);
EXPECT_EQ
(
processor
->
getNStoredCaptures
(),
0
);
}
TEST_F
(
ProcessorFixWingModelTest
,
captureCallbackCase3
)
{
// new frame
auto
frm1
=
emplaceFrame
(
1
,
Vector3d
::
Zero
());
// new capture
auto
cap1
=
createCapture
(
2
);
auto
frm1
=
emplaceFrame
(
1
,
(
Vector10d
()
<<
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
).
finished
());
// keyframecallback
problem
->
keyFrameCallback
(
frm1
,
nullptr
,
0.5
);
// captureCallback
processor
->
captureCallback
(
cap1
);
EXPECT_TRUE
(
cap1
->
getFrame
()
==
nullptr
);
EXPECT_EQ
(
cap1
->
getFeatureList
().
size
(),
0
);
EXPECT_EQ
(
processor
->
getNStoredFrames
(),
1
);
EXPECT_EQ
(
processor
->
getNStoredCaptures
(),
1
);
}
// check one capture
ASSERT_EQ
(
frm1
->
getCapturesOf
(
sensor
).
size
(),
1
);
auto
cap
=
frm1
->
getCaptureOf
(
sensor
);
ASSERT_TRUE
(
cap
!=
nullptr
);
TEST_F
(
ProcessorFixWingModelTest
,
keyFrameCallbackCase1
)
{
// emplace frame and capture
auto
frm1
=
emplaceFrame
(
1
,
Vector3d
::
Zero
());
auto
cap1
=
emplaceCapture
(
frm1
);
// keyframecallback
problem
->
keyFrameCallback
(
frm1
,
nullptr
,
0.5
);
// check one feature
ASSERT_EQ
(
cap
->
getFeatureList
().
size
(),
1
);
EXPECT_EQ
(
cap1
->
getFeatureList
().
size
(),
1
);
// capture processed by the processor
EXPECT_EQ
(
processor
->
getNStoredFrames
(),
0
);
EXPECT_EQ
(
processor
->
getNStoredCaptures
(),
0
);
// check one factor
auto
fac
=
frm1
->
getFactorOf
(
processor
,
"FactorVelocityLocalDirection3d"
);
ASSERT_TRUE
(
fac
!=
nullptr
);
ASSERT_TRUE
(
fac
->
getFeature
()
!=
nullptr
);
ASSERT_TRUE
(
fac
->
getCapture
()
==
frm1
->
getCaptureOf
(
sensor
));
}
TEST_F
(
ProcessorFixWingModelTest
,
keyFrameCallback
Case2
)
TEST_F
(
ProcessorFixWingModelTest
,
keyFrameCallback
Repeated
)
{
// new frame
auto
frm1
=
emplaceFrame
(
1
,
Vector3d
::
Zero
());
// new capture
auto
cap1
=
createCapture
(
1
);
// captureCallback
processor
->
captureCallback
(
cap1
);
auto
frm1
=
emplaceFrame
(
1
,
(
Vector10d
()
<<
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
).
finished
());
// keyframecallback
problem
->
keyFrameCallback
(
frm1
,
nullptr
,
0.5
);
EXPECT_EQ
(
cap1
->
getFrame
(),
frm1
);
// capture processed by the processor
EXPECT_EQ
(
cap1
->
getFeatureList
().
size
(),
1
);
// capture processed by the processor
EXPECT_EQ
(
processor
->
getNStoredFrames
(),
0
);
EXPECT_EQ
(
processor
->
getNStoredCaptures
(),
0
);
}
TEST_F
(
ProcessorFixWingModelTest
,
keyFrameCallbackCase3
)
{
// new frame
auto
frm1
=
emplaceFrame
(
2
,
Vector3d
::
Zero
());
// new capture
auto
cap1
=
createCapture
(
1
);
// captureCallback
processor
->
captureCallback
(
cap1
);
// keyframecallback
// repeated keyframecallback
problem
->
keyFrameCallback
(
frm1
,
nullptr
,
0.5
);
EXPECT_TRUE
(
cap1
->
getFrame
()
==
nullptr
);
EXPECT_EQ
(
cap1
->
getFeatureList
().
size
(),
0
);
EXPECT_EQ
(
processor
->
getNStoredFrames
(),
1
);
EXPECT_EQ
(
processor
->
getNStoredCaptures
(),
1
);
}
// check one capture
ASSERT_EQ
(
frm1
->
getCapturesOf
(
sensor
).
size
(),
1
);
auto
cap
=
frm1
->
getCaptureOf
(
sensor
);
ASSERT_TRUE
(
cap
!=
nullptr
);
TEST_F
(
ProcessorFixWingModelTest
,
keyFrameCallbackCase4
)
{
// new frame
auto
frm1
=
emplaceFrame
(
1
,
Vector3d
::
Zero
());
// new capture
auto
cap1
=
createCapture
(
2
);
// captureCallback
processor
->
captureCallback
(
cap1
);
// check one feature
ASSERT_EQ
(
cap
->
getFeatureList
().
size
(),
1
);
// keyframecallback
problem
->
keyFrameCallback
(
frm1
,
nullptr
,
0.5
);
EXPECT_TRUE
(
cap1
->
getFrame
()
==
nullptr
);
EXPECT_EQ
(
cap1
->
getFeatureList
().
size
(),
0
);
EXPECT_EQ
(
processor
->
getNStoredFrames
(),
0
);
EXPECT_EQ
(
processor
->
getNStoredCaptures
(),
1
);
// check one factor
auto
fac
=
frm1
->
getFactorOf
(
processor
,
"FactorVelocityLocalDirection3d"
);
ASSERT_TRUE
(
fac
!=
nullptr
);
ASSERT_TRUE
(
fac
->
getFeature
()
!=
nullptr
);
ASSERT_TRUE
(
fac
->
getCapture
()
==
frm1
->
getCaptureOf
(
sensor
));
}
TEST_F
(
ProcessorFixWingModelTest
,
captureCallbackMatch
)
/*
TEST_F(ProcessorFixWingModelTest, captureCallbackMatch)
{
// new frame
auto frm1 = emplaceFrame(1, Vector3d::Zero());
...
...
@@ -305,7 +206,7 @@ TEST_F(ProcessorFixWingModelTest, emplaceFactors)
EXPECT_EQ(cap4->getFeatureList().front()->getFactorList().size(), 1);
EXPECT_EQ(cap1->getFrame()->getConstrainedByList().front(), cap4->getFeatureList().front()->getFactorList().front());
}
}
*/
int
main
(
int
argc
,
char
**
argv
)
{
...
...
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