From 1bafaa31f63b9e83b9ea8f602ee3e79c9b5b50ff Mon Sep 17 00:00:00 2001
From: curt <curt>
Date: Tue, 29 Sep 1998 02:02:59 +0000
Subject: [PATCH] Added a brake + autopilot mods.

---
 LaRCsim/ls_interface.c | 71 ++++++++++++++++++++----------------------
 LaRCsim/navion_gear.c  |  6 +++-
 2 files changed, 38 insertions(+), 39 deletions(-)

diff --git a/LaRCsim/ls_interface.c b/LaRCsim/ls_interface.c
index 4017b7c93..f0165eca5 100644
--- a/LaRCsim/ls_interface.c
+++ b/LaRCsim/ls_interface.c
@@ -240,9 +240,9 @@ $Original log: LaRCsim.c,v $
 #include "ls_aux.h"
 #include "ls_model.h"
 #include "ls_init.h"
+
 #include <Flight/flight.h>
 #include <Aircraft/aircraft.h>
-#include <Autopilot/autopilot.h>
 #include <Debug/fg_debug.h>
 
 
@@ -556,44 +556,36 @@ int fgLaRCsimUpdate(fgFLIGHT *f, int multiloop) {
 	ls_cockpit();
     }
 
-    for ( i = 0; i < multiloop; i++ ) {
-	//Insertion by Jeff Goeke-Smith for Autopilot.
-	
-	// run Autopilot system
-	// fgPrintf( FG_ALL, FG_BULK, "Attempting autopilot run\n");
-	fgAPRun();
-
-	/* lets try to avoid really screwing up the LaRCsim model */
-	if ( FG_Altitude < -9000 ) {
-	    save_alt = FG_Altitude;
-	    FG_Altitude = 0;
-	}
-
-	// translate FG to LaRCsim structure
-	fgFlight_2_LaRCsim(f);
-	// printf("FG_Altitude = %.2f\n", FG_Altitude * 0.3048);
-	// printf("Altitude = %.2f\n", Altitude * 0.3048);
-	// printf("Radius to Vehicle = %.2f\n", Radius_to_vehicle * 0.3048);
-
-	// end of insertion 
-	
-	ls_loop( model_dt, 0);
-
-	// printf("%d FG_Altitude = %.2f\n", i, FG_Altitude * 0.3048);
-	// printf("%d Altitude = %.2f\n", i, Altitude * 0.3048);
-
-	// translate LaRCsim back to FG structure so that the
-	// autopilot (and the rest of the sim can use the updated
-	// values
-	fgLaRCsim_2_Flight(f);
-
-	/* but lets restore our original bogus altitude when we are done */
-	if ( save_alt < -9000 ) {
-	    FG_Altitude = save_alt;
-	}
+    /* lets try to avoid really screwing up the LaRCsim model */
+    if ( FG_Altitude < -9000 ) {
+	save_alt = FG_Altitude;
+	FG_Altitude = 0;
     }
 
-    return(1);
+    // translate FG to LaRCsim structure
+    fgFlight_2_LaRCsim(f);
+    // printf("FG_Altitude = %.2f\n", FG_Altitude * 0.3048);
+    // printf("Altitude = %.2f\n", Altitude * 0.3048);
+    // printf("Radius to Vehicle = %.2f\n", Radius_to_vehicle * 0.3048);
+
+    for ( i = 0; i < multiloop; i++ ) {
+	ls_loop( model_dt, 0);
+    }
+
+    // printf("%d FG_Altitude = %.2f\n", i, FG_Altitude * 0.3048);
+    // printf("%d Altitude = %.2f\n", i, Altitude * 0.3048);
+    
+    // translate LaRCsim back to FG structure so that the
+    // autopilot (and the rest of the sim can use the updated
+    // values
+    fgLaRCsim_2_Flight(f);
+
+    /* but lets restore our original bogus altitude when we are done */
+    if ( save_alt < -9000 ) {
+	FG_Altitude = save_alt;
+    }
+
+    return 1;
 }
 
 
@@ -960,7 +952,10 @@ int ls_ForceAltitude(double alt_feet) {
 /* Flight Gear Modification Log
  *
  * $Log$
- * Revision 1.21  1998/08/22 14:49:56  curt
+ * Revision 1.22  1998/09/29 02:02:59  curt
+ * Added a brake + autopilot mods.
+ *
+ * Revision 1.21  1998/08/22  14:49:56  curt
  * Attempting to iron out seg faults and crashes.
  * Did some shuffling to fix a initialization order problem between view
  * position, scenery elevation.
diff --git a/LaRCsim/navion_gear.c b/LaRCsim/navion_gear.c
index 580c4f76d..0fd31803d 100644
--- a/LaRCsim/navion_gear.c
+++ b/LaRCsim/navion_gear.c
@@ -36,6 +36,9 @@
 
 $Header$
 $Log$
+Revision 1.5  1998/09/29 02:03:00  curt
+Added a brake + autopilot mods.
+
 Revision 1.4  1998/08/06 12:46:40  curt
 Header change.
 
@@ -80,6 +83,7 @@ Initial Flight Gear revision.
 #include "ls_generic.h"
 #include "ls_cockpit.h"
 
+#include <Controls/controls.h>
 
 void sub3( DATA v1[],  DATA v2[], DATA result[] )
 {
@@ -207,7 +211,7 @@ char rcsid[] = "$Id$";
    * Put aircraft specific executable code here
    */
    
-    percent_brake[1] = 0.; /* replace with cockpit brake handle connection code */
+    percent_brake[1] = fgBrakeGet(); /* replace with cockpit brake handle connection code */
     percent_brake[2] = percent_brake[1];
     
     caster_angle_rad[0] = 0.03*Rudder_pedal;