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
70017378
Commit
70017378
authored
5 years ago
by
Joaquim Casals Buñuel
Browse files
Options
Downloads
Patches
Plain Diff
Add time tolerance check in CaptureBase
parent
921f43b0
No related branches found
No related tags found
1 merge request
!376
WIP: Resolve "Add time stamp tolerance to problem::check()"
Pipeline
#5748
passed
5 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/core/processor/processor_base.h
+6
-0
6 additions, 0 deletions
include/core/processor/processor_base.h
src/capture/capture_base.cpp
+23
-1
23 additions, 1 deletion
src/capture/capture_base.cpp
with
29 additions
and
1 deletion
include/core/processor/processor_base.h
+
6
−
0
View file @
70017378
...
...
@@ -359,6 +359,8 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce
int
getDim
()
const
;
double
getTimeTolerance
()
const
;
void
link
(
SensorBasePtr
);
template
<
typename
classType
,
typename
...
T
>
static
std
::
shared_ptr
<
classType
>
emplace
(
SensorBasePtr
_sen_ptr
,
T
&&
...
all
);
...
...
@@ -426,6 +428,10 @@ inline int ProcessorBase::getDim() const
{
return
dim_
;
}
inline
double
ProcessorBase
::
getTimeTolerance
()
const
{
return
params_
->
time_tolerance
;
}
template
<
typename
classType
,
typename
...
T
>
std
::
shared_ptr
<
classType
>
ProcessorBase
::
emplace
(
SensorBasePtr
_sen_ptr
,
T
&&
...
all
)
...
...
This diff is collapsed.
Click to expand it.
src/capture/capture_base.cpp
+
23
−
1
View file @
70017378
...
...
@@ -363,7 +363,7 @@ CheckLog CaptureBase::localCheck(bool _verbose, CaptureBasePtr _cap_ptr, std::os
auto
frm_cap
=
_cap_ptr
->
getFrame
();
inconsistency_explanation
<<
"Cap"
<<
id
()
<<
" @ "
<<
_cap_ptr
<<
" ---> Frm"
<<
frm_cap
->
id
()
<<
" @ "
<<
frm_cap
<<
" -X-> Frm"
<<
id
();
<<
" -X-> Frm"
<<
id
()
<<
"
\n
"
;
auto
frm_cap_list
=
frm_cap
->
getCaptureList
();
auto
frame_has_cap
=
std
::
find_if
(
frm_cap_list
.
begin
(),
frm_cap_list
.
end
(),
[
&
_cap_ptr
](
CaptureBasePtr
cap
){
return
cap
==
_cap_ptr
;});
log
.
assertTrue
(
frame_has_cap
!=
frm_cap_list
.
end
(),
inconsistency_explanation
);
...
...
@@ -375,6 +375,28 @@ CheckLog CaptureBase::localCheck(bool _verbose, CaptureBasePtr _cap_ptr, std::os
<<
" -X-> Cap"
<<
id
();
log
.
assertTrue
((
f
->
getCapture
()
==
_cap_ptr
),
inconsistency_explanation
);
}
//Check that the capture is within time tolerance of some processor
auto
frame
=
getFrame
();
double
time_diff
=
fabs
(
getTimeStamp
()
-
frame
->
getTimeStamp
());
//It looks like some gtests add captures by hand, without using processors, so the processor list is empty.
//This inicialization is needed because if the list empty the execution does not go into the loop and the
//assertion fails
bool
match_any_prc_timetolerance
;
if
(
getSensor
()
!=
nullptr
)
{
match_any_prc_timetolerance
=
getSensor
()
->
getProcessorList
().
empty
();
for
(
auto
const
&
prc
:
getSensor
()
->
getProcessorList
())
{
match_any_prc_timetolerance
=
match_any_prc_timetolerance
or
(
time_diff
<=
prc
->
getTimeTolerance
());
}
inconsistency_explanation
<<
"Cap "
<<
id
()
<<
" @ "
<<
_cap_ptr
<<
" ts ="
<<
getTimeStamp
()
<<
((
frame
->
isKey
())
?
"KFrm"
:
"Frm"
)
<<
frame
->
id
()
<<
" ts = "
<<
frame
->
getTimeStamp
()
<<
" their time difference ("
<<
time_diff
<<
") does not match any time tolerance of"
<<
" any processor in sensor "
<<
getSensor
()
->
id
()
<<
"
\n
"
;
log
.
assertTrue
((
match_any_prc_timetolerance
),
inconsistency_explanation
);
}
return
log
;
}
bool
CaptureBase
::
check
(
CheckLog
&
_log
,
std
::
shared_ptr
<
NodeBase
>
_node_ptr
,
bool
_verbose
,
std
::
ostream
&
_stream
,
std
::
string
_tabs
)
const
...
...
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