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
0a4dbf5e
Commit
0a4dbf5e
authored
5 years ago
by
Médéric Fourmy
Browse files
Options
Downloads
Patches
Plain Diff
Several fixes to adapt the state size at different places
parent
76c3989c
No related branches found
No related tags found
1 merge request
!339
Adapting to multiple processor motion 285
Pipeline
#4948
failed
5 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/core/processor/processor_motion.h
+1
-1
1 addition, 1 deletion
include/core/processor/processor_motion.h
src/problem/problem.cpp
+33
-11
33 additions, 11 deletions
src/problem/problem.cpp
src/processor/processor_motion.cpp
+3
-1
3 additions, 1 deletion
src/processor/processor_motion.cpp
with
37 additions
and
13 deletions
include/core/processor/processor_motion.h
+
1
−
1
View file @
0a4dbf5e
...
...
@@ -509,7 +509,7 @@ inline bool ProcessorMotion::voteForKeyFrame() const
inline
Eigen
::
VectorXd
ProcessorMotion
::
getState
(
const
TimeStamp
&
_ts
)
const
{
Eigen
::
VectorXd
x
(
getProblem
()
->
getFrameStructureSize
());
// TODO -> wrong
Eigen
::
VectorXd
x
(
x_size_
);
getState
(
_ts
,
x
);
return
x
;
}
...
...
This diff is collapsed.
Click to expand it.
src/problem/problem.cpp
+
33
−
11
View file @
0a4dbf5e
...
...
@@ -353,16 +353,21 @@ void Problem::getCurrentStateAndStamp(Eigen::VectorXd& _state, TimeStamp& _ts) c
}
// Problem of this implmentation: if more state
void
Problem
::
getState
(
const
TimeStamp
&
_ts
,
Eigen
::
VectorXd
&
_state
)
const
{
// if _ts is too recent, for some of the processor is motion, they return the state corresponding to their last frame timestamp
FrameBasePtr
closest_frame
=
trajectory_ptr_
->
closestKeyOrAuxFrameToTimeStamp
(
_ts
);
Eigen
::
VectorXd
closest_frame_state
=
closest_frame
->
getState
();
if
(
processor_is_motion_list_
.
empty
()){
FrameBasePtr
closest_frame
=
trajectory_ptr_
->
closestKeyOrAuxFrameToTimeStamp
(
_ts
);
if
(
closest_frame
!=
nullptr
)
closest_frame
->
getState
(
_state
)
;
_state
=
closest_frame_state
;
else
_state
=
zeroState
();
}
// RETRIEVE FROM PROCESSOR MOTION
// TODO: current implementation really messy, would be much easier with a state being an std::unordered_map
else
{
// Iterate over the problem state structure and get the corresponding state
// in the first processor is motion that provides it
...
...
@@ -395,21 +400,32 @@ void Problem::getState(const TimeStamp& _ts, Eigen::VectorXd& _state) const
for
(
auto
state_map_it
:
states_to_concat_map
){
concat_size
+=
state_map_it
.
second
.
size
();
}
assert
(
concat_size
==
state_size_
&&
"Problem with the concatenated size: "
);
//
assert(concat_size == state_size_ && "Problem with the concatenated size: " );
// fill the state value from the state concatenation in the order dictated by frame_structure_
int
idx
=
0
;
_state
.
resize
(
state_size_
);
for
(
char
sb_name
:
frame_structure_
){
Eigen
::
VectorXd
sb_state
;
int
size_sb
;
// really bad...
if
(
sb_name
==
'O'
){
int
size_sb
=
dim_
==
3
?
4
:
1
;
// really bad...
_state
.
segment
(
idx
,
size_sb
)
=
states_to_concat_map
[
sb_name
];
idx
+=
size_sb
;
size_sb
=
dim_
==
3
?
4
:
1
;
}
else
{
size_sb
=
dim_
==
3
?
3
:
2
;
}
if
(
states_to_concat_map
.
find
(
sb_name
)
!=
states_to_concat_map
.
end
()){
sb_state
=
states_to_concat_map
[
sb_name
];
}
else
{
int
size_sb
=
dim_
==
3
?
3
:
2
;
_state
.
segment
(
idx
,
size_sb
)
=
states_to_concat_map
[
sb_name
];
idx
+=
size_sb
;
// Should be taken from the last state but too messy already
sb
_state
.
resize
(
size_sb
);
sb_state
.
setZero
()
;
}
_state
.
segment
(
idx
,
size_sb
)
=
sb_state
;
idx
+=
size_sb
;
}
}
}
...
...
@@ -847,10 +863,16 @@ FrameBasePtr Problem::setPrior(const Eigen::VectorXd& _prior_state, const Eigen:
// create origin capture with the given state as data
// Capture fix only takes 3D position and Quaternion orientation
CapturePosePtr
init_capture
;
if
(
this
->
getFrameStructure
()
==
"POV"
and
this
->
getDim
()
==
3
)
// if (this->getFrameStructure() == "POV" and this->getDim() == 3)
// init_capture = CaptureBase::emplace<CapturePose>(origin_keyframe, _ts, nullptr, _prior_state.head(7), _prior_cov.topLeftCorner(6,6));
// else
// init_capture = CaptureBase::emplace<CapturePose>(origin_keyframe, _ts, nullptr, _prior_state, _prior_cov);
if
(
this
->
getDim
()
==
3
)
init_capture
=
CaptureBase
::
emplace
<
CapturePose
>
(
origin_keyframe
,
_ts
,
nullptr
,
_prior_state
.
head
(
7
),
_prior_cov
.
topLeftCorner
(
6
,
6
));
else
init_capture
=
CaptureBase
::
emplace
<
CapturePose
>
(
origin_keyframe
,
_ts
,
nullptr
,
_prior_state
,
_prior_cov
);
init_capture
=
CaptureBase
::
emplace
<
CapturePose
>
(
origin_keyframe
,
_ts
,
nullptr
,
_prior_state
.
head
(
3
),
_prior_cov
.
topLeftCorner
(
3
,
3
));
// emplace feature and factor
init_capture
->
emplaceFeatureAndFactor
();
...
...
This diff is collapsed.
Click to expand it.
src/processor/processor_motion.cpp
+
3
−
1
View file @
0a4dbf5e
...
...
@@ -25,7 +25,8 @@ ProcessorMotion::ProcessorMotion(const std::string& _type,
origin_ptr_
(),
last_ptr_
(),
incoming_ptr_
(),
dt_
(
0.0
),
x_
(
_state_size
),
dt_
(
0.0
),
x_
(
_state_size
),
delta_
(
_delta_size
),
delta_cov_
(
_delta_cov_size
,
_delta_cov_size
),
delta_integrated_
(
_delta_size
),
...
...
@@ -347,6 +348,7 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
postProcess
();
}
// _x needs to have the size of the processor state
bool
ProcessorMotion
::
getState
(
const
TimeStamp
&
_ts
,
Eigen
::
VectorXd
&
_x
)
const
{
CaptureMotionPtr
capture_motion
;
...
...
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