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
e2030a46
Commit
e2030a46
authored
8 years ago
by
Dinesh Atchuthan
Browse files
Options
Downloads
Patches
Plain Diff
create constraintIMU between keyframes
parent
14169564
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/examples/test_imu_constrained0.cpp
+19
-2
19 additions, 2 deletions
src/examples/test_imu_constrained0.cpp
with
19 additions
and
2 deletions
src/examples/test_imu_constrained0.cpp
+
19
−
2
View file @
e2030a46
...
@@ -88,17 +88,33 @@ int main(int argc, char** argv)
...
@@ -88,17 +88,33 @@ int main(int argc, char** argv)
const
int
keyframe_spacing
=
10
;
const
int
keyframe_spacing
=
10
;
int
last_keyframe_dt
=
0
;
int
last_keyframe_dt
=
0
;
Eigen
::
VectorXs
state_vec
;
Eigen
::
VectorXs
state_vec
;
FrameBasePtr
last_frame
;
Eigen
::
VectorXs
delta_preint
;
FrameIMUPtr
last_frame
;
FrameIMUPtr
previous_frame
;
Eigen
::
Matrix
<
wolf
::
Scalar
,
9
,
9
>
delta_preint_cov
;
while
(
!
data_file
.
eof
()){
while
(
!
data_file
.
eof
()){
if
(
last_keyframe_dt
>=
keyframe_spacing
){
if
(
last_keyframe_dt
>=
keyframe_spacing
){
previous_frame
=
last_frame
;
//to constraint the new frame and link it to previous one
ts
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getBuffer
().
get
().
back
().
ts_
;
ts
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getBuffer
().
get
().
back
().
ts_
;
state_vec
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getCurrentState
();
state_vec
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getCurrentState
();
last_frame
=
std
::
make_shared
<
FrameIMU
>
(
KEY_FRAME
,
ts
,
state_vec
);
last_frame
=
std
::
make_shared
<
FrameIMU
>
(
KEY_FRAME
,
ts
,
state_vec
);
//FrameBasePtr last_frame = std::make_shared<FrameIMU>(KEY_FRAME, ts_.get(),std::make_shared<StateBlock>(frame_val.head(3)), std::make_shared<StateQuaternion>(frame_val.tail(4)));
//FrameBasePtr last_frame = std::make_shared<FrameIMU>(KEY_FRAME, ts_.get(),std::make_shared<StateBlock>(frame_val.head(3)), std::make_shared<StateQuaternion>(frame_val.tail(4)));
wolf_problem_ptr_
->
getTrajectoryPtr
()
->
addFrame
(
last_frame
);
wolf_problem_ptr_
->
getTrajectoryPtr
()
->
addFrame
(
last_frame
);
//create a feature
delta_preint_cov
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getCurrentDeltaPreintCov
();
delta_preint
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getMotion
().
delta_integr_
;
std
::
shared_ptr
<
FeatureIMU
>
feat_imu
=
std
::
make_shared
<
FeatureIMU
>
(
delta_preint
,
delta_preint_cov
);
//create a constraintIMU
//wolf_problem_ptr_->getProcessorMotionPtr()->emplaceConstraint(feat_imu, previous_frame);
ConstraintIMUPtr
constraint_imu
=
std
::
make_shared
<
ConstraintIMU
>
(
feat_imu
,
previous_frame
);
feat_imu
->
addConstraint
(
constraint_imu
);
previous_frame
->
addConstrainedBy
(
constraint_imu
);
//reset origin of motion to new frame
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
setOrigin
(
last_frame
);
last_keyframe_dt
=
0
;
last_keyframe_dt
=
0
;
}
}
else
else
...
@@ -128,6 +144,7 @@ int main(int argc, char** argv)
...
@@ -128,6 +144,7 @@ int main(int argc, char** argv)
//create an ODOM constraint between first and last keyframes
//create an ODOM constraint between first and last keyframes
ConstraintOdom3DPtr
constraintOdom_ptr
=
std
::
make_shared
<
ConstraintOdom3D
>
(
last_feature
,
origin_frame
);
ConstraintOdom3DPtr
constraintOdom_ptr
=
std
::
make_shared
<
ConstraintOdom3D
>
(
last_feature
,
origin_frame
);
last_feature
->
addConstraint
(
constraintOdom_ptr
);
last_feature
->
addConstraint
(
constraintOdom_ptr
);
origin_frame
->
addConstrainedBy
(
constraintOdom_ptr
);
Eigen
::
Vector7s
expec
;
Eigen
::
Vector7s
expec
;
expec
=
constraintOdom_ptr
->
expectation
();
expec
=
constraintOdom_ptr
->
expectation
();
...
...
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