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
e0fe051d
Commit
e0fe051d
authored
8 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Use small-angle approx instead of null
parent
71e05ec0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!101
Visual SLAM starts to work.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/local_parametrization_homogeneous.cpp
+10
-6
10 additions, 6 deletions
src/local_parametrization_homogeneous.cpp
src/local_parametrization_quaternion.cpp
+21
-14
21 additions, 14 deletions
src/local_parametrization_quaternion.cpp
with
31 additions
and
20 deletions
src/local_parametrization_homogeneous.cpp
+
10
−
6
View file @
e0fe051d
...
...
@@ -32,21 +32,25 @@ bool LocalParametrizationHomogeneous::plus(const Eigen::Map<const Eigen::VectorX
using
namespace
Eigen
;
double
angle
=
_delta
.
norm
();
Quaternions
dq
;
if
(
angle
>
Constants
::
EPS_SMALL
)
{
// compute rotation axis -- this guarantees unity norm
Vector3s
axis
=
_delta
.
normalized
();
// express delta as a quaternion
-- this is exp(delta)
Quaternions
dq
(
AngleAxis
<
Scalar
>
(
angle
,
axis
)
)
;
// express delta as a quaternion
using the angle-axis helper
dq
=
AngleAxis
<
Scalar
>
(
angle
,
axis
);
// result as a homogeneous point -- we use the quaternion product for keeping in the 4-sphere
_h_plus_delta
=
(
dq
*
Map
<
const
Quaternions
>
(
_h
.
data
()
)
)
.
coeffs
();
}
else
else
// Consider small angle approx
{
_h_plus_delta
=
_h
;
dq
.
w
()
=
1
;
dq
.
vec
()
=
_delta
/
2
;
}
// result as a homogeneous point -- we use the quaternion product for keeping in the 4-sphere
_h_plus_delta
=
(
dq
*
Map
<
const
Quaternions
>
(
_h
.
data
())).
coeffs
();
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
src/local_parametrization_quaternion.cpp
+
21
−
14
View file @
e0fe051d
#include
"local_parametrization_quaternion.h"
#include
<iostream>
namespace
wolf
{
template
<
>
...
...
@@ -17,23 +17,26 @@ bool LocalParametrizationQuaternion<wolf::DQ_LOCAL>::plus(const Eigen::Map<const
using
namespace
Eigen
;
double
angle
=
_delta_theta
.
norm
();
Quaternions
dq
;
if
(
angle
>
Constants
::
EPS_SMALL
)
{
// compute rotation axis -- this guarantees unity norm
Vector3s
axis
=
_delta_theta
/
angle
;
// express delta_theta as a quaternion using the angle-axis helper
Quaternions
dq
(
AngleAxis
<
Scalar
>
(
angle
,
axis
));
// result as a quaternion
// the delta is in local reference: q * dq
_q_plus_delta_theta
=
(
Map
<
const
Quaternions
>
(
_q
.
data
())
*
dq
).
coeffs
();
dq
=
AngleAxis
<
Scalar
>
(
angle
,
axis
);
}
else
// Consider
null rotation
else
// Consider
small angle approx
{
_q_plus_delta_theta
=
_q
;
dq
.
w
()
=
1
;
dq
.
vec
()
=
_delta_theta
/
2
;
}
// result as a quaternion
// the delta is in global reference: dq * q
_q_plus_delta_theta
=
(
Map
<
const
Quaternions
>
(
_q
.
data
())
*
dq
).
coeffs
();
return
true
;
}
...
...
@@ -52,22 +55,26 @@ bool LocalParametrizationQuaternion<wolf::DQ_GLOBAL>::plus(const Eigen::Map<cons
using
namespace
Eigen
;
double
angle
=
_delta_theta
.
norm
();
Quaternions
dq
;
if
(
angle
>
Constants
::
EPS_SMALL
)
{
// compute rotation axis -- this guarantees unity norm
Vector3s
axis
=
_delta_theta
/
angle
;
// express delta_theta as a quaternion using the angle-axis helper
Quaternions
dq
(
AngleAxis
<
Scalar
>
(
angle
,
axis
)
)
;
dq
=
AngleAxis
<
Scalar
>
(
angle
,
axis
);
// result as a quaternion
// the delta is in global reference: dq * q
_q_plus_delta_theta
=
(
dq
*
Map
<
const
Quaternions
>
(
_q
.
data
())).
coeffs
();
}
else
// Consider
null rotation
else
// Consider
small angle approx
{
_q_plus_delta_theta
=
_q
;
dq
.
w
()
=
1
;
dq
.
vec
()
=
_delta_theta
/
2
;
}
// result as a quaternion
// the delta is in global reference: dq * q
_q_plus_delta_theta
=
(
dq
*
Map
<
const
Quaternions
>
(
_q
.
data
())).
coeffs
();
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