1
0
Fork 0

Added a brake + autopilot mods.

This commit is contained in:
curt 1998-09-29 02:02:59 +00:00
parent 156e61d367
commit 1bafaa31f6
2 changed files with 38 additions and 39 deletions

View file

@ -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.

View file

@ -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;