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
4b5411e8
Commit
4b5411e8
authored
10 years ago
by
Randy Mackay
Browse files
Options
Downloads
Patches
Plain Diff
AP_Math: add new rotation to example rotation sketch
parent
6b0e636a
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
libraries/AP_Math/examples/rotations/rotations.pde
+11
-5
11 additions, 5 deletions
libraries/AP_Math/examples/rotations/rotations.pde
with
11 additions
and
5 deletions
libraries/AP_Math/examples/rotations/rotations.pde
+
11
−
5
View file @
4b5411e8
...
@@ -37,11 +37,10 @@ const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;
...
@@ -37,11 +37,10 @@ const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;
static
void
print_vector
(
Vector3f
&
v
)
static
void
print_vector
(
Vector3f
&
v
)
{
{
hal
.
console
->
printf
(
"[%.
2
f %.
2
f %.
2
f]
\n
"
,
hal
.
console
->
printf
(
"[%.
4
f %.
4
f %.
4
f]
\n
"
,
v
.
x
,
v
.
y
,
v
.
z
);
v
.
x
,
v
.
y
,
v
.
z
);
}
}
// test rotation method accuracy
// test rotation method accuracy
static
void
test_rotation_accuracy
(
void
)
static
void
test_rotation_accuracy
(
void
)
{
{
...
@@ -94,10 +93,16 @@ static void test_euler(enum Rotation rotation, float roll, float pitch, float ya
...
@@ -94,10 +93,16 @@ static void test_euler(enum Rotation rotation, float roll, float pitch, float ya
diff
=
(
v2
-
v1
);
diff
=
(
v2
-
v1
);
if
(
diff
.
length
()
>
accuracy
)
{
if
(
diff
.
length
()
>
accuracy
)
{
hal
.
console
->
printf
(
"euler test %u incorrect
\n
"
,
(
unsigned
)
rotation
);
hal
.
console
->
printf
(
"euler test %u failed : yaw:%d roll:%d pitch:%d
\n
"
,
print_vector
(
v
);
(
unsigned
)
rotation
,
(
int
)
yaw
,
(
int
)
roll
,
(
int
)
pitch
);
hal
.
console
->
printf
(
"fast rotated: "
);
print_vector
(
v1
);
print_vector
(
v1
);
hal
.
console
->
printf
(
"slow rotated: "
);
print_vector
(
v2
);
print_vector
(
v2
);
hal
.
console
->
printf
(
"
\n
"
);
}
}
}
}
...
@@ -141,7 +146,8 @@ static void test_eulers(void)
...
@@ -141,7 +146,8 @@ static void test_eulers(void)
test_euler
(
ROTATION_ROLL_180_PITCH_270
,
180
,
270
,
0
);
test_euler
(
ROTATION_ROLL_180_PITCH_270
,
180
,
270
,
0
);
test_euler
(
ROTATION_ROLL_270_PITCH_270
,
270
,
270
,
0
);
test_euler
(
ROTATION_ROLL_270_PITCH_270
,
270
,
270
,
0
);
test_euler
(
ROTATION_ROLL_90_PITCH_180_YAW_90
,
90
,
180
,
90
);
test_euler
(
ROTATION_ROLL_90_PITCH_180_YAW_90
,
90
,
180
,
90
);
test_euler
(
ROTATION_ROLL_90_YAW_270
,
90
,
0
,
270
);
test_euler
(
ROTATION_ROLL_90_YAW_270
,
90
,
0
,
270
);
test_euler
(
ROTATION_YAW_293_PITCH_68_ROLL_180
,
180
,
68.8
,
293.3
);
}
}
static
bool
have_rotation
(
const
Matrix3f
&
m
)
static
bool
have_rotation
(
const
Matrix3f
&
m
)
...
...
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