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
Merge requests
!307
New Diff Drive suite with sensor self-calibration
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
New Diff Drive suite with sensor self-calibration
processor_diffdrive_selfcalib
into
devel
Overview
1
Commits
51
Pipelines
36
Changes
15
Merged
Joan Solà Ortega
requested to merge
processor_diffdrive_selfcalib
into
devel
5 years ago
Overview
1
Commits
51
Pipelines
36
Changes
15
Expand
0
0
Merge request reports
Compare
devel
version 35
6b21f1a7
5 years ago
version 34
6c5b9e4f
5 years ago
version 33
d422cb44
5 years ago
version 32
70668f19
5 years ago
version 31
2d37fd12
5 years ago
version 30
79ffa7f3
5 years ago
version 29
761a3efc
5 years ago
version 28
562eabc1
5 years ago
version 27
2354440e
5 years ago
version 26
b9e6b6c2
5 years ago
version 25
dc3ffdf1
5 years ago
version 24
d515db44
5 years ago
version 23
52f2e6e4
5 years ago
version 22
6bbae291
5 years ago
version 21
cfde8a49
5 years ago
version 20
ade6d961
5 years ago
version 19
46a33934
5 years ago
version 18
da3a7fe6
5 years ago
version 17
830d434f
5 years ago
version 16
771c9e05
5 years ago
version 15
e699a700
5 years ago
version 14
0fc79a4b
5 years ago
version 13
ea01c01d
5 years ago
version 12
8e83a8cf
5 years ago
version 11
7705f7c2
5 years ago
version 10
6c51e429
5 years ago
version 9
dc58218e
5 years ago
version 8
d3379ae5
5 years ago
version 7
9078294f
5 years ago
version 6
add1a06e
5 years ago
version 5
8596451a
5 years ago
version 4
d09a3980
5 years ago
version 3
94c57005
5 years ago
version 2
2d4ce932
5 years ago
version 1
2846be3f
5 years ago
devel (base)
and
version 2
latest version
2b894a6a
51 commits,
5 years ago
version 35
6b21f1a7
50 commits,
5 years ago
version 34
6c5b9e4f
49 commits,
5 years ago
version 33
d422cb44
48 commits,
5 years ago
version 32
70668f19
47 commits,
5 years ago
version 31
2d37fd12
45 commits,
5 years ago
version 30
79ffa7f3
44 commits,
5 years ago
version 29
761a3efc
43 commits,
5 years ago
version 28
562eabc1
42 commits,
5 years ago
version 27
2354440e
41 commits,
5 years ago
version 26
b9e6b6c2
40 commits,
5 years ago
version 25
dc3ffdf1
39 commits,
5 years ago
version 24
d515db44
38 commits,
5 years ago
version 23
52f2e6e4
36 commits,
5 years ago
version 22
6bbae291
33 commits,
5 years ago
version 21
cfde8a49
32 commits,
5 years ago
version 20
ade6d961
31 commits,
5 years ago
version 19
46a33934
30 commits,
5 years ago
version 18
da3a7fe6
28 commits,
5 years ago
version 17
830d434f
27 commits,
5 years ago
version 16
771c9e05
26 commits,
5 years ago
version 15
e699a700
25 commits,
5 years ago
version 14
0fc79a4b
23 commits,
5 years ago
version 13
ea01c01d
19 commits,
5 years ago
version 12
8e83a8cf
18 commits,
5 years ago
version 11
7705f7c2
17 commits,
5 years ago
version 10
6c51e429
16 commits,
5 years ago
version 9
dc58218e
11 commits,
5 years ago
version 8
d3379ae5
10 commits,
5 years ago
version 7
9078294f
8 commits,
5 years ago
version 6
add1a06e
6 commits,
5 years ago
version 5
8596451a
5 commits,
5 years ago
version 4
d09a3980
4 commits,
5 years ago
version 3
94c57005
3 commits,
5 years ago
version 2
2d4ce932
2 commits,
5 years ago
version 1
2846be3f
1 commit,
5 years ago
15 files
+
1029
−
106
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
15
Search (e.g. *.vue) (Ctrl+P)
include/core/factor/factor_diff_drive.h
+
96
−
93
Options
@@ -17,121 +17,124 @@
namespace
{
constexpr
std
::
size_t
RESIDUAL_SIZE
=
3
;
constexpr
std
::
size_t
POSITION_STATE_BLOCK_SIZE
=
2
;
constexpr
std
::
size_t
ORIENTATION_STATE_BLOCK_SIZE
=
1
;
/// @todo This should be dynamic (2/3/5)
constexpr
std
::
size_t
INTRINSICS_STATE_BLOCK_SIZE
=
3
;
constexpr
std
::
size_t
POSITION_STATE_BLOCK_SIZE
=
2
;
constexpr
std
::
size_t
ORIENTATION_STATE_BLOCK_SIZE
=
1
;
constexpr
std
::
size_t
INTRINSICS_STATE_BLOCK_SIZE
=
3
;
constexpr
std
::
size_t
RESIDUAL_SIZE
=
3
;
}
namespace
wolf
{
namespace
wolf
{
class
FactorDiffDrive
:
public
FactorAutodiff
<
FactorDiffDrive
,
RESIDUAL_SIZE
,
POSITION_STATE_BLOCK_SIZE
,
ORIENTATION_STATE_BLOCK_SIZE
,
INTRINSICS_STATE_BLOCK_SIZE
>
class
FactorDiffDrive
:
public
FactorAutodiff
<
FactorDiffDrive
,
RESIDUAL_SIZE
,
POSITION_STATE_BLOCK_SIZE
,
ORIENTATION_STATE_BLOCK_SIZE
,
POSITION_STATE_BLOCK_SIZE
,
ORIENTATION_STATE_BLOCK_SIZE
,
INTRINSICS_STATE_BLOCK_SIZE
>
{
using
Base
=
FactorAutodiff
<
FactorDiffDrive
,
RESIDUAL_SIZE
,
POSITION_STATE_BLOCK_SIZE
,
ORIENTATION_STATE_BLOCK_SIZE
,
INTRINSICS_STATE_BLOCK_SIZE
>
;
public:
FactorDiffDrive
(
const
FeatureDiffDrivePtr
&
_ftr_ptr
,
const
CaptureWheelJointPositionPtr
&
_capture_origin_ptr
,
const
ProcessorBasePtr
&
_processor_ptr
=
nullptr
,
const
bool
_apply_loss_function
=
false
,
const
FactorStatus
_status
=
FAC_ACTIVE
)
:
Base
(
"DIFF DRIVE"
,
_capture_origin_ptr
->
getFrame
(),
_capture_origin_ptr
,
nullptr
,
nullptr
,
_processor_ptr
,
_apply_loss_function
,
_status
,
_frame_ptr
->
getP
(),
_frame_ptr
->
getO
(),
_capture_origin_ptr
->
getFrame
()
->
getP
(),
_capture_origin_ptr
->
getFrame
()
->
getO
(),
_capture_origin_ptr
->
getFrame
()
->
getV
(),
_capture_origin_ptr
->
getSensorIntrinsic
(),
_ftr_ptr
->
getFrame
()
->
getP
(),
_ftr_ptr
->
getFrame
()
->
getO
(),
_ftr_ptr
->
getFrame
()
->
getV
(),
_ftr_ptr
->
getCapture
()
->
getSensorIntrinsic
()),
J_delta_calib_
(
_ftr_ptr
->
getJacobianFactor
())
{
//
}
/**
* \brief Default destructor (not recommended)
*
* Default destructor.
*
**/
virtual
~
FactorDiffDrive
()
=
default
;
template
<
typename
T
>
bool
operator
()(
const
T
*
const
_p1
,
const
T
*
const
_o1
,
const
T
*
const
_c1
,
const
T
*
const
_p2
,
const
T
*
const
_o2
,
const
T
*
const
_c2
,
T
*
_residuals
)
const
;
/**
* \brief Returns the jacobians computation method
**/
virtual
JacobianMethod
getJacobianMethod
()
const
{
return
JAC_AUTO
;
}
protected
:
Eigen
::
MatrixXs
J_delta_calib_
;
using
Base
=
FactorAutodiff
<
FactorDiffDrive
,
RESIDUAL_SIZE
,
POSITION_STATE_BLOCK_SIZE
,
ORIENTATION_STATE_BLOCK_SIZE
,
POSITION_STATE_BLOCK_SIZE
,
ORIENTATION_STATE_BLOCK_SIZE
,
INTRINSICS_STATE_BLOCK_SIZE
>
;
public:
FactorDiffDrive
(
const
FeatureDiffDrivePtr
&
_ftr_ptr
,
const
CaptureBasePtr
&
_capture_origin_ptr
,
const
ProcessorBasePtr
&
_processor_ptr
=
nullptr
,
const
bool
_apply_loss_function
=
false
,
const
FactorStatus
_status
=
FAC_ACTIVE
)
:
Base
(
"DIFF DRIVE"
,
_capture_origin_ptr
->
getFrame
(),
_capture_origin_ptr
,
nullptr
,
nullptr
,
_processor_ptr
,
_apply_loss_function
,
_status
,
_capture_origin_ptr
->
getFrame
()
->
getP
(),
_capture_origin_ptr
->
getFrame
()
->
getO
(),
_ftr_ptr
->
getFrame
()
->
getP
(),
_ftr_ptr
->
getFrame
()
->
getO
(),
_ftr_ptr
->
getCapture
()
->
getSensorIntrinsic
()),
J_delta_calib_
(
_ftr_ptr
->
getJacobianCalibration
())
{
//
}
/**
* \brief Default destructor (not recommended)
*
* Default destructor.
*
**/
virtual
~
FactorDiffDrive
()
=
default
;
template
<
typename
T
>
bool
operator
()(
const
T
*
const
_p1
,
const
T
*
const
_o1
,
const
T
*
const
_p2
,
const
T
*
const
_o2
,
const
T
*
const
_c
,
T
*
_residuals
)
const
;
/**
* \brief Returns the jacobians computation method
**/
virtual
JacobianMethod
getJacobianMethod
()
const
{
return
JAC_AUTO
;
}
protected
:
Eigen
::
MatrixXs
J_delta_calib_
;
};
template
<
typename
T
>
inline
bool
FactorDiffDrive
::
operator
()(
const
T
*
const
_p1
,
const
T
*
const
_o1
,
const
T
*
const
_c1
,
const
T
*
const
_p2
,
const
T
*
const
_o2
,
const
T
*
const
_c2
,
T
*
_residuals
)
const
inline
bool
FactorDiffDrive
::
operator
()(
const
T
*
const
_p1
,
const
T
*
const
_o1
,
const
T
*
const
_p2
,
const
T
*
const
_o2
,
const
T
*
const
_c
,
T
*
_residuals
)
const
{
// MAPS
Eigen
::
Map
<
Eigen
::
Matrix
<
T
,
RESIDUAL_SIZE
,
1
>
>
residuals_map
(
_residuals
);
// MAPS
Eigen
::
Map
<
Eigen
::
Matrix
<
T
,
RESIDUAL_SIZE
,
1
>
>
residuals
(
_residuals
);
Eigen
::
Map
<
const
Eigen
::
Matrix
<
T
,
POSITION_STATE_BLOCK_SIZE
,
1
>
>
p1
(
_p1
);
Eigen
::
Map
<
const
Eigen
::
Matrix
<
T
,
POSITION_STATE_BLOCK_SIZE
,
1
>
>
p2
(
_p2
);
Eigen
::
Map
<
const
Eigen
::
Matrix
<
T
,
INTRINSICS_STATE_BLOCK_SIZE
,
1
>
>
c
(
_c
);
Eigen
::
Map
<
const
Eigen
::
Matrix
<
T
,
POSITION_STATE_BLOCK_SIZE
,
1
>
>
p1_map
(
_p1
);
Eigen
::
Map
<
const
Eigen
::
Matrix
<
T
,
POSITION_STATE_BLOCK_SIZE
,
1
>
>
p2_map
(
_p2
);
// Compute corrected delta
Eigen
::
Map
<
const
Eigen
::
Matrix
<
T
,
INTRINSICS_STATE_BLOCK_SIZE
,
1
>
>
c1_map
(
_c1
);
Eigen
::
Map
<
const
Eigen
::
Matrix
<
T
,
INTRINSICS_STATE_BLOCK_SIZE
,
1
>
>
c2_map
(
_c2
);
/// Is this my delta_preint ? Yes!
const
Eigen
::
Matrix
<
T
,
3
,
1
>
measurement
=
getMeasurement
().
cast
<
T
>
(
);
// Compute corrected delta
auto
ftr
=
std
::
static_pointer_cast
<
FeatureDiffDrive
>
(
getFeature
());
/// Is this my delta_preint ?
const
Eigen
::
Matrix
<
T
,
3
,
1
>
measurement
=
getMeasurement
().
cast
<
T
>
();
Matrix
<
T
,
3
,
1
>
c_preint
=
ftr
->
getCalibrationPreint
().
cast
<
T
>
();
Eigen
::
Matrix
<
T
,
3
,
1
>
delta_corrected
=
measurement
+
J_delta_calib_
.
cast
<
T
>
()
*
(
c
2_map
-
c1_map
);
Eigen
::
Matrix
<
T
,
3
,
1
>
delta_corrected
=
measurement
+
J_delta_calib_
.
cast
<
T
>
()
*
(
c
-
c_preint
);
// First 2d pose residual
// First 2d pose residual
Eigen
::
Matrix
<
T
,
3
,
1
>
delta_predicted
;
Eigen
::
Matrix
<
T
,
3
,
1
>
delta_predicted
;
// position
delta_predicted
.
head
(
2
)
=
Eigen
::
Rotation2D
<
T
>
(
-
_o1
[
0
])
*
(
p2
_map
-
p1
_map
);
// position
delta_predicted
.
head
(
2
)
=
Eigen
::
Rotation2D
<
T
>
(
-
_o1
[
0
])
*
(
p2
-
p1
);
// orientation
delta_predicted
(
2
)
=
_o2
[
0
]
-
_o1
[
0
];
// orientation
delta_predicted
(
2
)
=
_o2
[
0
]
-
_o1
[
0
];
// residual
residuals
_map
=
delta_corrected
-
delta_predicted
;
// residual
residuals
=
delta_corrected
-
delta_predicted
;
// angle remapping
while
(
residuals
_map
(
2
)
>
T
(
M_PI
))
residuals
_map
(
2
)
=
residuals
_map
(
2
)
-
T
(
2.
*
M_PI
);
while
(
residuals
_map
(
2
)
<=
T
(
-
M_PI
))
residuals
_map
(
2
)
=
residuals
_map
(
2
)
+
T
(
2.
*
M_PI
);
// angle remapping
while
(
residuals
(
2
)
>
T
(
M_PI
))
residuals
(
2
)
=
residuals
(
2
)
-
T
(
2.
*
M_PI
);
while
(
residuals
(
2
)
<=
T
(
-
M_PI
))
residuals
(
2
)
=
residuals
(
2
)
+
T
(
2.
*
M_PI
);
// weighted residual
residuals
_map
=
getMeasurementSquareRootInformationUpper
().
cast
<
T
>
()
*
residuals
_map
;
// weighted residual
residuals
=
getMeasurementSquareRootInformationUpper
().
cast
<
T
>
()
*
residuals
;
return
true
;
return
true
;
}
}
// namespace wolf
Loading