mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-12 19:03:58 -04:00
AP_Common: make angles in degrees end in _deg
to make it obvious it is not radians
This commit is contained in:
parent
1165fcab99
commit
71f207403e
@ -259,20 +259,20 @@ void Location::offset(float ofs_north, float ofs_east)
|
|||||||
* positions, so it keeps the accuracy even when dealing with small
|
* positions, so it keeps the accuracy even when dealing with small
|
||||||
* distances and floating point numbers
|
* distances and floating point numbers
|
||||||
*/
|
*/
|
||||||
void Location::offset_bearing(float bearing, float distance)
|
void Location::offset_bearing(float bearing_deg, float distance)
|
||||||
{
|
{
|
||||||
const float ofs_north = cosf(radians(bearing)) * distance;
|
const float ofs_north = cosf(radians(bearing_deg)) * distance;
|
||||||
const float ofs_east = sinf(radians(bearing)) * distance;
|
const float ofs_east = sinf(radians(bearing_deg)) * distance;
|
||||||
offset(ofs_north, ofs_east);
|
offset(ofs_north, ofs_east);
|
||||||
}
|
}
|
||||||
|
|
||||||
// extrapolate latitude/longitude given bearing, pitch and distance
|
// extrapolate latitude/longitude given bearing, pitch and distance
|
||||||
void Location::offset_bearing_and_pitch(float bearing, float pitch, float distance)
|
void Location::offset_bearing_and_pitch(float bearing_deg, float pitch_deg, float distance)
|
||||||
{
|
{
|
||||||
const float ofs_north = cosf(radians(pitch)) * cosf(radians(bearing)) * distance;
|
const float ofs_north = cosf(radians(pitch_deg)) * cosf(radians(bearing_deg)) * distance;
|
||||||
const float ofs_east = cosf(radians(pitch)) * sinf(radians(bearing)) * distance;
|
const float ofs_east = cosf(radians(pitch_deg)) * sinf(radians(bearing_deg)) * distance;
|
||||||
offset(ofs_north, ofs_east);
|
offset(ofs_north, ofs_east);
|
||||||
const int32_t dalt = sinf(radians(pitch)) * distance *100.0f;
|
const int32_t dalt = sinf(radians(pitch_deg)) * distance *100.0f;
|
||||||
alt += dalt;
|
alt += dalt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,10 +72,10 @@ public:
|
|||||||
void offset(float ofs_north, float ofs_east);
|
void offset(float ofs_north, float ofs_east);
|
||||||
|
|
||||||
// extrapolate latitude/longitude given bearing and distance
|
// extrapolate latitude/longitude given bearing and distance
|
||||||
void offset_bearing(float bearing, float distance);
|
void offset_bearing(float bearing_deg, float distance);
|
||||||
|
|
||||||
// extrapolate latitude/longitude given bearing, pitch and distance
|
// extrapolate latitude/longitude given bearing, pitch and distance
|
||||||
void offset_bearing_and_pitch(float bearing, float pitch, float distance);
|
void offset_bearing_and_pitch(float bearing_deg, float pitch_deg, float distance);
|
||||||
|
|
||||||
// longitude_scale - returns the scaler to compensate for
|
// longitude_scale - returns the scaler to compensate for
|
||||||
// shrinking longitude as you move north or south from the equator
|
// shrinking longitude as you move north or south from the equator
|
||||||
|
Loading…
Reference in New Issue
Block a user