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
9ca95d47
Commit
9ca95d47
authored
5 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Change order in Prb::getState(void and ts)
parent
769e641a
No related branches found
No related tags found
1 merge request
!380
Resolve "Problem::getState/getTimeStamp considering not initialized processors"
Pipeline
#5668
passed
5 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/problem/problem.cpp
+39
-33
39 additions, 33 deletions
src/problem/problem.cpp
with
39 additions
and
33 deletions
src/problem/problem.cpp
+
39
−
33
View file @
9ca95d47
...
@@ -448,15 +448,7 @@ VectorComposite Problem::getState(const StateStructure& _structure) const
...
@@ -448,15 +448,7 @@ VectorComposite Problem::getState(const StateStructure& _structure) const
StateStructure
structure
=
(
_structure
==
""
?
getFrameStructure
()
:
_structure
);
StateStructure
structure
=
(
_structure
==
""
?
getFrameStructure
()
:
_structure
);
VectorComposite
state
;
VectorComposite
state
;
if
(
processor_is_motion_list_
.
empty
()
)
// Use last estimated frame's state
if
(
not
processor_is_motion_list_
.
empty
()
)
// Compose from different processor motion
{
auto
last_kf_or_aux
=
trajectory_ptr_
->
getLastKeyOrAuxFrame
();
if
(
last_kf_or_aux
)
state
=
last_kf_or_aux
->
getState
(
structure
);
else
state
=
stateZero
(
structure
);
}
else
// Compose from different processor motion
{
{
// compose the states of all processor motions into one only state
// compose the states of all processor motions into one only state
for
(
const
auto
&
prc
:
processor_is_motion_list_
)
for
(
const
auto
&
prc
:
processor_is_motion_list_
)
...
@@ -478,6 +470,15 @@ VectorComposite Problem::getState(const StateStructure& _structure) const
...
@@ -478,6 +470,15 @@ VectorComposite Problem::getState(const StateStructure& _structure) const
}
}
}
}
else
// Use last estimated frame's state
{
auto
last_kf_or_aux
=
trajectory_ptr_
->
getLastKeyOrAuxFrame
();
if
(
last_kf_or_aux
)
state
=
last_kf_or_aux
->
getState
(
structure
);
else
state
=
stateZero
(
structure
);
}
return
state
;
return
state
;
}
}
...
@@ -485,40 +486,45 @@ VectorComposite Problem::getState (const TimeStamp& _ts, const StateStructure& _
...
@@ -485,40 +486,45 @@ VectorComposite Problem::getState (const TimeStamp& _ts, const StateStructure& _
{
{
StateStructure
structure
=
(
_structure
==
""
?
getFrameStructure
()
:
_structure
);
StateStructure
structure
=
(
_structure
==
""
?
getFrameStructure
()
:
_structure
);
if
(
processor_is_motion_list_
.
empty
()
)
// Use last estimated frame's state
VectorComposite
state
;
if
(
not
processor_is_motion_list_
.
empty
()
)
{
{
const
auto
&
last_kf_or_aux
=
trajectory_ptr_
->
closestKeyOrAuxFrameToTimeStamp
(
_ts
);
for
(
const
auto
&
prc
:
processor_is_motion_list_
)
if
(
last_kf_or_aux
)
{
{
return
last_kf_or_aux
->
getState
(
structure
);
const
auto
&
prc_state
=
prc
->
getState
(
_ts
);
// transfer processor vector blocks to problem state
for
(
const
auto
&
pair_key_vec
:
prc_state
)
{
const
auto
&
key
=
pair_key_vec
.
first
;
if
(
state
.
count
(
key
)
==
0
)
// Only write once. This gives priority to processors upfront in the list
state
.
insert
(
pair_key_vec
);
}
}
}
else
// check for empty blocks and fill them with zeros
for
(
const
auto
&
ckey
:
frame_structure_
)
{
{
return
stateZero
(
structure
);
const
auto
&
key
=
string
(
1
,
ckey
);
if
(
state
.
count
(
key
)
==
0
)
state
.
emplace
(
key
,
stateZero
(
key
).
at
(
key
));
}
}
}
}
VectorComposite
state
;
else
// Use last estimated frame's state
for
(
const
auto
&
prc
:
processor_is_motion_list_
)
{
{
const
auto
&
prc_state
=
prc
->
getState
(
_ts
);
const
auto
&
last_kf_or_aux
=
trajectory_ptr_
->
closestKeyOrAuxFrameToTimeStamp
(
_ts
);
if
(
last_kf_or_aux
)
// transfer processor vector blocks to problem state
for
(
const
auto
&
pair_key_vec
:
prc_state
)
{
{
const
auto
&
key
=
pair_key_vec
.
first
;
state
=
last_kf_or_aux
->
getState
(
structure
);
}
if
(
state
.
count
(
key
)
==
0
)
// Only write once. This gives priority to processors upfront in the list
else
state
.
insert
(
pair_key_vec
);
{
state
=
stateZero
(
structure
);
}
}
}
// 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
;
return
state
;
...
...
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