**************************************************************************/
+#include <math.h>
#include <stdio.h>
#include "aircraft.h"
+#define FG_LON_2_DEG(RAD) ((RAD) * 180.0 / M_PI)
+#define FG_LAT_2_DEG(RAD) (-1.0 * (RAD) * 180.0 / M_PI)
/* Display various parameters to stdout */
void aircraft_debug(int type) {
f = ¤t_aircraft.flight;
c = ¤t_aircraft.controls;
- printf("Pos = (%.2f,%.2f,%.2f) Dir = %.2f\n",
- f->pos_x, f->pos_y, f->pos_z, f->Psi);
+ printf("Pos = (%.2f,%.2f,%.2f) Dir = %.2f Mach = %.2f\n",
+ FG_LAT_2_DEG(FG_Latitude) * 3600.0,
+ FG_LON_2_DEG(FG_Longitude) * 3600.0,
+ FG_Altitude, FG_Psi, FG_Mach_number);
printf("Elev = %.2f, Aileron = %.2f, Rudder = %.2f\n",
c->elev, c->aileron, c->rudder);
}
/* $Log$
-/* Revision 1.2 1997/05/23 15:40:29 curt
-/* Added GNU copyright headers.
+/* Revision 1.3 1997/05/29 22:39:56 curt
+/* Working on incorporating the LaRCsim flight model.
/*
+ * Revision 1.2 1997/05/23 15:40:29 curt
+ * Added GNU copyright headers.
+ *
* Revision 1.1 1997/05/16 15:58:24 curt
* Initial revision.
*
* (Log is kept at end of this file)
**************************************************************************/
-
+#include <stdio.h>
#include "flight.h"
/* Initialize the flight model parameters */
-int fgFlightModelInit(int model);
+int fgFlightModelInit(int model, struct flight_params *f, double dt) {
+ int result;
+
+ if ( model == FG_LARCSIM ) {
+ fgFlight_2_LaRCsim(f); /* translate FG to LaRCsim structure */
+ fgLaRCsimInit(dt);
+ printf("FG pos = %.2f\n", FG_Latitude);
+ fgLaRCsim_2_Flight(f); /* translate LaRCsim back to FG structure */
+ } else {
+ printf("Unimplemented flight model == %d\n", model);
+ }
+
+ return(result);
+}
-/* Run an iteration of the flight model */
-int fgFlightModelUpdate(int model);
+/* Run multiloop iterations of the flight model */
+int fgFlightModelUpdate(int model, struct flight_params *f, int multiloop) {
+ int result;
+
+ if ( model == FG_LARCSIM ) {
+ fgFlight_2_LaRCsim(f); /* translate FG to LaRCsim structure */
+ fgLaRCsimUpdate(multiloop);
+ fgLaRCsim_2_Flight(f); /* translate LaRCsim back to FG structure */
+ } else {
+ printf("Unimplemented flight model == %d\n", model);
+ }
+
+ return(result);
+}
/* $Log$
-/* Revision 1.1 1997/05/29 02:35:04 curt
-/* Initial revision.
+/* Revision 1.2 1997/05/29 22:39:57 curt
+/* Working on incorporating the LaRCsim flight model.
/*
+ * Revision 1.1 1997/05/29 02:35:04 curt
+ * Initial revision.
+ *
*/
/* Define a structure containing the shared flight model parameters */
-struct flight_params {
- double pos_x, pos_y, pos_z; /* temporary position variables */
- double vel_x, vel_y, vel_z; /* temporary velocity variables */
+/* struct flight_params {
+ double pos_x, pos_y, pos_z;
+ double vel_x, vel_y, vel_z;
- double Phi; /* Roll angle */
- double Theta; /* Pitch angle */
- double Psi; /* Heading angle */
+ double Phi;
+ double Theta;
+ double Psi;
double vel_Phi;
double vel_Theta;
double vel_Psi;
+}; */
+
+
+typedef double FG_VECTOR_3[3];
+
+/* This is based heavily on LaRCsim/ls_generic.h */
+struct flight_params {
+
+/*================== Mass properties and geometry values ==================*/
+
+ double mass, i_xx, i_yy, i_zz, i_xz; /* Inertias */
+#define FG_Mass f->mass
+#define FG_I_xx f->i_xx
+#define FG_I_yy f->i_yy
+#define FG_I_zz f->i_zz
+#define FG_I_xz f->i_xz
+
+ FG_VECTOR_3 d_pilot_rp_body_v; /* Pilot location rel to ref pt */
+#define FG_D_pilot_rp_body_v f->d_pilot_rp_body_v
+#define FG_Dx_pilot f->d_pilot_rp_body_v[0]
+#define FG_Dy_pilot f->d_pilot_rp_body_v[1]
+#define FG_Dz_pilot f->d_pilot_rp_body_v[2]
+
+ FG_VECTOR_3 d_cg_rp_body_v; /* CG position w.r.t. ref. point */
+#define FG_D_cg_rp_body_v f->d_cg_rp_body_v
+#define FG_Dx_cg f->d_cg_rp_body_v[0]
+#define FG_Dy_cg f->d_cg_rp_body_v[1]
+#define FG_Dz_cg f->d_cg_rp_body_v[2]
+
+/*================================ Forces =================================*/
+
+ FG_VECTOR_3 f_body_total_v;
+#define FG_F_body_total_v f->f_body_total_v
+#define FG_F_X f->f_body_total_v[0]
+#define FG_F_Y f->f_body_total_v[1]
+#define FG_F_Z f->f_body_total_v[2]
+
+ FG_VECTOR_3 f_local_total_v;
+#define FG_F_local_total_v f->f_local_total_v
+#define FG_F_north f->f_local_total_v[0]
+#define FG_F_east f->f_local_total_v[1]
+#define FG_F_down f->f_local_total_v[2]
+
+ FG_VECTOR_3 f_aero_v;
+#define FG_F_aero_v f->f_aero_v
+#define FG_F_X_aero f->f_aero_v[0]
+#define FG_F_Y_aero f->f_aero_v[1]
+#define FG_F_Z_aero f->f_aero_v[2]
+
+ FG_VECTOR_3 f_engine_v;
+#define FG_F_engine_v f->f_engine_v
+#define FG_F_X_engine f->f_engine_v[0]
+#define FG_F_Y_engine f->f_engine_v[1]
+#define FG_F_Z_engine f->f_engine_v[2]
+
+ FG_VECTOR_3 f_gear_v;
+#define FG_F_gear_v f->f_gear_v
+#define FG_F_X_gear f->f_gear_v[0]
+#define FG_F_Y_gear f->f_gear_v[1]
+#define FG_F_Z_gear f->f_gear_v[2]
+
+/*================================ Moments ================================*/
+
+ FG_VECTOR_3 m_total_rp_v;
+#define FG_M_total_rp_v f->m_total_rp_v
+#define FG_M_l_rp f->m_total_rp_v[0]
+#define FG_M_m_rp f->m_total_rp_v[1]
+#define FG_M_n_rp f->m_total_rp_v[2]
+
+ FG_VECTOR_3 m_total_cg_v;
+#define FG_M_total_cg_v f->m_total_cg_v
+#define FG_M_l_cg f->m_total_cg_v[0]
+#define FG_M_m_cg f->m_total_cg_v[1]
+#define FG_M_n_cg f->m_total_cg_v[2]
+
+ FG_VECTOR_3 m_aero_v;
+#define FG_M_aero_v f->m_aero_v
+#define FG_M_l_aero f->m_aero_v[0]
+#define FG_M_m_aero f->m_aero_v[1]
+#define FG_M_n_aero f->m_aero_v[2]
+
+ FG_VECTOR_3 m_engine_v;
+#define FG_M_engine_v f->m_engine_v
+#define FG_M_l_engine f->m_engine_v[0]
+#define FG_M_m_engine f->m_engine_v[1]
+#define FG_M_n_engine f->m_engine_v[2]
+
+ FG_VECTOR_3 m_gear_v;
+#define FG_M_gear_v f->m_gear_v
+#define FG_M_l_gear f->m_gear_v[0]
+#define FG_M_m_gear f->m_gear_v[1]
+#define FG_M_n_gear f->m_gear_v[2]
+
+/*============================== Accelerations ============================*/
+
+ FG_VECTOR_3 v_dot_local_v;
+#define FG_V_dot_local_v f->v_dot_local_v
+#define FG_V_dot_north f->v_dot_local_v[0]
+#define FG_V_dot_east f->v_dot_local_v[1]
+#define FG_V_dot_down f->v_dot_local_v[2]
+
+ FG_VECTOR_3 v_dot_body_v;
+#define FG_V_dot_body_v f->v_dot_body_v
+#define FG_U_dot_body f->v_dot_body_v[0]
+#define FG_V_dot_body f->v_dot_body_v[1]
+#define FG_W_dot_body f->v_dot_body_v[2]
+
+ FG_VECTOR_3 a_cg_body_v;
+#define FG_A_cg_body_v f->a_cg_body_v
+#define FG_A_X_cg f->a_cg_body_v[0]
+#define FG_A_Y_cg f->a_cg_body_v[1]
+#define FG_A_Z_cg f->a_cg_body_v[2]
+
+ FG_VECTOR_3 a_pilot_body_v;
+#define FG_A_pilot_body_v f->a_pilot_body_v
+#define FG_A_X_pilot f->a_pilot_body_v[0]
+#define FG_A_Y_pilot f->a_pilot_body_v[1]
+#define FG_A_Z_pilot f->a_pilot_body_v[2]
+
+ FG_VECTOR_3 n_cg_body_v;
+#define FG_N_cg_body_v f->n_cg_body_v
+#define FG_N_X_cg f->n_cg_body_v[0]
+#define FG_N_Y_cg f->n_cg_body_v[1]
+#define FG_N_Z_cg f->n_cg_body_v[2]
+
+ FG_VECTOR_3 n_pilot_body_v;
+#define FG_N_pilot_body_v f->n_pilot_body_v
+#define FG_N_X_pilot f->n_pilot_body_v[0]
+#define FG_N_Y_pilot f->n_pilot_body_v[1]
+#define FG_N_Z_pilot f->n_pilot_body_v[2]
+
+ FG_VECTOR_3 omega_dot_body_v;
+#define FG_Omega_dot_body_v f->omega_dot_body_v
+#define FG_P_dot_body f->omega_dot_body_v[0]
+#define FG_Q_dot_body f->omega_dot_body_v[1]
+#define FG_R_dot_body f->omega_dot_body_v[2]
+
+
+/*============================== Velocities ===============================*/
+
+ FG_VECTOR_3 v_local_v;
+#define FG_V_local_v f->v_local_v
+#define FG_V_north f->v_local_v[0]
+#define FG_V_east f->v_local_v[1]
+#define FG_V_down f->v_local_v[2]
+
+ FG_VECTOR_3 v_local_rel_ground_v; /* V rel w.r.t. earth surface */
+#define FG_V_local_rel_ground_v f->v_local_rel_ground_v
+#define FG_V_north_rel_ground f->v_local_rel_ground_v[0]
+#define FG_V_east_rel_ground f->v_local_rel_ground_v[1]
+#define FG_V_down_rel_ground f->v_local_rel_ground_v[2]
+
+ FG_VECTOR_3 v_local_airmass_v; /* velocity of airmass (steady winds) */
+#define FG_V_local_airmass_v f->v_local_airmass_v
+#define FG_V_north_airmass f->v_local_airmass_v[0]
+#define FG_V_east_airmass f->v_local_airmass_v[1]
+#define FG_V_down_airmass f->v_local_airmass_v[2]
+
+ FG_VECTOR_3 v_local_rel_airmass_v; /* velocity of veh. relative to */
+ /* airmass */
+#define FG_V_local_rel_airmass_v f->v_local_rel_airmass_v
+#define FG_V_north_rel_airmass f->v_local_rel_airmass_v[0]
+#define FG_V_east_rel_airmass f->v_local_rel_airmass_v[1]
+#define FG_V_down_rel_airmass f->v_local_rel_airmass_v[2]
+
+ FG_VECTOR_3 v_local_gust_v; /* linear turbulence components, L frame */
+#define FG_V_local_gust_v f->v_local_gust_v
+#define FG_U_gust f->v_local_gust_v[0]
+#define FG_V_gust f->v_local_gust_v[1]
+#define FG_W_gust f->v_local_gust_v[2]
+
+ FG_VECTOR_3 v_wind_body_v; /* Wind-relative velocities in body axis */
+#define FG_V_wind_body_v f->v_wind_body_v
+#define FG_U_body f->v_wind_body_v[0]
+#define FG_V_body f->v_wind_body_v[1]
+#define FG_W_body f->v_wind_body_v[2]
+
+ double v_rel_wind, v_true_kts, v_rel_ground, v_inertial;
+ double v_ground_speed, v_equiv, v_equiv_kts;
+ double v_calibrated, v_calibrated_kts;
+#define FG_V_rel_wind f->v_rel_wind
+#define FG_V_true_kts f->v_true_kts
+#define FG_V_rel_ground f->v_rel_ground
+#define FG_V_inertial f->v_inertial
+#define FG_V_ground_speed f->v_ground_speed
+#define FG_V_equiv f->v_equiv
+#define FG_V_equiv_kts f->v_equiv_kts
+#define FG_V_calibrated f->v_calibrated
+#define FG_V_calibrated_kts f->v_calibrated_kts
+
+ FG_VECTOR_3 omega_body_v; /* Angular B rates */
+#define FG_Omega_body_v f->omega_body_v
+#define FG_P_body f->omega_body_v[0]
+#define FG_Q_body f->omega_body_v[1]
+#define FG_R_body f->omega_body_v[2]
+
+ FG_VECTOR_3 omega_local_v; /* Angular L rates */
+#define FG_Omega_local_v f->omega_local_v
+#define FG_P_local f->omega_local_v[0]
+#define FG_Q_local f->omega_local_v[1]
+#define FG_R_local f->omega_local_v[2]
+
+ FG_VECTOR_3 omega_total_v; /* Diff btw B & L */
+#define FG_Omega_total_v f->omega_total_v
+#define FG_P_total f->omega_total_v[0]
+#define FG_Q_total f->omega_total_v[1]
+#define FG_R_total f->omega_total_v[2]
+
+ FG_VECTOR_3 euler_rates_v;
+#define FG_Euler_rates_v f->euler_rates_v
+#define FG_Phi_dot f->euler_rates_v[0]
+#define FG_Theta_dot f->euler_rates_v[1]
+#define FG_Psi_dot f->euler_rates_v[2]
+
+ FG_VECTOR_3 geocentric_rates_v; /* Geocentric linear velocities */
+#define FG_Geocentric_rates_v f->geocentric_rates_v
+#define FG_Latitude_dot f->geocentric_rates_v[0]
+#define FG_Longitude_dot f->geocentric_rates_v[1]
+#define FG_Radius_dot f->geocentric_rates_v[2]
+
+/*=============================== Positions ===============================*/
+
+ FG_VECTOR_3 geocentric_position_v;
+#define FG_Geocentric_position_v f->geocentric_position_v
+#define FG_Lat_geocentric f->geocentric_position_v[0]
+#define FG_Lon_geocentric f->geocentric_position_v[1]
+#define FG_Radius_to_vehicle f->geocentric_position_v[2]
+
+ FG_VECTOR_3 geodetic_position_v;
+#define FG_Geodetic_position_v f->geodetic_position_v
+#define FG_Latitude f->geodetic_position_v[0]
+#define FG_Longitude f->geodetic_position_v[1]
+#define FG_Altitude f->geodetic_position_v[2]
+
+ FG_VECTOR_3 euler_angles_v;
+#define FG_Euler_angles_v f->euler_angles_v
+#define FG_Phi f->euler_angles_v[0]
+#define FG_Theta f->euler_angles_v[1]
+#define FG_Psi f->euler_angles_v[2]
+
+/*======================= Miscellaneous quantities ========================*/
+
+ double t_local_to_body_m[3][3]; /* Transformation matrix L to B */
+#define FG_T_local_to_body_m f->t_local_to_body_m
+#define FG_T_local_to_body_11 f->t_local_to_body_m[0][0]
+#define FG_T_local_to_body_12 f->t_local_to_body_m[0][1]
+#define FG_T_local_to_body_13 f->t_local_to_body_m[0][2]
+#define FG_T_local_to_body_21 f->t_local_to_body_m[1][0]
+#define FG_T_local_to_body_22 f->t_local_to_body_m[1][1]
+#define FG_T_local_to_body_23 f->t_local_to_body_m[1][2]
+#define FG_T_local_to_body_31 f->t_local_to_body_m[2][0]
+#define FG_T_local_to_body_32 f->t_local_to_body_m[2][1]
+#define FG_T_local_to_body_33 f->t_local_to_body_m[2][2]
+
+ double gravity; /* Local acceleration due to G */
+#define FG_Gravity f->gravity
+
+ double centrifugal_relief; /* load factor reduction due to speed */
+#define FG_Centrifugal_relief f->centrifugal_relief
+
+ double alpha, beta, alpha_dot, beta_dot; /* in radians */
+#define FG_Alpha f->alpha
+#define FG_Beta f->beta
+#define FG_Alpha_dot f->alpha_dot
+#define FG_Beta_dot f->beta_dot
+
+ double cos_alpha, sin_alpha, cos_beta, sin_beta;
+#define FG_Cos_alpha f->cos_alpha
+#define FG_Sin_alpha f->sin_alpha
+#define FG_Cos_beta f->cos_beta
+#define FG_Sin_beta f->sin_beta
+
+ double cos_phi, sin_phi, cos_theta, sin_theta, cos_psi, sin_psi;
+#define FG_Cos_phi f->cos_phi
+#define FG_Sin_phi f->sin_phi
+#define FG_Cos_theta f->cos_theta
+#define FG_Sin_theta f->sin_theta
+#define FG_Cos_psi f->cos_psi
+#define FG_Sin_psi f->sin_psi
+
+ double gamma_vert_rad, gamma_horiz_rad; /* Flight path angles */
+#define FG_Gamma_vert_rad f->gamma_vert_rad
+#define FG_Gamma_horiz_rad f->gamma_horiz_rad
+
+ double sigma, density, v_sound, mach_number;
+#define FG_Sigma f->sigma
+#define FG_Density f->density
+#define FG_V_sound f->v_sound
+#define FG_Mach_number f->mach_number
+
+ double static_pressure, total_pressure, impact_pressure;
+ double dynamic_pressure;
+#define FG_Static_pressure f->static_pressure
+#define FG_Total_pressure f->total_pressure
+#define FG_Impact_pressure f->impact_pressure
+#define FG_Dynamic_pressure f->dynamic_pressure
+
+ double static_temperature, total_temperature;
+#define FG_Static_temperature f->static_temperature
+#define FG_Total_temperature f->total_temperature
+
+ double sea_level_radius, earth_position_angle;
+#define FG_Sea_level_radius f->sea_level_radius
+#define FG_Earth_position_angle f->earth_position_angle
+
+ double runway_altitude, runway_latitude, runway_longitude;
+ double runway_heading;
+#define FG_Runway_altitude f->runway_altitude
+#define FG_Runway_latitude f->runway_latitude
+#define FG_Runway_longitude f->runway_longitude
+#define FG_Runway_heading f->runway_heading
+
+ double radius_to_rwy;
+#define FG_Radius_to_rwy f->radius_to_rwy
+
+ FG_VECTOR_3 d_cg_rwy_local_v; /* CG rel. to rwy in local coords */
+#define FG_D_cg_rwy_local_v f->d_cg_rwy_local_v
+#define FG_D_cg_north_of_rwy f->d_cg_rwy_local_v[0]
+#define FG_D_cg_east_of_rwy f->d_cg_rwy_local_v[1]
+#define FG_D_cg_above_rwy f->d_cg_rwy_local_v[2]
+
+ FG_VECTOR_3 d_cg_rwy_rwy_v; /* CG relative to rwy, in rwy coordinates */
+#define FG_D_cg_rwy_rwy_v f->d_cg_rwy_rwy_v
+#define FG_X_cg_rwy f->d_cg_rwy_rwy_v[0]
+#define FG_Y_cg_rwy f->d_cg_rwy_rwy_v[1]
+#define FG_H_cg_rwy f->d_cg_rwy_rwy_v[2]
+
+ FG_VECTOR_3 d_pilot_rwy_local_v; /* pilot rel. to rwy in local coords */
+#define FG_D_pilot_rwy_local_v f->d_pilot_rwy_local_v
+#define FG_D_pilot_north_of_rwy f->d_pilot_rwy_local_v[0]
+#define FG_D_pilot_east_of_rwy f->d_pilot_rwy_local_v[1]
+#define FG_D_pilot_above_rwy f->d_pilot_rwy_local_v[2]
+
+ FG_VECTOR_3 d_pilot_rwy_rwy_v; /* pilot rel. to rwy, in rwy coords. */
+#define FG_D_pilot_rwy_rwy_v f->d_pilot_rwy_rwy_v
+#define FG_X_pilot_rwy f->d_pilot_rwy_rwy_v[0]
+#define FG_Y_pilot_rwy f->d_pilot_rwy_rwy_v[1]
+#define FG_H_pilot_rwy f->d_pilot_rwy_rwy_v[2]
+
};
/* General interface to the flight model routines */
/* Initialize the flight model parameters */
-int fgFlightModelInit(int model);
+int fgFlightModelInit(int model, struct flight_params *f, double dt);
-/* Run an iteration of the flight model */
-int fgFlightModelUpdate(int model);
+/* Run multiloop iterations of the flight model */
+int fgFlightModelUpdate(int model, struct flight_params *f, int multiloop);
#endif FLIGHT_H
/* $Log$
-/* Revision 1.3 1997/05/29 02:32:25 curt
-/* Starting to build generic flight model interface.
+/* Revision 1.4 1997/05/29 22:39:57 curt
+/* Working on incorporating the LaRCsim flight model.
/*
+ * Revision 1.3 1997/05/29 02:32:25 curt
+ * Starting to build generic flight model interface.
+ *
* Revision 1.2 1997/05/23 15:40:37 curt
* Added GNU copyright headers.
*
$Header$
$Log$
+Revision 1.2 1997/05/29 22:39:58 curt
+Working on incorporating the LaRCsim flight model.
+
Revision 1.1 1997/05/29 00:09:57 curt
Initial Flight Gear revision.
#include "ls_types.h"
#include "ls_sym.h"
+/* temp */
+#include "ls_generic.h"
+
#define MAX_NUMBER_OF_CONTINUOUS_STATES 100
#define MAX_NUMBER_OF_DISCRETE_STATES 20
#define HARDWIRED 13
Simtime = 0;
+ printf("LS in init() pos = %.2f\n", Latitude);
+
ls_init_init();
+
+ printf("LS after init_init() pos = %.2f\n", Latitude);
/* move the states to proper values */
/* commented out by CLO
model_init();
+ printf("LS after model_init() pos = %.2f\n", Latitude);
+
ls_step(0.0, -1);
+
+ printf("LS after ls_step() pos = %.2f\n", Latitude);
}
--------------------------------------------------------------------------*/
-#include "ls_interface.h"
-
-#include "ls_types.h"
-#include "ls_constants.h"
-#include "ls_generic.h"
-#include "ls_sim_control.h"
-#include "ls_cockpit.h"
-/* #include "ls_tape.h" */
-#ifndef linux
-# include <libgen.h>
-#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
+#include "ls_types.h"
+#include "ls_constants.h"
+#include "ls_generic.h"
+#include "ls_sim_control.h"
+#include "ls_cockpit.h"
+#include "ls_interface.h"
+#include "../flight.h"
+
/* global variable declarations */
/* TAPE *Tape; */
int ls_cockpit() {
-
sim_control_.paused = 0;
- Throttle_pct = 0.85;
+ Throttle_pct = 0.25;
- /* printf("Mach = %.2f ", Mach_number);
+ printf("Mach = %.2f ", Mach_number);
printf("%.4f,%.4f,%.2f ", Latitude, Longitude, Altitude);
- printf("%.2f,%.2f,%.2f\n", Phi, Theta, Psi); */
+ printf("%.2f,%.2f,%.2f\n", Phi, Theta, Psi);
}
/* Initialize the LaRCsim flight model, dt is the time increment for
each subsequent iteration through the EOM */
int fgLaRCsimInit(double dt) {
-
model_dt = dt;
ls_setdefopts(); /* set default options */
- /* Number_of_Continuous_States = 22; */
-
- generic_.geodetic_position_v[0] = 2.793445E-05;
- generic_.geodetic_position_v[1] = 3.262070E-07;
- generic_.geodetic_position_v[2] = 3.758099E+00;
- generic_.v_local_v[0] = 7.287719E+00;
- generic_.v_local_v[1] = 1.521770E+03;
- generic_.v_local_v[2] = -1.265722E-05;
- generic_.euler_angles_v[0] = -2.658474E-06;
- generic_.euler_angles_v[1] = 7.401790E-03;
- generic_.euler_angles_v[2] = 1.391358E-03;
- generic_.omega_body_v[0] = 7.206685E-05;
- generic_.omega_body_v[1] = 0.000000E+00;
- generic_.omega_body_v[2] = 9.492658E-05;
- generic_.earth_position_angle = 0.000000E+00;
- generic_.mass = 8.547270E+01;
- generic_.i_xx = 1.048000E+03;
- generic_.i_yy = 3.000000E+03;
- generic_.i_zz = 3.530000E+03;
- generic_.i_xz = 0.000000E+00;
- generic_.d_cg_rp_body_v[0] = 0.000000E+00;
- generic_.d_cg_rp_body_v[1] = 0.000000E+00;
- generic_.d_cg_rp_body_v[2] = 0.000000E+00;
-
ls_stamp(); /* ID stamp; record time and date of run */
if (speedup == 0.0) {
return 1;
}
+ printf("LS pre Init pos = %.2f\n", Latitude);
+
ls_init();
+ printf("LS post Init pos = %.2f\n", Latitude);
+
if (speedup > 0) {
/* Initialize (get) cockpit (controls) settings */
ls_cockpit();
}
+/* Convert from the FG flight_params struct to the LaRCsim generic_ struct */
+int fgFlight_2_LaRCsim (struct flight_params *f) {
+ Mass = FG_Mass;
+ I_xx = FG_I_xx;
+ I_yy = FG_I_yy;
+ I_zz = FG_I_zz;
+ I_xz = FG_I_xz;
+ Dx_pilot = FG_Dx_pilot;
+ Dy_pilot = FG_Dy_pilot;
+ Dz_pilot = FG_Dz_pilot;
+ Dx_cg = FG_Dx_cg;
+ Dy_cg = FG_Dy_cg;
+ Dz_cg = FG_Dz_cg;
+ F_X = FG_F_X;
+ F_Y = FG_F_Y;
+ F_Z = FG_F_Z;
+ F_north = FG_F_north;
+ F_east = FG_F_east;
+ F_down = FG_F_down;
+ F_X_aero = FG_F_X_aero;
+ F_Y_aero = FG_F_Y_aero;
+ F_Z_aero = FG_F_Z_aero;
+ F_X_engine = FG_F_X_engine;
+ F_Y_engine = FG_F_Y_engine;
+ F_Z_engine = FG_F_Z_engine;
+ F_X_gear = FG_F_X_gear;
+ F_Y_gear = FG_F_Y_gear;
+ F_Z_gear = FG_F_Z_gear;
+ M_l_rp = FG_M_l_rp;
+ M_m_rp = FG_M_m_rp;
+ M_n_rp = FG_M_n_rp;
+ M_l_cg = FG_M_l_cg;
+ M_m_cg = FG_M_m_cg;
+ M_n_cg = FG_M_n_cg;
+ M_l_aero = FG_M_l_aero;
+ M_m_aero = FG_M_m_aero;
+ M_n_aero = FG_M_n_aero;
+ M_l_engine = FG_M_l_engine;
+ M_m_engine = FG_M_m_engine;
+ M_n_engine = FG_M_n_engine;
+ M_l_gear = FG_M_l_gear;
+ M_m_gear = FG_M_m_gear;
+ M_n_gear = FG_M_n_gear;
+ V_dot_north = FG_V_dot_north;
+ V_dot_east = FG_V_dot_east;
+ V_dot_down = FG_V_dot_down;
+ U_dot_body = FG_U_dot_body;
+ V_dot_body = FG_V_dot_body;
+ W_dot_body = FG_W_dot_body;
+ A_X_cg = FG_A_X_cg;
+ A_Y_cg = FG_A_Y_cg;
+ A_Z_cg = FG_A_Z_cg;
+ A_X_pilot = FG_A_X_pilot;
+ A_Y_pilot = FG_A_Y_pilot;
+ A_Z_pilot = FG_A_Z_pilot;
+ N_X_cg = FG_N_X_cg;
+ N_Y_cg = FG_N_Y_cg;
+ N_Z_cg = FG_N_Z_cg;
+ N_X_pilot = FG_N_X_pilot;
+ N_Y_pilot = FG_N_Y_pilot;
+ N_Z_pilot = FG_N_Z_pilot;
+ P_dot_body = FG_P_dot_body;
+ Q_dot_body = FG_Q_dot_body;
+ R_dot_body = FG_R_dot_body;
+ V_north = FG_V_north;
+ V_east = FG_V_east;
+ V_down = FG_V_down;
+ V_north_rel_ground = FG_V_north_rel_ground;
+ V_east_rel_ground = FG_V_east_rel_ground;
+ V_down_rel_ground = FG_V_down_rel_ground;
+ V_north_airmass = FG_V_north_airmass;
+ V_east_airmass = FG_V_east_airmass;
+ V_down_airmass = FG_V_down_airmass;
+ V_north_rel_airmass = FG_V_north_rel_airmass;
+ V_east_rel_airmass = FG_V_east_rel_airmass;
+ V_down_rel_airmass = FG_V_down_rel_airmass;
+ U_gust = FG_U_gust;
+ V_gust = FG_V_gust;
+ W_gust = FG_W_gust;
+ U_body = FG_U_body;
+ V_body = FG_V_body;
+ W_body = FG_W_body;
+ V_rel_wind = FG_V_rel_wind;
+ V_true_kts = FG_V_true_kts;
+ V_rel_ground = FG_V_rel_ground;
+ V_inertial = FG_V_inertial;
+ V_ground_speed = FG_V_ground_speed;
+ V_equiv = FG_V_equiv;
+ V_equiv_kts = FG_V_equiv_kts;
+ V_calibrated = FG_V_calibrated;
+ V_calibrated_kts = FG_V_calibrated_kts;
+ P_body = FG_P_body;
+ Q_body = FG_Q_body;
+ R_body = FG_R_body;
+ P_local = FG_P_local;
+ Q_local = FG_Q_local;
+ R_local = FG_R_local;
+ P_total = FG_P_total;
+ Q_total = FG_Q_total;
+ R_total = FG_R_total;
+ Phi_dot = FG_Phi_dot;
+ Theta_dot = FG_Theta_dot;
+ Psi_dot = FG_Psi_dot;
+ Latitude_dot = FG_Latitude_dot;
+ Longitude_dot = FG_Longitude_dot;
+ Radius_dot = FG_Radius_dot;
+ Lat_geocentric = FG_Lat_geocentric;
+ Lon_geocentric = FG_Lon_geocentric;
+ Radius_to_vehicle = FG_Radius_to_vehicle;
+ Latitude = FG_Latitude;
+ Longitude = FG_Longitude;
+ Altitude = FG_Altitude;
+ Phi = FG_Phi;
+ Theta = FG_Theta;
+ Psi = FG_Psi;
+ T_local_to_body_11 = FG_T_local_to_body_11;
+ T_local_to_body_12 = FG_T_local_to_body_12;
+ T_local_to_body_13 = FG_T_local_to_body_13;
+ T_local_to_body_21 = FG_T_local_to_body_21;
+ T_local_to_body_22 = FG_T_local_to_body_22;
+ T_local_to_body_23 = FG_T_local_to_body_23;
+ T_local_to_body_31 = FG_T_local_to_body_31;
+ T_local_to_body_32 = FG_T_local_to_body_32;
+ T_local_to_body_33 = FG_T_local_to_body_33;
+ Gravity = FG_Gravity;
+ Centrifugal_relief = FG_Centrifugal_relief;
+ Alpha = FG_Alpha;
+ Beta = FG_Beta;
+ Alpha_dot = FG_Alpha_dot;
+ Beta_dot = FG_Beta_dot;
+ Cos_alpha = FG_Cos_alpha;
+ Sin_alpha = FG_Sin_alpha;
+ Cos_beta = FG_Cos_beta;
+ Sin_beta = FG_Sin_beta;
+ Cos_phi = FG_Cos_phi;
+ Sin_phi = FG_Sin_phi;
+ Cos_theta = FG_Cos_theta;
+ Sin_theta = FG_Sin_theta;
+ Cos_psi = FG_Cos_psi;
+ Sin_psi = FG_Sin_psi;
+ Gamma_vert_rad = FG_Gamma_vert_rad;
+ Gamma_horiz_rad = FG_Gamma_horiz_rad;
+ Sigma = FG_Sigma;
+ Density = FG_Density;
+ V_sound = FG_V_sound;
+ Mach_number = FG_Mach_number;
+ Static_pressure = FG_Static_pressure;
+ Total_pressure = FG_Total_pressure;
+ Impact_pressure = FG_Impact_pressure;
+ Dynamic_pressure = FG_Dynamic_pressure;
+ Static_temperature = FG_Static_temperature;
+ Total_temperature = FG_Total_temperature;
+ Sea_level_radius = FG_Sea_level_radius;
+ Earth_position_angle = FG_Earth_position_angle;
+ Runway_altitude = FG_Runway_altitude;
+ Runway_latitude = FG_Runway_latitude;
+ Runway_longitude = FG_Runway_longitude;
+ Runway_heading = FG_Runway_heading;
+ Radius_to_rwy = FG_Radius_to_rwy;
+ D_cg_north_of_rwy = FG_D_cg_north_of_rwy;
+ D_cg_east_of_rwy = FG_D_cg_east_of_rwy;
+ D_cg_above_rwy = FG_D_cg_above_rwy;
+ X_cg_rwy = FG_X_cg_rwy;
+ Y_cg_rwy = FG_Y_cg_rwy;
+ H_cg_rwy = FG_H_cg_rwy;
+ D_pilot_north_of_rwy = FG_D_pilot_north_of_rwy;
+ D_pilot_east_of_rwy = FG_D_pilot_east_of_rwy;
+ D_pilot_above_rwy = FG_D_pilot_above_rwy;
+ X_pilot_rwy = FG_X_pilot_rwy;
+ Y_pilot_rwy = FG_Y_pilot_rwy;
+ H_pilot_rwy = FG_H_pilot_rwy;
+}
+
+
+/* Convert from the LaRCsim generic_ struct to the FG flight_params struct */
+int fgLaRCsim_2_Flight (struct flight_params *f) {
+ FG_Mass = Mass;
+ FG_I_xx = I_xx;
+ FG_I_yy = I_yy;
+ FG_I_zz = I_zz;
+ FG_I_xz = I_xz;
+ FG_Dx_pilot = Dx_pilot;
+ FG_Dy_pilot = Dy_pilot;
+ FG_Dz_pilot = Dz_pilot;
+ FG_Dx_cg = Dx_cg;
+ FG_Dy_cg = Dy_cg;
+ FG_Dz_cg = Dz_cg;
+ FG_F_X = F_X;
+ FG_F_Y = F_Y;
+ FG_F_Z = F_Z;
+ FG_F_north = F_north;
+ FG_F_east = F_east;
+ FG_F_down = F_down;
+ FG_F_X_aero = F_X_aero;
+ FG_F_Y_aero = F_Y_aero;
+ FG_F_Z_aero = F_Z_aero;
+ FG_F_X_engine = F_X_engine;
+ FG_F_Y_engine = F_Y_engine;
+ FG_F_Z_engine = F_Z_engine;
+ FG_F_X_gear = F_X_gear;
+ FG_F_Y_gear = F_Y_gear;
+ FG_F_Z_gear = F_Z_gear;
+ FG_M_l_rp = M_l_rp;
+ FG_M_m_rp = M_m_rp;
+ FG_M_n_rp = M_n_rp;
+ FG_M_l_cg = M_l_cg;
+ FG_M_m_cg = M_m_cg;
+ FG_M_n_cg = M_n_cg;
+ FG_M_l_aero = M_l_aero;
+ FG_M_m_aero = M_m_aero;
+ FG_M_n_aero = M_n_aero;
+ FG_M_l_engine = M_l_engine;
+ FG_M_m_engine = M_m_engine;
+ FG_M_n_engine = M_n_engine;
+ FG_M_l_gear = M_l_gear;
+ FG_M_m_gear = M_m_gear;
+ FG_M_n_gear = M_n_gear;
+ FG_V_dot_north = V_dot_north;
+ FG_V_dot_east = V_dot_east;
+ FG_V_dot_down = V_dot_down;
+ FG_U_dot_body = U_dot_body;
+ FG_V_dot_body = V_dot_body;
+ FG_W_dot_body = W_dot_body;
+ FG_A_X_cg = A_X_cg;
+ FG_A_Y_cg = A_Y_cg;
+ FG_A_Z_cg = A_Z_cg;
+ FG_A_X_pilot = A_X_pilot;
+ FG_A_Y_pilot = A_Y_pilot;
+ FG_A_Z_pilot = A_Z_pilot;
+ FG_N_X_cg = N_X_cg;
+ FG_N_Y_cg = N_Y_cg;
+ FG_N_Z_cg = N_Z_cg;
+ FG_N_X_pilot = N_X_pilot;
+ FG_N_Y_pilot = N_Y_pilot;
+ FG_N_Z_pilot = N_Z_pilot;
+ FG_P_dot_body = P_dot_body;
+ FG_Q_dot_body = Q_dot_body;
+ FG_R_dot_body = R_dot_body;
+ FG_V_north = V_north;
+ FG_V_east = V_east;
+ FG_V_down = V_down;
+ FG_V_north_rel_ground = V_north_rel_ground;
+ FG_V_east_rel_ground = V_east_rel_ground;
+ FG_V_down_rel_ground = V_down_rel_ground;
+ FG_V_north_airmass = V_north_airmass;
+ FG_V_east_airmass = V_east_airmass;
+ FG_V_down_airmass = V_down_airmass;
+ FG_V_north_rel_airmass = V_north_rel_airmass;
+ FG_V_east_rel_airmass = V_east_rel_airmass;
+ FG_V_down_rel_airmass = V_down_rel_airmass;
+ FG_U_gust = U_gust;
+ FG_V_gust = V_gust;
+ FG_W_gust = W_gust;
+ FG_U_body = U_body;
+ FG_V_body = V_body;
+ FG_W_body = W_body;
+ FG_V_rel_wind = V_rel_wind;
+ FG_V_true_kts = V_true_kts;
+ FG_V_rel_ground = V_rel_ground;
+ FG_V_inertial = V_inertial;
+ FG_V_ground_speed = V_ground_speed;
+ FG_V_equiv = V_equiv;
+ FG_V_equiv_kts = V_equiv_kts;
+ FG_V_calibrated = V_calibrated;
+ FG_V_calibrated_kts = V_calibrated_kts;
+ FG_P_body = P_body;
+ FG_Q_body = Q_body;
+ FG_R_body = R_body;
+ FG_P_local = P_local;
+ FG_Q_local = Q_local;
+ FG_R_local = R_local;
+ FG_P_total = P_total;
+ FG_Q_total = Q_total;
+ FG_R_total = R_total;
+ FG_Phi_dot = Phi_dot;
+ FG_Theta_dot = Theta_dot;
+ FG_Psi_dot = Psi_dot;
+ FG_Latitude_dot = Latitude_dot;
+ FG_Longitude_dot = Longitude_dot;
+ FG_Radius_dot = Radius_dot;
+ FG_Lat_geocentric = Lat_geocentric;
+ FG_Lon_geocentric = Lon_geocentric;
+ FG_Radius_to_vehicle = Radius_to_vehicle;
+ FG_Latitude = Latitude;
+ FG_Longitude = Longitude;
+ FG_Altitude = Altitude;
+ FG_Phi = Phi;
+ FG_Theta = Theta;
+ FG_Psi = Psi;
+ FG_T_local_to_body_11 = T_local_to_body_11;
+ FG_T_local_to_body_12 = T_local_to_body_12;
+ FG_T_local_to_body_13 = T_local_to_body_13;
+ FG_T_local_to_body_21 = T_local_to_body_21;
+ FG_T_local_to_body_22 = T_local_to_body_22;
+ FG_T_local_to_body_23 = T_local_to_body_23;
+ FG_T_local_to_body_31 = T_local_to_body_31;
+ FG_T_local_to_body_32 = T_local_to_body_32;
+ FG_T_local_to_body_33 = T_local_to_body_33;
+ FG_Gravity = Gravity;
+ FG_Centrifugal_relief = Centrifugal_relief;
+ FG_Alpha = Alpha;
+ FG_Beta = Beta;
+ FG_Alpha_dot = Alpha_dot;
+ FG_Beta_dot = Beta_dot;
+ FG_Cos_alpha = Cos_alpha;
+ FG_Sin_alpha = Sin_alpha;
+ FG_Cos_beta = Cos_beta;
+ FG_Sin_beta = Sin_beta;
+ FG_Cos_phi = Cos_phi;
+ FG_Sin_phi = Sin_phi;
+ FG_Cos_theta = Cos_theta;
+ FG_Sin_theta = Sin_theta;
+ FG_Cos_psi = Cos_psi;
+ FG_Sin_psi = Sin_psi;
+ FG_Gamma_vert_rad = Gamma_vert_rad;
+ FG_Gamma_horiz_rad = Gamma_horiz_rad;
+ FG_Sigma = Sigma;
+ FG_Density = Density;
+ FG_V_sound = V_sound;
+ FG_Mach_number = Mach_number;
+ FG_Static_pressure = Static_pressure;
+ FG_Total_pressure = Total_pressure;
+ FG_Impact_pressure = Impact_pressure;
+ FG_Dynamic_pressure = Dynamic_pressure;
+ FG_Static_temperature = Static_temperature;
+ FG_Total_temperature = Total_temperature;
+ FG_Sea_level_radius = Sea_level_radius;
+ FG_Earth_position_angle = Earth_position_angle;
+ FG_Runway_altitude = Runway_altitude;
+ FG_Runway_latitude = Runway_latitude;
+ FG_Runway_longitude = Runway_longitude;
+ FG_Runway_heading = Runway_heading;
+ FG_Radius_to_rwy = Radius_to_rwy;
+ FG_D_cg_north_of_rwy = D_cg_north_of_rwy;
+ FG_D_cg_east_of_rwy = D_cg_east_of_rwy;
+ FG_D_cg_above_rwy = D_cg_above_rwy;
+ FG_X_cg_rwy = X_cg_rwy;
+ FG_Y_cg_rwy = Y_cg_rwy;
+ FG_H_cg_rwy = H_cg_rwy;
+ FG_D_pilot_north_of_rwy = D_pilot_north_of_rwy;
+ FG_D_pilot_east_of_rwy = D_pilot_east_of_rwy;
+ FG_D_pilot_above_rwy = D_pilot_above_rwy;
+ FG_X_pilot_rwy = X_pilot_rwy;
+ FG_Y_pilot_rwy = Y_pilot_rwy;
+ FG_H_pilot_rwy = H_pilot_rwy;
+}
+
/* Flight Gear Modification Log
*
* $Log$
+ * Revision 1.2 1997/05/29 22:39:59 curt
+ * Working on incorporating the LaRCsim flight model.
+ *
* Revision 1.1 1997/05/29 00:09:57 curt
* Initial Flight Gear revision.
*
#define LS_INTERFACE_H
+#include "../flight.h"
+
+
/* reset flight params to a specific position */
int fgLaRCsimInit(double dt);
/* update position based on inputs, positions, velocities, etc. */
-int fgLaRCsimUpdate();
+int fgLaRCsimUpdate(int multiloop);
#endif LS_INTERFACE_H
/* $Log$
-/* Revision 1.1 1997/05/29 00:09:58 curt
-/* Initial Flight Gear revision.
+/* Revision 1.2 1997/05/29 22:39:59 curt
+/* Working on incorporating the LaRCsim flight model.
/*
+ * Revision 1.1 1997/05/29 00:09:58 curt
+ * Initial Flight Gear revision.
+ *
*/
if (init || sim_control_.sim_type != cockpit)
Throttle[3] = Throttle_pct;
- F_X_engine = Throttle[3]*813.4/0.2;
- F_Z_engine = Throttle[3]*11.36/0.2;
+ /* F_X_engine = Throttle[3]*813.4/0.2; */ /* original code */
+ /* F_Z_engine = Throttle[3]*11.36/0.2; */ /* original code */
+ F_X_engine = Throttle[3]*813.4/0.85;
+ F_Z_engine = Throttle[3]*11.36/0.85;
Throttle_pct = Throttle[3];
}
#include <stdio.h>
#include <stdlib.h>
#include <signal.h> /* for timer routines */
-#include <sys/time.h> /* for timer routines */
+
+#if defined(__WATCOMC__) || defined(__MSC__)
+# include <time.h>
+#else
+# include <sys/time.h>
+#endif
#ifdef GLUT
#include <GL/glut.h>
#include "../aircraft/aircraft.h"
#include "../scenery/scenery.h"
+#define FG_LON_2_DEG(RAD) ((RAD) * 180.0 / M_PI)
+#define FG_LAT_2_DEG(RAD) (-1.0 * (RAD) * 180.0 / M_PI)
+
+#define FG_DEG_2_LON(DEG) ((DEG) * M_PI / 180.0)
+#define FG_DEG_2_LAT(DEG) (-1.0 * (DEG) * M_PI / 180.0)
+
/* This is a record containing all the info for the aircraft currently
being operated */
struct aircraft_params current_aircraft;
/* Another hack */
#define DEFAULT_MODEL_HZ 20
+#define DEFAULT_MULTILOOP 6
double Simtime;
-int Overrun;
-int model_dt;
/**************************************************************************
**************************************************************************/
static void fgUpdateViewParams() {
+ double pos_x, pos_y, pos_z;
struct flight_params *f;
f = ¤t_aircraft.flight;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- gluLookAt(f->pos_x, f->pos_y, f->pos_z,
- f->pos_x + cos(f->Psi), f->pos_y + sin(f->Psi), f->pos_z,
+
+ pos_x = FG_LAT_2_DEG(FG_Latitude) * 3600.0;
+ pos_y = FG_LON_2_DEG(FG_Longitude) * 3600.0;
+ pos_z = FG_Altitude;
+
+ gluLookAt(pos_x, pos_y, pos_z,
+ pos_x + cos(FG_Psi), pos_y + sin(FG_Psi), pos_z,
0.0, 0.0, 1.0);
}
/* This routine catches the SIGALRM */
void fgTimerCatch() {
+ struct flight_params *f;
static double lastSimtime = -99.9;
+ int Overrun;
+
+ f = ¤t_aircraft.flight;
/* printf("In fgTimerCatch()\n"); */
} */
/* update the flight model */
- fgSlewUpdate();
+ fgFlightModelUpdate(FG_LARCSIM, f, DEFAULT_MULTILOOP);
lastSimtime = Simtime;
signal(SIGALRM, fgTimerCatch);
**************************************************************************/
int main( int argc, char *argv[] ) {
+ struct flight_params *f;
+
+ f = ¤t_aircraft.flight;
+
/* parse the scenery file */
parse_scenery(argv[1]);
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
/* Define initial window size */
- glutInitWindowSize(640, 400);
+ glutInitWindowSize(640, 480);
/* Initialize the main window */
glutCreateWindow("Terrain Demo");
#elif MESA_TK
/* Define initial window size */
- tkInitPosition(0, 0, 640, 400);
+ tkInitPosition(0, 0, 640, 480);
/* Define Display Parameters */
tkInitDisplayMode( TK_RGB | TK_DEPTH | TK_DOUBLE | TK_DIRECT );
/* setup view parameters, only makes GL calls */
fgInitVisuals();
+ /* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
+
+ /* Initial Position */
+ FG_Latitude = FG_DEG_2_LAT( -398673.28 / 3600.0 );
+ FG_Longitude = FG_DEG_2_LON( 120625.64 / 3600.0 );
+ FG_Altitude = 3.758099E+00;
+
+ printf("Initial position is: (%.4f, %.4f, %.2f)\n", FG_Latitude,
+ FG_Longitude, FG_Altitude);
+
+ /* Initial Velocity */
+ FG_V_north = 0.0 /* 7.287719E+00 */;
+ FG_V_east = 0.0 /* 1.521770E+03 */;
+ FG_V_down = 0.0 /* -1.265722E-05 */;
+
+ /* Initial Orientation */
+ FG_Phi = -2.658474E-06;
+ FG_Theta = 7.401790E-03;
+ FG_Psi = 1.391358E-03;
+
+ /* Initial Angular B rates */
+ FG_P_body = 7.206685E-05;
+ FG_Q_body = 0.000000E+00;
+ FG_R_body = 9.492658E-05;
+
+ FG_Earth_position_angle = 0.000000E+00;
+
+ /* Mass properties and geometry values */
+ FG_Mass = 8.547270E+01;
+ FG_I_xx = 1.048000E+03;
+ FG_I_yy = 3.000000E+03;
+ FG_I_zz = 3.530000E+03;
+ FG_I_xz = 0.000000E+00;
+
+ /* CG position w.r.t. ref. point */
+ FG_Dx_cg = 0.000000E+00;
+ FG_Dy_cg = 0.000000E+00;
+ FG_Dz_cg = 0.000000E+00;
+
/* Set initial position and slew parameters */
/* fgSlewInit(-398391.3, 120070.4, 244, 3.1415); */ /* GLOBE Airport */
/* fgSlewInit(-335340,162540, 15, 4.38); */
- fgSlewInit(-398673.28,120625.64, 53, 4.38);
+ /* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
+
+ fgFlightModelInit(FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ);
/* build all objects */
fgSceneryInit();
/* $Log$
-/* Revision 1.6 1997/05/29 12:31:39 curt
-/* Minor tweaks, moving towards general flight model integration.
+/* Revision 1.7 1997/05/29 22:39:49 curt
+/* Working on incorporating the LaRCsim flight model.
/*
+ * Revision 1.6 1997/05/29 12:31:39 curt
+ * Minor tweaks, moving towards general flight model integration.
+ *
* Revision 1.5 1997/05/29 02:33:23 curt
* Updated to reflect changing interfaces in other "modules."
*
CFILES = GLmain.c $(INTERFACE_FILES) mesh2GL.c
OFILES = $(CFILES:.c=.o)
AFILES = ../flight/libflight.a ../flight/slew/libslew.a \
- ../aircraft/libaircraft.a ../scenery/libscenery.a
+ ../flight/LaRCsim/libLaRCsim.a ../aircraft/libaircraft.a \
+ ../scenery/libscenery.a
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.7 1997/05/29 22:39:50 curt
+# Working on incorporating the LaRCsim flight model.
+#
# Revision 1.6 1997/05/29 02:33:23 curt
# Updated to reflect changing interfaces in other "modules."
#
int i, j, istep, jstep, iend, jend;
float temp;
- istep = jstep = 8; /* Detail level 1 -- 1200 ... */
+ istep = jstep = 100; /* Detail level 1 -- 1200 ... */
mesh = glGenLists(1);
glNewList(mesh, GL_COMPILE);
/* $Log$
-/* Revision 1.8 1997/05/29 12:31:40 curt
-/* Minor tweaks, moving towards general flight model integration.
+/* Revision 1.9 1997/05/29 22:39:51 curt
+/* Working on incorporating the LaRCsim flight model.
/*
+ * Revision 1.8 1997/05/29 12:31:40 curt
+ * Minor tweaks, moving towards general flight model integration.
+ *
* Revision 1.7 1997/05/29 02:33:24 curt
* Updated to reflect changing interfaces in other "modules."
*
#include "../../controls/controls.h"
+#ifndef M_PI
+#define M_PI 3.14159265358979323846 /* pi */
+#endif
+
#ifndef PI2
#define PI2 (M_PI + M_PI)
#endif
f = ¤t_aircraft.flight;
- f->pos_x = pos_x;
+ /* f->pos_x = pos_x;
f->pos_y = pos_y;
f->pos_z = pos_z;
f->vel_Theta = 0.0;
f->vel_Psi = 0.0;
- f->Psi = heading;
+ f->Psi = heading; */
}
f = ¤t_aircraft.flight;
c = ¤t_aircraft.controls;
- f->Psi += ( c->aileron / 8 );
+ /* f->Psi += ( c->aileron / 8 );
if ( f->Psi > PI2 ) {
f->Psi -= PI2;
} else if ( f->Psi < 0 ) {
f->vel_x = -c->elev;
f->pos_x = f->pos_x + (cos(f->Psi) * f->vel_x);
- f->pos_y = f->pos_y + (sin(f->Psi) * f->vel_x);
+ f->pos_y = f->pos_y + (sin(f->Psi) * f->vel_x); */
}
/* $Log$
-/* Revision 1.2 1997/05/29 12:30:19 curt
-/* Some initial mods to work better in a timer environment.
+/* Revision 1.3 1997/05/29 22:40:00 curt
+/* Working on incorporating the LaRCsim flight model.
/*
+ * Revision 1.2 1997/05/29 12:30:19 curt
+ * Some initial mods to work better in a timer environment.
+ *
* Revision 1.1 1997/05/29 02:29:42 curt
* Moved to their own directory.
*