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
8b87849a
Commit
8b87849a
authored
12 years ago
by
Randy Mackay
Browse files
Options
Downloads
Patches
Plain Diff
Math: add wrap_PI
parent
23ce35d2
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/AP_Math.h
+5
-0
5 additions, 0 deletions
libraries/AP_Math/AP_Math.h
libraries/AP_Math/location.cpp
+9
-0
9 additions, 0 deletions
libraries/AP_Math/location.cpp
with
14 additions
and
0 deletions
libraries/AP_Math/AP_Math.h
+
5
−
0
View file @
8b87849a
...
@@ -94,6 +94,11 @@ void location_offset(struct Location *loc, float ofs_north, float ofs_eas
...
@@ -94,6 +94,11 @@ void location_offset(struct Location *loc, float ofs_north, float ofs_eas
int32_t
wrap_360_cd
(
int32_t
error
);
int32_t
wrap_360_cd
(
int32_t
error
);
int32_t
wrap_180_cd
(
int32_t
error
);
int32_t
wrap_180_cd
(
int32_t
error
);
/*
wrap an angle defined in radians to -PI ~ PI (equivalent to +- 180 degrees)
*/
float
wrap_PI
(
float
angle_in_radians
);
/*
/*
print a int32_t lat/long in decimal degrees
print a int32_t lat/long in decimal degrees
*/
*/
...
...
This diff is collapsed.
Click to expand it.
libraries/AP_Math/location.cpp
+
9
−
0
View file @
8b87849a
...
@@ -161,6 +161,15 @@ int32_t wrap_180_cd(int32_t error)
...
@@ -161,6 +161,15 @@ int32_t wrap_180_cd(int32_t error)
return
error
;
return
error
;
}
}
/*
wrap an angle defined in radians to -PI ~ PI (equivalent to +- 180 degrees)
*/
float
wrap_PI
(
float
angle_in_radians
)
{
while
(
angle_in_radians
>
PI
)
angle_in_radians
-=
2.0
f
*
PI
;
while
(
angle_in_radians
<
-
PI
)
angle_in_radians
+=
2.0
f
*
PI
;
return
angle_in_radians
;
}
/*
/*
print a int32_t lat/long in decimal degrees
print a int32_t lat/long in decimal degrees
...
...
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