From 0306bf97a06881f7927130c28497b5e684edfa59 Mon Sep 17 00:00:00 2001 From: Doug Weibel Date: Sun, 15 Jan 2012 16:11:02 -0700 Subject: [PATCH] Just a little more commenting work on global variables --- ArduCopter/ArduCopter.pde | 1 + ArduPlane/ArduPlane.pde | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index 9d86beab8b..291992ae4e 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -418,6 +418,7 @@ static byte led_mode = NORMAL_LEDS; static const float t7 = 10000000.0; // We use atan2 and other trig techniques to calaculate angles // We need to scale the longitude up to make these calcs work +// to account for decreasing distance between lines of longitude away from the equator static float scaleLongUp = 1; // Sometimes we need to remove the scaling for distance calcs static float scaleLongDown = 1; diff --git a/ArduPlane/ArduPlane.pde b/ArduPlane/ArduPlane.pde index 2d774804f0..df5345a5bb 100644 --- a/ArduPlane/ArduPlane.pde +++ b/ArduPlane/ArduPlane.pde @@ -354,14 +354,25 @@ static int ground_start_avg; // If we do not detect GPS at startup, we stop trying and assume GPS is not connected static bool GPS_enabled = false; +//////////////////////////////////////////////////////////////////////////////// // Location & Navigation -// --------------------- +//////////////////////////////////////////////////////////////////////////////// +// Constants const float radius_of_earth = 6378100; // meters const float gravity = 9.81; // meters/ sec^2 -static long nav_bearing; // deg * 100 : 0 to 360 current desired bearing to navigate -static long target_bearing; // deg * 100 : 0 to 360 location of the plane to the target -static long crosstrack_bearing; // deg * 100 : 0 to 360 desired angle of plane to target -static float nav_gain_scaler = 1; // Gain scaling for headwind/tailwind TODO: why does this variable need to be initialized to 1? +// This is the currently calculated direction to fly. +// deg * 100 : 0 to 360 +static long nav_bearing; +// This is the direction to the next waypoint or loiter center +// deg * 100 : 0 to 360 +static long target_bearing; +//This is the direction from the last waypoint to the next waypoint +// deg * 100 : 0 to 360 +static long crosstrack_bearing; +// A gain scaler to account for ground speed/headwind/tailwind +static float nav_gain_scaler = 1; +// Direction held during phases of takeoff and landing +// deg * 100 dir of plane, A value of -1 indicates the course has not been set/is not in use static long hold_course = -1; // deg * 100 dir of plane static byte nav_command_index; // active nav command memory location