Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Baitboat
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
OpenSource
Baitboat
Commits
537bb04f
Commit
537bb04f
authored
11 years ago
by
Randy Mackay
Browse files
Options
Downloads
Patches
Plain Diff
AP_Math: add rotateXY
parent
e34702f5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libraries/AP_Math/matrix3.cpp
+19
-0
19 additions, 0 deletions
libraries/AP_Math/matrix3.cpp
libraries/AP_Math/matrix3.h
+5
-1
5 additions, 1 deletion
libraries/AP_Math/matrix3.h
with
24 additions
and
1 deletion
libraries/AP_Math/matrix3.cpp
+
19
−
0
View file @
537bb04f
...
...
@@ -193,6 +193,24 @@ void Matrix3<T>::rotate(const Vector3<T> &g)
(
*
this
)
+=
temp_matrix
;
}
// apply an additional rotation from a body frame gyro vector
// to a rotation matrix.
template
<
typename
T
>
void
Matrix3
<
T
>::
rotateXY
(
const
Vector3
<
T
>
&
g
)
{
Matrix3f
temp_matrix
;
temp_matrix
.
a
.
x
=
-
a
.
z
*
g
.
y
;
temp_matrix
.
a
.
y
=
a
.
z
*
g
.
x
;
temp_matrix
.
a
.
z
=
a
.
x
*
g
.
y
-
a
.
y
*
g
.
x
;
temp_matrix
.
b
.
x
=
-
b
.
z
*
g
.
y
;
temp_matrix
.
b
.
y
=
b
.
z
*
g
.
x
;
temp_matrix
.
b
.
z
=
b
.
x
*
g
.
y
-
b
.
y
*
g
.
x
;
temp_matrix
.
c
.
x
=
-
c
.
z
*
g
.
y
;
temp_matrix
.
c
.
y
=
c
.
z
*
g
.
x
;
temp_matrix
.
c
.
z
=
c
.
x
*
g
.
y
-
c
.
y
*
g
.
x
;
(
*
this
)
+=
temp_matrix
;
}
// multiplication by a vector
template
<
typename
T
>
...
...
@@ -257,6 +275,7 @@ void Matrix3<T>::zero(void)
template
void
Matrix3
<
float
>
::
rotation
(
enum
Rotation
);
template
void
Matrix3
<
float
>
::
zero
(
void
);
template
void
Matrix3
<
float
>
::
rotate
(
const
Vector3
<
float
>
&
g
);
template
void
Matrix3
<
float
>
::
rotateXY
(
const
Vector3
<
float
>
&
g
);
template
void
Matrix3
<
float
>
::
from_euler
(
float
roll
,
float
pitch
,
float
yaw
);
template
void
Matrix3
<
float
>
::
to_euler
(
float
*
roll
,
float
*
pitch
,
float
*
yaw
);
template
Vector3
<
float
>
Matrix3
<
float
>::
operator
*
(
const
Vector3
<
float
>
&
v
)
const
;
...
...
This diff is collapsed.
Click to expand it.
libraries/AP_Math/matrix3.h
+
5
−
1
View file @
537bb04f
...
...
@@ -187,7 +187,11 @@ public:
// apply an additional rotation from a body frame gyro vector
// to a rotation matrix.
void
rotate
(
const
Vector3
<
T
>
&
g
);
void
rotate
(
const
Vector3
<
T
>
&
g
);
// apply an additional rotation from a body frame gyro vector
// to a rotation matrix but only use X, Y elements from gyro vector
void
rotateXY
(
const
Vector3
<
T
>
&
g
);
};
typedef
Matrix3
<
int16_t
>
Matrix3i
;
...
...
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