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
635a1326
Commit
635a1326
authored
7 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
setOrigin() handles the case where the KF has no capture
parent
466df15d
No related branches found
Branches containing commit
No related tags found
1 merge request
!157
Kfpackmanager
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/processor_motion.cpp
+71
-54
71 additions, 54 deletions
src/processor_motion.cpp
with
71 additions
and
54 deletions
src/processor_motion.cpp
+
71
−
54
View file @
635a1326
...
...
@@ -278,78 +278,95 @@ bool ProcessorMotion::keyFrameCallback(FrameBasePtr _new_keyframe, const Scalar&
{
assert
(
_new_keyframe
->
getTrajectoryPtr
()
!=
nullptr
&&
"ProcessorMotion::keyFrameCallback: key frame must be in the trajectory."
);
&&
"ProcessorMotion::keyFrameCallback: key frame must be in the trajectory."
);
// get keyframe's time stamp
TimeStamp
new_ts
=
_new_keyframe
->
getTimeStamp
();
// find the capture whose buffer is affected by the new keyframe
auto
existing_capture
=
findCaptureContainingTimeStamp
(
new_ts
);
assert
(
existing_capture
!=
nullptr
&&
"ProcessorMotion::keyFrameCallback: no motion capture containing the required TimeStamp found"
);
// Find the frame acting as the capture's origin
auto
keyframe_origin
=
existing_capture
->
getOriginFramePtr
();
// emplace a new motion capture to the new keyframe
auto
new_capture
=
emplaceCapture
(
_new_keyframe
,
getSensorPtr
(),
new_ts
,
Eigen
::
VectorXs
::
Zero
(
data_size_
),
existing_capture
->
getDataCovariance
(),
existing_capture
->
getCalibration
(),
existing_capture
->
getCalibration
(),
keyframe_origin
);
// split the buffer
// and give the part of the buffer before the new keyframe to the key_capture
existing_capture
->
getBuffer
().
split
(
new_ts
,
new_capture
->
getBuffer
());
// interpolate individual delta
if
(
!
existing_capture
->
getBuffer
().
get
().
empty
()
&&
new_capture
->
getBuffer
().
get
().
back
().
ts_
!=
new_ts
)
if
(
existing_capture
==
nullptr
)
// Keyframe without Capture --> first time
{
// interpolate Motion at the new time stamp
Motion
motion_interpolated
=
interpolate
(
new_capture
->
getBuffer
().
get
().
back
(),
// last Motion of old buffer
existing_capture
->
getBuffer
().
get
().
front
(),
// first motion of new buffer
new_ts
);
// add to old buffer
new_capture
->
getBuffer
().
get
().
push_back
(
motion_interpolated
);
CaptureMotionPtr
new_capture
=
createCapture
(
new_ts
,
getSensorPtr
(),
Eigen
::
VectorXs
::
Zero
(
data_size_
),
getSensorPtr
()
->
getNoiseCov
(),
_new_keyframe
);
new_capture
->
setCalibration
(
getSensorPtr
()
->
getCalibration
());
new_capture
->
setCalibrationPreint
(
getSensorPtr
()
->
getCalibration
());
emplaceFrame
(
NON_KEY_FRAME
,
new_capture
);
}
else
// Normal operation
{
// Find the frame acting as the capture's origin
auto
keyframe_origin
=
existing_capture
->
getOriginFramePtr
();
// emplace a new motion capture to the new keyframe
auto
new_capture
=
emplaceCapture
(
_new_keyframe
,
getSensorPtr
(),
new_ts
,
Eigen
::
VectorXs
::
Zero
(
data_size_
),
existing_capture
->
getDataCovariance
(),
existing_capture
->
getCalibration
(),
existing_capture
->
getCalibration
(),
keyframe_origin
);
// split the buffer
// and give the part of the buffer before the new keyframe to the key_capture
existing_capture
->
getBuffer
().
split
(
new_ts
,
new_capture
->
getBuffer
());
// interpolate individual delta
if
(
!
existing_capture
->
getBuffer
().
get
().
empty
()
&&
new_capture
->
getBuffer
().
get
().
back
().
ts_
!=
new_ts
)
{
// interpolate Motion at the new time stamp
Motion
motion_interpolated
=
interpolate
(
new_capture
->
getBuffer
().
get
().
back
(),
// last Motion of old buffer
existing_capture
->
getBuffer
().
get
().
front
(),
// first motion of new buffer
new_ts
);
// add to old buffer
new_capture
->
getBuffer
().
get
().
push_back
(
motion_interpolated
);
}
// create motion feature and add it to the capture
auto
new_feature
=
emplaceFeature
(
new_capture
);
// reintegrateBuffer(new_capture);
// create motion feature and add it to the capture
auto
new_feature
=
emplaceFeature
(
new_capture
);
// reintegrateBuffer(new_capture);
// create motion constraint and add it to the feature, and constrain to the other capture (origin)
emplaceConstraint
(
new_feature
,
keyframe_origin
->
getCaptureOf
(
getSensorPtr
())
);
// create motion constraint and add it to the feature, and constrain to the other capture (origin)
emplaceConstraint
(
new_feature
,
keyframe_origin
->
getCaptureOf
(
getSensorPtr
())
);
/////////////////////////////////////////////////////////
// Update the existing capture
if
(
existing_capture
==
last_ptr_
)
// reset processor origin
origin_ptr_
=
new_capture
;
/////////////////////////////////////////////////////////
// Update the existing capture
if
(
existing_capture
==
last_ptr_
)
// reset processor origin
origin_ptr_
=
new_capture
;
existing_capture
->
setOriginFramePtr
(
_new_keyframe
);
existing_capture
->
setOriginFramePtr
(
_new_keyframe
);
// reintegrate existing buffer -- note: the result of re-integration is stored in the same buffer!
reintegrateBuffer
(
existing_capture
);
// reintegrate existing buffer -- note: the result of re-integration is stored in the same buffer!
reintegrateBuffer
(
existing_capture
);
// modify existing feature and constraint (if they exist in the existing capture)
if
(
!
existing_capture
->
getFeatureList
().
empty
())
{
auto
existing_feature
=
existing_capture
->
getFeatureList
().
back
();
// there is only one feature!
// modify existing feature and constraint (if they exist in the existing capture)
if
(
!
existing_capture
->
getFeatureList
().
empty
())
{
auto
existing_feature
=
existing_capture
->
getFeatureList
().
back
();
// there is only one feature!
// Modify existing feature --------
existing_feature
->
setMeasurement
(
existing_capture
->
getBuffer
().
get
().
back
().
delta_integr_
);
existing_feature
->
setMeasurementCovariance
(
existing_capture
->
getBuffer
().
get
().
back
().
delta_integr_cov_
);
// Modify existing feature --------
existing_feature
->
setMeasurement
(
existing_capture
->
getBuffer
().
get
().
back
().
delta_integr_
);
existing_feature
->
setMeasurementCovariance
(
existing_capture
->
getBuffer
().
get
().
back
().
delta_integr_cov_
);
// Modify existing constraint --------
// Instead of modifying, we remove one ctr, and create a new one.
auto
ctr_to_remove
=
existing_feature
->
getConstraintList
().
back
();
// there is only one constraint!
auto
new_ctr
=
emplaceConstraint
(
existing_feature
,
new_capture
);
ctr_to_remove
->
remove
();
// remove old constraint now (otherwise c->remove() gets propagated to f, C, F, etc.)
}
// Modify existing constraint --------
// Instead of modifying, we remove one ctr, and create a new one.
auto
ctr_to_remove
=
existing_feature
->
getConstraintList
().
back
();
// there is only one constraint!
auto
new_ctr
=
emplaceConstraint
(
existing_feature
,
new_capture
);
ctr_to_remove
->
remove
();
// remove old constraint now (otherwise c->remove() gets propagated to f, C, F, etc.)
}
return
true
;
...
...
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