Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Pierre NARVOR
rtac_base
Commits
2b99ce91
Commit
2b99ce91
authored
Nov 16, 2021
by
Pierre NARVOR
Browse files
[geometry] Added tait-bryan angles to quaternion conversion
parent
61e4edb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/rtac_base/geometry.h
View file @
2b99ce91
...
...
@@ -23,6 +23,32 @@ constexpr T to_radians(T degrees)
return
degrees
*
M_PI
/
180.0
;
}
/**
* Conversion from Tait-Bryan angles to Quaternion in NED convention.
*
* Input as radians.
*/
template
<
typename
T
>
Quaternion
<
T
>
quaternion_from_nautical_rad
(
T
yaw
,
T
pitch
,
T
roll
)
{
return
Eigen
::
AngleAxis
<
T
>
(
yaw
,
Eigen
::
Vector3
<
T
>::
UnitZ
())
*
Eigen
::
AngleAxis
<
T
>
(
pitch
,
Eigen
::
Vector3
<
T
>::
UnitY
())
*
Eigen
::
AngleAxis
<
T
>
(
roll
,
Eigen
::
Vector3
<
T
>::
UnitX
());
}
/**
* Conversion from Tait-Bryan angles to Quaternion in NED convention.
*
* Input as degrees.
*/
template
<
typename
T
>
Quaternion
<
T
>
quaternion_from_nautical_degrees
(
T
yaw
,
T
pitch
,
T
roll
)
{
return
quaternion_from_nautical_rad
(
to_radians
(
yaw
),
to_radians
(
pitch
),
to_radians
(
roll
));
}
/**
* Find a vector non-colinear to v.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment