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
a7564c76
Commit
a7564c76
authored
5 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Improve state creation when no info is present
parent
14de2575
No related branches found
No related tags found
1 merge request
!366
Resolve "Complete state vector new data structure?"
Pipeline
#5448
passed
5 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/problem/problem.cpp
+8
-1
8 additions, 1 deletion
src/problem/problem.cpp
src/processor/processor_motion.cpp
+25
-11
25 additions, 11 deletions
src/processor/processor_motion.cpp
with
33 additions
and
12 deletions
src/problem/problem.cpp
+
8
−
1
View file @
a7564c76
...
...
@@ -426,6 +426,13 @@ VectorComposite Problem::getState(const StateStructure& _structure) const
state
.
insert
(
pair_key_vec
);
}
}
// check for empty blocks and fill them with zeros
for
(
const
auto
&
ckey
:
frame_structure_
)
{
const
auto
&
key
=
string
(
1
,
ckey
);
if
(
state
.
count
(
key
)
==
0
)
state
.
emplace
(
key
,
stateZero
(
key
).
at
(
key
));
}
}
return
state
;
...
...
@@ -532,7 +539,7 @@ VectorComposite Problem::stateZero ( const StateStructure& _structure ) const
if
(
key
==
"O"
)
{
if
(
dim_
==
2
)
vec
=
VectorXd
::
Zero
(
1
);
if
(
dim_
==
3
)
vec
=
Quaterniond
::
Identity
().
coeffs
();
else
if
(
dim_
==
3
)
vec
=
Quaterniond
::
Identity
().
coeffs
();
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/processor/processor_motion.cpp
+
25
−
11
View file @
a7564c76
...
...
@@ -110,7 +110,7 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
case
FIRST_TIME_WITH_KF_BEFORE_INCOMING
:
{
// cannot joint to the KF: create own origin
setOrigin
(
getProblem
()
->
stateZero
(
getStateStructure
()),
_incoming_ptr
->
getTimeStamp
());
setOrigin
(
getProblem
()
->
getState
(
getStateStructure
()),
_incoming_ptr
->
getTimeStamp
());
break
;
}
case
FIRST_TIME_WITH_KF_ON_INCOMING
:
...
...
@@ -122,7 +122,7 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
case
FIRST_TIME_WITH_KF_AFTER_INCOMING
:
{
// cannot joint to the KF: create own origin
setOrigin
(
getProblem
()
->
stateZero
(
getStateStructure
()),
_incoming_ptr
->
getTimeStamp
());
setOrigin
(
getProblem
()
->
getState
(
getStateStructure
()),
_incoming_ptr
->
getTimeStamp
());
break
;
}
case
RUNNING_WITHOUT_KF
:
...
...
@@ -300,9 +300,10 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
integrateOneStep
();
// Update state and time stamps
last_ptr_
->
setTimeStamp
(
getTimeStamp
());
last_ptr_
->
getFrame
()
->
setTimeStamp
(
getTimeStamp
());
last_ptr_
->
getFrame
()
->
setState
(
getProblem
()
->
getState
(
getTimeStamp
()));
const
auto
&
ts
=
getTimeStamp
();
last_ptr_
->
setTimeStamp
(
ts
);
last_ptr_
->
getFrame
()
->
setTimeStamp
(
ts
);
last_ptr_
->
getFrame
()
->
setState
(
getProblem
()
->
getState
(
ts
)
);
if
(
permittedKeyFrame
()
&&
voteForKeyFrame
())
{
...
...
@@ -384,8 +385,20 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
VectorComposite
ProcessorMotion
::
getState
()
const
{
assert
((
last_ptr_
)
&&
"ProcessorMotion does not have valid last_ptr yet"
);
assert
((
last_ptr_
->
getFrame
())
&&
"ProcessorMotion's last_ptr does not have a frame yet"
);
if
(
last_ptr_
==
nullptr
or
last_ptr_
->
getFrame
()
==
nullptr
)
// We do not have any info of where to find a valid state
// Further checking here for origin_ptr is redundant: if last=null, then origin=null too.
return
VectorComposite
();
// return empty state
// From here on, we do have info to compute a valid state
// if buffer is empty --> we did not advance from origin!
// this may happen when in the very first frame where the capture has no motion info --> empty buffer
if
(
last_ptr_
->
getBuffer
().
empty
())
{
return
last_ptr_
->
getFrame
()
->
getState
(
state_structure_
);
}
/* Doing this:
*
...
...
@@ -447,14 +460,17 @@ VectorComposite ProcessorMotion::getState(const TimeStamp& _ts) const
// We need to search for the capture containing a motion buffer with the queried time stamp
CaptureMotionPtr
capture_motion
=
findCaptureContainingTimeStamp
(
_ts
);
if
(
capture_motion
==
nullptr
)
// we do not have any info of where to find a valid state
return
VectorComposite
();
// return empty state
if
(
capture_motion
)
// We found a CaptureMotion whose buffer contains the time stamp
else
// We found a CaptureMotion whose buffer contains the time stamp
{
// if buffer is empty --> we did not advance from origin!
// this may happen when in the very first frame where the capture has no motion info --> empty buffer
if
(
capture_motion
->
getBuffer
().
empty
())
{
return
capture_motion
->
getFrame
()
->
getState
();
return
capture_motion
->
getFrame
()
->
getState
(
state_structure_
);
}
/* Doing this:
...
...
@@ -511,8 +527,6 @@ VectorComposite ProcessorMotion::getState(const TimeStamp& _ts) const
return
state
;
}
else
return
VectorComposite
();
// return empty state
}
FrameBasePtr
ProcessorMotion
::
setOrigin
(
const
VectorComposite
&
_x_origin
,
const
TimeStamp
&
_ts_origin
)
...
...
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