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
62eb85df
Commit
62eb85df
authored
6 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Use the new interpolate() with two outputs
parent
d30ce44d
No related branches found
No related tags found
1 merge request
!248
Feature/proc motion
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/processor_odom_2D.cpp
+5
-0
5 additions, 0 deletions
src/processor_odom_2D.cpp
src/processor_odom_2D.h
+4
-0
4 additions, 0 deletions
src/processor_odom_2D.h
src/test/gtest_processor_motion.cpp
+60
-0
60 additions, 0 deletions
src/test/gtest_processor_motion.cpp
with
69 additions
and
0 deletions
src/processor_odom_2D.cpp
+
5
−
0
View file @
62eb85df
...
...
@@ -114,6 +114,11 @@ Motion ProcessorOdom2D::interpolate(const Motion& _ref, Motion& _second, TimeSta
}
Motion
ProcessorOdom2D
::
interpolate
(
const
Motion
&
_ref1
,
const
Motion
&
_ref2
,
const
TimeStamp
&
_ts
,
Motion
&
_second
)
{
return
ProcessorMotion
::
interpolate
(
_ref1
,
_ref2
,
_ts
,
_second
);
}
bool
ProcessorOdom2D
::
voteForKeyFrame
()
{
// Distance criterion
...
...
This diff is collapsed.
Click to expand it.
src/processor_odom_2D.h
+
4
−
0
View file @
62eb85df
...
...
@@ -60,6 +60,10 @@ class ProcessorOdom2D : public ProcessorMotion
virtual
Motion
interpolate
(
const
Motion
&
_ref
,
Motion
&
_second
,
TimeStamp
&
_ts
)
override
;
virtual
Motion
interpolate
(
const
Motion
&
_ref1
,
const
Motion
&
_ref2
,
const
TimeStamp
&
_ts
,
Motion
&
_second
);
virtual
CaptureMotionPtr
createCapture
(
const
TimeStamp
&
_ts
,
const
SensorBasePtr
&
_sensor
,
...
...
This diff is collapsed.
Click to expand it.
src/test/gtest_processor_motion.cpp
+
60
−
0
View file @
62eb85df
...
...
@@ -54,6 +54,17 @@ class ProcessorMotion_test : public ProcessorOdom2D, public testing::Test{
problem
->
setPrior
(
x0
,
P0
,
0.0
,
0.01
);
}
Motion
interpolate
(
const
Motion
&
_ref
,
Motion
&
_second
,
TimeStamp
&
_ts
)
{
return
ProcessorMotion
::
interpolate
(
_ref
,
_second
,
_ts
);
}
Motion
interpolate
(
const
Motion
&
_ref1
,
const
Motion
&
_ref2
,
const
TimeStamp
&
_ts
,
Motion
&
_second
)
{
return
ProcessorMotion
::
interpolate
(
_ref1
,
_ref2
,
_ts
,
_second
);
}
virtual
void
TearDown
(){}
};
...
...
@@ -135,6 +146,55 @@ TEST_F(ProcessorMotion_test, Interpolate)
ASSERT_MATRIX_APPROX
(
interp
.
delta_integr_
,
motions
[
3
].
delta_integr_
,
1e-8
);
}
TEST_F
(
ProcessorMotion_test
,
Interpolate_alternative
)
{
data
<<
1
,
2
*
M_PI
/
10
;
// advance in turn
data_cov
.
setIdentity
();
TimeStamp
t
(
0.0
);
std
::
vector
<
Motion
>
motions
;
motions
.
push_back
(
motionZero
(
t
));
for
(
int
i
=
0
;
i
<
10
;
i
++
)
// one full turn exactly
{
t
+=
dt
;
capture
->
setTimeStamp
(
t
);
capture
->
setData
(
data
);
capture
->
setDataCovariance
(
data_cov
);
processor
->
process
(
capture
);
motions
.
push_back
(
processor
->
getMotion
(
t
));
WOLF_DEBUG
(
"t: "
,
t
,
" x: "
,
problem
->
getCurrentState
().
transpose
());
}
TimeStamp
tt
=
2.2
;
Motion
ref1
=
motions
[
2
];
Motion
ref2
=
motions
[
3
];
Motion
second
(
0.0
,
2
,
3
,
3
,
0
);
Motion
interp
=
interpolate
(
ref1
,
ref2
,
tt
,
second
);
ASSERT_NEAR
(
interp
.
ts_
.
get
()
,
2.2
,
1e-8
);
ASSERT_MATRIX_APPROX
(
interp
.
data_
,
VectorXs
::
Zero
(
2
)
,
1e-8
);
ASSERT_MATRIX_APPROX
(
interp
.
delta_
,
VectorXs
::
Zero
(
3
)
,
1e-8
);
ASSERT_MATRIX_APPROX
(
interp
.
delta_integr_
,
motions
[
2
].
delta_integr_
,
1e-8
);
ASSERT_NEAR
(
second
.
ts_
.
get
()
,
3.0
,
1e-8
);
ASSERT_MATRIX_APPROX
(
second
.
data_
,
motions
[
3
].
data_
,
1e-8
);
ASSERT_MATRIX_APPROX
(
second
.
delta_
,
motions
[
3
].
delta_
,
1e-8
);
ASSERT_MATRIX_APPROX
(
second
.
delta_integr_
,
motions
[
3
].
delta_integr_
,
1e-8
);
tt
=
2.6
;
interp
=
interpolate
(
ref1
,
ref2
,
tt
,
second
);
ASSERT_NEAR
(
interp
.
ts_
.
get
()
,
2.6
,
1e-8
);
ASSERT_MATRIX_APPROX
(
interp
.
data_
,
motions
[
3
].
data_
,
1e-8
);
ASSERT_MATRIX_APPROX
(
interp
.
delta_
,
motions
[
3
].
delta_
,
1e-8
);
ASSERT_MATRIX_APPROX
(
interp
.
delta_integr_
,
motions
[
3
].
delta_integr_
,
1e-8
);
ASSERT_NEAR
(
second
.
ts_
.
get
()
,
3.0
,
1e-8
);
ASSERT_MATRIX_APPROX
(
second
.
data_
,
VectorXs
::
Zero
(
2
)
,
1e-8
);
ASSERT_MATRIX_APPROX
(
second
.
delta_
,
VectorXs
::
Zero
(
3
)
,
1e-8
);
ASSERT_MATRIX_APPROX
(
second
.
delta_integr_
,
motions
[
3
].
delta_integr_
,
1e-8
);
}
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
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