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
eef62743
Commit
eef62743
authored
4 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Add test Prb::getState()
parent
e685235f
No related branches found
No related tags found
1 merge request
!379
Resolve "Problem::getState(structure) doesn't care about structure"
Pipeline
#5693
canceled
4 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/capture/capture_motion.cpp
+1
-1
1 addition, 1 deletion
src/capture/capture_motion.cpp
test/gtest_problem.cpp
+69
-1
69 additions, 1 deletion
test/gtest_problem.cpp
test/yaml/params_problem_odom_3d.yaml
+44
-0
44 additions, 0 deletions
test/yaml/params_problem_odom_3d.yaml
with
114 additions
and
2 deletions
src/capture/capture_motion.cpp
+
1
−
1
View file @
eef62743
...
...
@@ -60,7 +60,7 @@ bool CaptureMotion::containsTimeStamp (const TimeStamp& _ts, double _time_tolera
// buffer encloses timestamp, if ts is:
// from : origin.tx + tt not included
// to : capture.ts + tt included
if
(
this
->
getOriginCapture
()
->
getTimeStamp
()
+
_time_tolerance
<
_ts
and
_ts
<=
this
->
getBuffer
().
back
().
ts_
+
_time_tolerance
)
if
(
this
->
getOriginCapture
()
->
getTimeStamp
()
+
_time_tolerance
<
_ts
and
_ts
<=
this
->
getBuffer
().
back
().
ts_
+
_time_tolerance
)
return
true
;
// not found anywhere
...
...
This diff is collapsed.
Click to expand it.
test/gtest_problem.cpp
+
69
−
1
View file @
eef62743
...
...
@@ -16,6 +16,7 @@
#include
"dummy/processor_tracker_feature_dummy.h"
#include
"core/solver/solver_manager.h"
#include
"dummy/solver_manager_dummy.h"
#include
"core/yaml/parser_yaml.h"
#include
"core/sensor/sensor_diff_drive.h"
#include
"core/processor/processor_diff_drive.h"
...
...
@@ -489,10 +490,77 @@ TEST(Problem, check)
ASSERT_TRUE
(
problem
->
check
(
true
,
std
::
cout
));
}
TEST
(
Problem
,
getState
)
{
std
::
string
wolf_root
=
_WOLF_ROOT_DIR
;
auto
parser
=
ParserYaml
(
"test/yaml/params_problem_odom_3d.yaml"
,
wolf_root
);
auto
server
=
ParamsServer
(
parser
.
getParams
());
auto
P
=
Problem
::
autoSetup
(
server
);
auto
S
=
P
->
getHardware
()
->
getSensorList
().
front
();
auto
C
=
std
::
make_shared
<
CaptureOdom3d
>
(
0.0
,
S
,
0.1
*
Vector6d
::
Ones
(),
0.01
*
Matrix6d
::
Identity
());
for
(
TimeStamp
t
=
0.0
;
t
<=
3.9
;
t
+=
0.1
)
{
C
->
setTimeStamp
(
t
);
C
->
process
();
}
P
->
print
(
4
,
1
,
1
,
1
);
// get at t = origin
WOLF_DEBUG
(
"P (0) = "
,
P
->
getState
(
0
,
"P"
));
// partial structure
WOLF_DEBUG
(
"PO(0) = "
,
P
->
getState
(
0
,
"PO"
));
// all but explicit structure
WOLF_DEBUG
(
"x (0) = "
,
P
->
getState
(
TimeStamp
(
0
)));
// own structure
ASSERT_EQ
(
P
->
getState
(
0
,
"P"
).
size
(),
1
);
ASSERT_EQ
(
P
->
getState
(
0
,
"PO"
).
size
(),
2
);
ASSERT_EQ
(
P
->
getState
(
TimeStamp
(
0
)).
size
(),
2
);
// get at t = before KF
WOLF_DEBUG
(
"P (1) = "
,
P
->
getState
(
1
,
"P"
));
WOLF_DEBUG
(
"PO(1) = "
,
P
->
getState
(
1
,
"PO"
));
WOLF_DEBUG
(
"x (1) = "
,
P
->
getState
(
1
));
ASSERT_EQ
(
P
->
getState
(
1
,
"P"
).
size
(),
1
);
ASSERT_EQ
(
P
->
getState
(
1
,
"PO"
).
size
(),
2
);
ASSERT_EQ
(
P
->
getState
(
TimeStamp
(
1
)).
size
(),
2
);
// get at t = KF
WOLF_DEBUG
(
"P (2) = "
,
P
->
getState
(
2
,
"P"
));
WOLF_DEBUG
(
"PO(2) = "
,
P
->
getState
(
2
,
"PO"
));
WOLF_DEBUG
(
"x (2) = "
,
P
->
getState
(
2
));
ASSERT_EQ
(
P
->
getState
(
2
,
"P"
).
size
(),
1
);
ASSERT_EQ
(
P
->
getState
(
2
,
"PO"
).
size
(),
2
);
ASSERT_EQ
(
P
->
getState
(
TimeStamp
(
2
)).
size
(),
2
);
// get at t = after last KF
WOLF_DEBUG
(
"P (3) = "
,
P
->
getState
(
3
,
"P"
));
WOLF_DEBUG
(
"PO(3) = "
,
P
->
getState
(
3
,
"PO"
));
WOLF_DEBUG
(
"x (3) = "
,
P
->
getState
(
3
));
ASSERT_EQ
(
P
->
getState
(
3
,
"P"
).
size
(),
1
);
ASSERT_EQ
(
P
->
getState
(
3
,
"PO"
).
size
(),
2
);
ASSERT_EQ
(
P
->
getState
(
TimeStamp
(
3
)).
size
(),
2
);
// get at t = last processed capture
WOLF_DEBUG
(
"P (3.9) = "
,
P
->
getState
(
3.9
,
"P"
));
WOLF_DEBUG
(
"PO(3.9) = "
,
P
->
getState
(
3.9
,
"PO"
));
WOLF_DEBUG
(
"x (3.9) = "
,
P
->
getState
(
3.9
));
ASSERT_EQ
(
P
->
getState
(
3.9
,
"P"
).
size
(),
1
);
ASSERT_EQ
(
P
->
getState
(
3.9
,
"PO"
).
size
(),
2
);
ASSERT_EQ
(
P
->
getState
(
TimeStamp
(
3.9
)).
size
(),
2
);
// get at t = current state
WOLF_DEBUG
(
"P () = "
,
P
->
getState
(
"P"
));
WOLF_DEBUG
(
"PO() = "
,
P
->
getState
(
"PO"
));
WOLF_DEBUG
(
"x () = "
,
P
->
getState
());
}
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
//
::testing::GTEST_FLAG(filter) = "Problem.
emplaceFrame_factory
";
::
testing
::
GTEST_FLAG
(
filter
)
=
"Problem.
getState
"
;
return
RUN_ALL_TESTS
();
}
This diff is collapsed.
Click to expand it.
test/yaml/params_problem_odom_3d.yaml
0 → 100644
+
44
−
0
View file @
eef62743
config
:
problem
:
frame_structure
:
"
PO"
dimension
:
3
prior
:
mode
:
"
factor"
$state
:
P
:
[
0
,
0
,
0
]
O
:
[
0
,
0
,
0
,
1
]
$sigma
:
P
:
[
0.31
,
0.31
,
0.31
]
O
:
[
0.31
,
0.31
,
0.31
]
time_tolerance
:
0.1
tree_manager
:
type
:
"
None"
sensors
:
-
type
:
"
SensorOdom3d"
name
:
"
odom"
plugin
:
"
core"
k_disp_to_disp
:
0.1
k_disp_to_rot
:
0.1
k_rot_to_rot
:
0.1
min_disp_var
:
0.1
min_rot_var
:
0.1
extrinsic
:
pose
:
[
1
,
2
,
3
,
0
,
0
,
0
,
1
]
processors
:
-
type
:
"
ProcessorOdom3d"
name
:
"
my_proc_odom3d"
sensor_name
:
"
odom"
plugin
:
"
core"
apply_loss_function
:
false
time_tolerance
:
0.01
# seconds
keyframe_vote
:
voting_active
:
true
voting_aux_active
:
false
max_time_span
:
1.95
# seconds
max_buff_length
:
999
# motion deltas
dist_traveled
:
999
# meters
angle_turned
:
999
# radians (1 rad approx 57 deg, approx 60 deg)
unmeasured_perturbation_std
:
0.00111
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