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
8e76341f
Commit
8e76341f
authored
8 years ago
by
Dinesh Atchuthan
Browse files
Options
Downloads
Patches
Plain Diff
[WIP] 1st constructor
parent
91bf7481
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/test/gtest_constraint_imu.cpp
+69
-3
69 additions, 3 deletions
src/test/gtest_constraint_imu.cpp
with
69 additions
and
3 deletions
src/test/gtest_constraint_imu.cpp
+
69
−
3
View file @
8e76341f
...
@@ -13,13 +13,65 @@
...
@@ -13,13 +13,65 @@
//#define DEBUG_RESULTS
//#define DEBUG_RESULTS
class
ConstraintIMU_test
:
public
testing
::
Test
class
ConstraintIMU_test
Base
:
public
testing
::
Test
{
{
public:
public:
wolf
::
ProblemPtr
wolf_problem_ptr_
;
wolf
::
TimeStamp
ts
;
wolf
::
CaptureIMUPtr
imu_ptr
;
Eigen
::
VectorXs
state_vec
;
Eigen
::
VectorXs
delta_preint
;
Eigen
::
Matrix
<
wolf
::
Scalar
,
9
,
9
>
delta_preint_cov
;
std
::
shared_ptr
<
wolf
::
FeatureIMU
>
feat_imu
;
wolf
::
FrameIMUPtr
last_frame
;
wolf
::
FrameBasePtr
origin_frame
;
Eigen
::
Matrix
<
wolf
::
Scalar
,
9
,
6
>
dD_db_jacobians
;
virtual
void
SetUp
()
virtual
void
SetUp
()
{
{
using
namespace
wolf
;
using
std
::
shared_ptr
;
using
std
::
make_shared
;
using
std
::
static_pointer_cast
;
// Wolf problem
wolf_problem_ptr_
=
Problem
::
create
(
FRM_PQVBB_3D
);
Eigen
::
VectorXs
IMU_extrinsics
(
7
);
IMU_extrinsics
<<
0
,
0
,
0
,
0
,
0
,
0
,
1
;
// IMU pose in the robot
SensorBasePtr
sensor_ptr
=
wolf_problem_ptr_
->
installSensor
(
"IMU"
,
"Main IMU"
,
IMU_extrinsics
,
shared_ptr
<
IntrinsicsBase
>
());
wolf_problem_ptr_
->
installProcessor
(
"IMU"
,
"IMU pre-integrator"
,
"Main IMU"
,
""
);
// Time and data variables
TimeStamp
t
;
Eigen
::
Vector6s
data_
;
t
.
set
(
0
);
// Set the origin
Eigen
::
VectorXs
x0
(
16
);
x0
<<
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
;
// Try some non-zero biases
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
setOrigin
(
x0
,
t
);
//create a keyframe at origin
ts
=
wolf_problem_ptr_
->
getProcessorMotionPtr
()
->
getBuffer
().
get
().
back
().
ts_
;
Eigen
::
VectorXs
origin_state
=
x0
;
origin_frame
=
std
::
make_shared
<
FrameIMU
>
(
KEY_FRAME
,
ts
,
origin_state
);
wolf_problem_ptr_
->
getTrajectoryPtr
()
->
addFrame
(
origin_frame
);
// Create one capture to store the IMU data arriving from (sensor / callback / file / etc.)
imu_ptr
=
std
::
make_shared
<
CaptureIMU
>
(
t
,
sensor_ptr
,
data_
);
imu_ptr
->
setFramePtr
(
origin_frame
);
//process data
data_
<<
2
,
0
,
9.8
,
0
,
0
,
0
;
t
.
set
(
0.1
);
// Expected state after one integration
//x << 0.01,0,0, 0,0,0,1, 0.2,0,0, 0,0,0, 0,0,0; // advanced at a=2m/s2 during 0.1s ==> dx = 0.5*2*0.1^2 = 0.01; dvx = 2*0.1 = 0.2
// assign data to capture
imu_ptr
->
setData
(
data_
);
imu_ptr
->
setTimeStamp
(
t
);
// process data in capture
sensor_ptr
->
process
(
imu_ptr
);
}
}
virtual
void
TearDown
()
virtual
void
TearDown
()
...
@@ -37,9 +89,23 @@ class ConstraintIMU_test : public testing::Test
...
@@ -37,9 +89,23 @@ class ConstraintIMU_test : public testing::Test
};
};
TEST_F
(
ConstraintIMU_test
,
constructors
)
TEST_F
(
ConstraintIMU_testBase
,
constructors
)
{
{
using
namespace
wolf
;
//create FrameIMU
ts
=
0.1
;
state_vec
<<
0.01
,
0
,
0
,
0
,
0
,
0
,
1
,
0.2
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
;
last_frame
=
std
::
make_shared
<
FrameIMU
>
(
KEY_FRAME
,
ts
,
state_vec
);
//create a feature
delta_preint_cov
=
Eigen
::
MatrixXs
::
Random
(
9
,
9
);
delta_preint
<<
0.01
,
0
,
0.049
,
0
,
0
,
0
,
1
,
0.2
,
0
,
0.98
;
dD_db_jacobians
=
Eigen
::
Matrix
<
wolf
::
Scalar
,
9
,
6
>::
Random
();
feat_imu
=
std
::
make_shared
<
FeatureIMU
>
(
delta_preint
,
delta_preint_cov
,
imu_ptr
,
dD_db_jacobians
);
//create the constraint
ConstraintIMU
constraint_imu
(
feat_imu
,
last_frame
);
}
}
...
...
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