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
3d943b7d
Commit
3d943b7d
authored
8 years ago
by
Dinesh Atchuthan
Browse files
Options
Downloads
Patches
Plain Diff
keyframe creation
parent
05312c25
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_constraintAHP.cpp
+29
-2
29 additions, 2 deletions
src/examples/test_imu_constraintAHP.cpp
with
29 additions
and
2 deletions
src/examples/test_imu_constraintAHP.cpp
+
29
−
2
View file @
3d943b7d
...
...
@@ -44,7 +44,7 @@ int main(int argc, char** argv)
data_file
.
open
(
filename
);
std
::
cout
<<
"file: "
<<
filename
<<
std
::
endl
;
//std::string dummy; //this is needed only first line is headers
//std::string dummy; //this is needed only
if
first line is headers
//getline(data_file, dummy);
}
...
...
@@ -72,15 +72,35 @@ int main(int argc, char** argv)
x0
<<
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
.001
,
0
,
0
,
.002
;
// Try some non-zero biases
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
setOrigin
(
x0
,
t
);
//create a keyframe at origin
TimeStamp
ts
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getBuffer
().
get
().
back
().
ts_
;
Eigen
::
VectorXs
state_vec
=
x0
;
FrameBasePtr
last_frame
=
std
::
make_shared
<
FrameIMU
>
(
KEY_FRAME
,
ts
,
state_vec
);
wolf_problem_ptr_
->
getTrajectoryPtr
()
->
addFrame
(
last_frame
);
// Create one capture to store the IMU data arriving from (sensor / callback / file / etc.)
CaptureIMU
::
Ptr
imu_ptr
(
std
::
make_shared
<
CaptureIMU
>
(
t
,
sensor_ptr
,
data_
)
);
// main loop
using
namespace
std
;
clock_t
begin
=
clock
();
std
::
cout
<<
"
\n\t\t\t\t
ENTERING MAIN LOOP - Please press ENTER to exit loop
\n
"
<<
std
::
endl
;
const
int
keyframe_spacing
=
10
;
int
last_keyframe_dt
=
0
;
while
(
!
data_file
.
eof
()){
if
(
last_keyframe_dt
>=
keyframe_spacing
){
ts
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getBuffer
().
get
().
back
().
ts_
;
state_vec
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getCurrentState
();
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)));
wolf_problem_ptr_
->
getTrajectoryPtr
()
->
addFrame
(
last_frame
);
last_keyframe_dt
=
0
;
}
else
last_keyframe_dt
++
;
// read new data
data_file
>>
mpu_clock
>>
data_
[
0
]
>>
data_
[
1
]
>>
data_
[
2
]
>>
data_
[
3
]
>>
data_
[
4
]
>>
data_
[
5
];
t
.
set
(
mpu_clock
);
//
...
...
@@ -93,6 +113,13 @@ int main(int argc, char** argv)
sensor_ptr
->
process
(
imu_ptr
);
}
//make final a keyframe
ts
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getBuffer
().
get
().
back
().
ts_
;
state_vec
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getCurrentState
();
FrameBasePtr
last_frame
=
std
::
make_shared
<
FrameIMU
>
(
KEY_FRAME
,
ts
,
state_vec
);
wolf_problem_ptr_
->
getTrajectoryPtr
()
->
addFrame
(
last_frame
);
clock_t
end
=
clock
();
double
elapsed_secs
=
double
(
end
-
begin
)
/
CLOCKS_PER_SEC
;
...
...
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