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
8b8b4549
Commit
8b8b4549
authored
5 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup and organization
parent
89862d1e
No related branches found
No related tags found
1 merge request
!317
Motion cleanup
Pipeline
#4253
passed
5 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/processor/processor_motion.cpp
+43
-37
43 additions, 37 deletions
src/processor/processor_motion.cpp
with
43 additions
and
37 deletions
src/processor/processor_motion.cpp
+
43
−
37
View file @
8b8b4549
...
...
@@ -118,28 +118,28 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
// extract pack elements
FrameBasePtr
keyframe_from_callback
=
pack
->
key_frame
;
TimeStamp
ts_from_callback
=
keyframe_from_callback
->
getTimeStamp
();
// find the capture whose buffer is affected by the new keyframe
auto
existing_capture
=
findCaptureContainingTimeStamp
(
ts
_from_callback
);
// k
auto
existing_capture
=
findCaptureContainingTimeStamp
(
keyframe
_from_callback
->
getTimeStamp
()
);
// k
// Find the frame acting as the capture's origin
auto
keyframe_origin
=
existing_capture
->
getOriginFrame
();
// i
auto
keyframe_origin
=
existing_capture
->
getOriginFrame
();
// i
auto
capture_origin
=
std
::
static_pointer_cast
<
CaptureMotion
>
(
keyframe_origin
->
getCaptureOf
(
getSensor
()));
auto
capture_origin
=
std
::
static_pointer_cast
<
CaptureMotion
>
(
keyframe_origin
->
getCaptureOf
(
getSensor
()));
// Get calibration params for preintegration from origin, since it has chances to have optimized values
VectorXs
calib_origin
=
capture_origin
->
getCalibration
();
VectorXs
calib_origin
=
capture_origin
->
getCalibration
();
// emplace a new motion capture to the new keyframe
auto
capture_for_keyframe_callback
=
emplaceCapture
(
keyframe_from_callback
,
// j
getSensor
(),
ts_from_callback
,
Eigen
::
VectorXs
::
Zero
(
data_size_
),
getSensor
()
->
getNoiseCov
(),
calib_origin
,
calib_origin
,
keyframe_origin
);
TimeStamp
ts_from_callback
=
keyframe_from_callback
->
getTimeStamp
();
auto
capture_for_keyframe_callback
=
emplaceCapture
(
keyframe_from_callback
,
// j
getSensor
(),
ts_from_callback
,
Eigen
::
VectorXs
::
Zero
(
data_size_
),
getSensor
()
->
getNoiseCov
(),
calib_origin
,
calib_origin
,
keyframe_origin
);
// split the buffer
// and give the part of the buffer before the new keyframe to the capture for the KF callback
...
...
@@ -202,15 +202,19 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
// extract pack elements
FrameBasePtr
keyframe_from_callback
=
pack
->
key_frame
;
TimeStamp
ts_from_callback
=
keyframe_from_callback
->
getTimeStamp
();
auto
&
existing_capture
=
last_ptr_
;
// Find the frame acting as the capture's origin
auto
keyframe_origin
=
last_ptr_
->
getOriginFrame
();
auto
keyframe_origin
=
existing_capture
->
getOriginFrame
();
auto
&
capture_origin
=
origin_ptr_
;
// Get calibration params for preintegration from origin, since it has chances to have optimized values
VectorXs
calib_origin
=
origin
_ptr_
->
getCalibration
();
VectorXs
calib_origin
=
capture_
origin
->
getCalibration
();
// emplace a new motion capture to the new keyframe
TimeStamp
ts_from_callback
=
keyframe_from_callback
->
getTimeStamp
();
auto
capture_for_keyframe_callback
=
emplaceCapture
(
keyframe_from_callback
,
getSensor
(),
ts_from_callback
,
...
...
@@ -222,7 +226,7 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
// split the buffer
// and give the part of the buffer before the new keyframe to the capture for the KF callback
splitBuffer
(
last_ptr_
,
ts_from_callback
,
keyframe_from_callback
,
capture_for_keyframe_callback
);
splitBuffer
(
existing_capture
,
ts_from_callback
,
keyframe_from_callback
,
capture_for_keyframe_callback
);
// create motion feature and add it to the capture
auto
feature_for_keyframe_callback
=
emplaceFeature
(
capture_for_keyframe_callback
);
...
...
@@ -279,40 +283,40 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
// Set the frame of last_ptr as key
auto
key_frame
_ptr
=
last_ptr_
->
getFrame
();
key_frame
_ptr
->
setKey
();
auto
key_frame
=
last_ptr_
->
getFrame
();
key_frame
->
setKey
();
// create motion feature and add it to the key_capture
auto
key_feature
_ptr
=
emplaceFeature
(
last_ptr_
);
auto
key_feature
=
emplaceFeature
(
last_ptr_
);
// create motion factor and link it to parent feature and other frame (which is origin's frame)
auto
fac
_ptr
=
emplaceFactor
(
key_feature
_ptr
,
origin_ptr_
);
auto
fac
tor
=
emplaceFactor
(
key_feature
,
origin_ptr_
);
// create a new frame
auto
new_frame
_ptr
=
getProblem
()
->
emplaceFrame
(
NON_ESTIMATED
,
auto
new_frame
=
getProblem
()
->
emplaceFrame
(
NON_ESTIMATED
,
getCurrentState
(),
getCurrentTimeStamp
());
// create a new capture
auto
new_capture
_ptr
=
emplaceCapture
(
new_frame
_ptr
,
getSensor
(),
key_frame
_ptr
->
getTimeStamp
(),
Eigen
::
VectorXs
::
Zero
(
data_size_
),
getSensor
()
->
getNoiseCov
(),
last_ptr_
->
getCalibration
(),
last_ptr_
->
getCalibration
(),
key_frame
_ptr
);
auto
new_capture
=
emplaceCapture
(
new_frame
,
getSensor
(),
key_frame
->
getTimeStamp
(),
Eigen
::
VectorXs
::
Zero
(
data_size_
),
getSensor
()
->
getNoiseCov
(),
last_ptr_
->
getCalibration
(),
last_ptr_
->
getCalibration
(),
key_frame
);
// reset the new buffer
new_capture
_ptr
->
getBuffer
().
get
().
push_back
(
motionZero
(
key_frame
_ptr
->
getTimeStamp
())
)
;
new_capture
->
getBuffer
().
get
().
push_back
(
motionZero
(
key_frame
->
getTimeStamp
())
)
;
// reset derived things
resetDerived
();
// Update pointers
origin_ptr_
=
last_ptr_
;
last_ptr_
=
new_capture
_ptr
;
last_ptr_
=
new_capture
;
// callback to other processors
getProblem
()
->
keyFrameCallback
(
key_frame
_ptr
,
shared_from_this
(),
params_motion_
->
time_tolerance
);
getProblem
()
->
keyFrameCallback
(
key_frame
,
shared_from_this
(),
params_motion_
->
time_tolerance
);
}
resetDerived
();
...
...
@@ -389,9 +393,9 @@ void ProcessorMotion::setOrigin(FrameBasePtr _origin_frame)
// ---------- LAST ----------
// Make non-key-frame for last Capture
auto
new_frame_ptr
=
getProblem
()
->
emplaceFrame
(
NON_ESTIMATED
,
_origin_frame
->
getState
(),
_origin_frame
->
getTimeStamp
());
auto
new_frame_ptr
=
getProblem
()
->
emplaceFrame
(
NON_ESTIMATED
,
_origin_frame
->
getState
(),
_origin_frame
->
getTimeStamp
());
// emplace (emtpy) last Capture
last_ptr_
=
emplaceCapture
(
new_frame_ptr
,
getSensor
(),
...
...
@@ -437,9 +441,11 @@ void ProcessorMotion::integrateOneStep()
// integrate Jacobian wrt calib
if
(
hasCalibration
()
)
{
jacobian_calib_
.
noalias
()
=
jacobian_delta_preint_
*
getBuffer
().
get
().
back
().
jacobian_calib_
+
jacobian_delta_
*
jacobian_delta_calib_
;
}
// Integrate covariance
delta_integrated_cov_
.
noalias
()
...
...
@@ -502,7 +508,7 @@ void ProcessorMotion::reintegrateBuffer(CaptureMotionPtr _capture_ptr)
// integrate Jacobian wrt calib
if
(
hasCalibration
()
)
motion_it
->
jacobian_calib_
=
motion_it
->
jacobian_delta_integr_
*
jacobian_calib_
+
motion_it
->
jacobian_delta_
*
jacobian_delta_calib_
;
+
motion_it
->
jacobian_delta_
*
jacobian_delta_calib_
;
// Integrate covariance
motion_it
->
delta_integr_cov_
=
motion_it
->
jacobian_delta_integr_
*
delta_integrated_cov_
*
motion_it
->
jacobian_delta_integr_
.
transpose
()
...
...
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