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
a43e7415
Commit
a43e7415
authored
5 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Fix PM::getState(structure)
parent
dd750ad5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!379
Resolve "Problem::getState(structure) doesn't care about structure"
Pipeline
#5686
canceled
5 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/processor/processor_motion.cpp
+18
-8
18 additions, 8 deletions
src/processor/processor_motion.cpp
test/gtest_processor_motion.cpp
+30
-0
30 additions, 0 deletions
test/gtest_processor_motion.cpp
with
48 additions
and
8 deletions
src/processor/processor_motion.cpp
+
18
−
8
View file @
a43e7415
...
...
@@ -491,11 +491,16 @@ VectorComposite ProcessorMotion::getState(const StateStructure& _structure) cons
else
{
// remove states not requested
for
(
const
auto
&
pair_key_vec
:
state
)
// remove states not requested by structure
auto
pair_key_vec_it
=
state
.
begin
();
while
(
pair_key_vec_it
!=
state
.
end
())
{
if
(
_structure
.
find
(
pair_key_vec
.
first
)
==
std
::
string
::
npos
)
state
.
erase
(
pair_key_vec
.
first
);
if
(
_structure
.
find
(
pair_key_vec_it
->
first
)
==
std
::
string
::
npos
)
pair_key_vec_it
=
state
.
erase
(
pair_key_vec_it
);
else
pair_key_vec_it
++
;
}
return
state
;
}
...
...
@@ -581,11 +586,16 @@ VectorComposite ProcessorMotion::getState(const TimeStamp& _ts, const StateStruc
else
{
// remove states not requested
for
(
const
auto
&
pair_key_vec
:
state
)
// remove states not requested by structure
auto
pair_key_vec_it
=
state
.
begin
();
while
(
pair_key_vec_it
!=
state
.
end
())
{
if
(
_structure
.
find
(
pair_key_vec
.
first
)
==
std
::
string
::
npos
)
state
.
erase
(
pair_key_vec
.
first
);
if
(
_structure
.
find
(
pair_key_vec_it
->
first
)
==
std
::
string
::
npos
)
pair_key_vec_it
=
state
.
erase
(
pair_key_vec_it
);
else
pair_key_vec_it
++
;
}
return
state
;
}
...
...
This diff is collapsed.
Click to expand it.
test/gtest_processor_motion.cpp
+
30
−
0
View file @
a43e7415
...
...
@@ -101,6 +101,36 @@ TEST_F(ProcessorMotion_test, IntegrateStraightAutoPrior)
ASSERT_MATRIX_APPROX
(
problem
->
getState
().
vector
(
"PO"
),
(
Vector3d
()
<<
9
,
0
,
0
).
finished
(),
1e-8
);
}
TEST_F
(
ProcessorMotion_test
,
getState_structure
)
{
// Prior
Vector3d
x0
;
x0
<<
0
,
0
,
0
;
Matrix3d
P0
;
P0
.
setIdentity
();
data
<<
1
,
0
;
// advance straight
data_cov
.
setIdentity
();
TimeStamp
t
(
0.0
);
for
(
int
i
=
0
;
i
<
9
;
i
++
)
{
t
+=
dt
;
capture
->
setTimeStamp
(
t
);
capture
->
setData
(
data
);
capture
->
setDataCovariance
(
data_cov
);
processor
->
captureCallback
(
capture
);
WOLF_DEBUG
(
"t: "
,
t
,
" x: "
,
problem
->
getState
().
vector
(
"PO"
).
transpose
());
}
ASSERT_TRUE
(
processor
->
getState
(
"P"
).
count
(
"P"
));
ASSERT_FALSE
(
processor
->
getState
(
"P"
).
count
(
"O"
));
ASSERT_FALSE
(
processor
->
getState
(
"O"
).
count
(
"P"
));
ASSERT_TRUE
(
processor
->
getState
(
"O"
).
count
(
"O"
));
WOLF_DEBUG
(
"processor->getState(
\"
V
\"
) = "
,
processor
->
getState
(
"V"
));
ASSERT_EQ
(
processor
->
getState
(
"V"
).
size
(),
0
);
}
TEST_F
(
ProcessorMotion_test
,
IntegrateStraightFactorPrior
)
{
...
...
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