1
0
Fork 0

Make LaRCsim work again when UIUC is dissabled. Unfortunately only the c172 seems to be stable. The Navion and Cherokee fail to trim at the runway.

This commit is contained in:
Erik Hofman 2020-09-30 15:39:30 +02:00
parent b1b12a924f
commit 88c2b7a833
4 changed files with 20 additions and 6 deletions

View file

@ -34,9 +34,11 @@
#include <Aircraft/controls.hxx>
#include <FDM/flight.hxx>
#include <FDM/UIUCModel/uiuc_aircraft.h>
#include <Main/fg_props.hxx>
#include <Model/acmodel.hxx>
#if ENABLE_UIUC_MODEL
# include <FDM/UIUCModel/uiuc_aircraft.h>
#endif
#include "ls_cockpit.h"
#include "ls_generic.h"
@ -317,6 +319,7 @@ void FGLaRCsim::update( double dt ) {
fgSetDouble("/engines/engine/running", 1);
// if flying uiuc, set some properties and over-ride some previous ones
#if ENABLE_UIUC_MODEL
if ( !strcmp(aero->getStringValue(), "uiuc")) {
// surface positions and other general properties
@ -408,7 +411,6 @@ void FGLaRCsim::update( double dt ) {
}
}
// add Gamma_horiz_deg to properties, mss 021213
if (use_gamma_horiz_on_speed) {
if (V_rel_wind > gamma_horiz_on_speed) {
@ -421,6 +423,7 @@ void FGLaRCsim::update( double dt ) {
else {
fgSetDouble("/orientation/gamma-horiz-deg", fgGetDouble("/orientation/heading-deg"));
}
#endif // ENABLE_UIUC_MODEL
ls_update(multiloop);
// printf("%d FG_Altitude = %.2f\n", i, FG_Altitude * 0.3048);
@ -757,6 +760,7 @@ bool FGLaRCsim::copy_from_LaRCsim() {
_set_Climb_Rate( -1 * V_down );
// cout << "climb rate = " << -V_down * 60 << endl;
#if ENABLE_UIUC_MODEL
if ( !strcmp(aero->getStringValue(), "uiuc") ) {
if (pilot_elev_no) {
globals->get_controls()->set_elevator(Long_control);
@ -777,6 +781,7 @@ bool FGLaRCsim::copy_from_LaRCsim() {
// controls.set_throttle(0,Throttle_pct);
}
}
#endif
return true;
}

View file

@ -204,6 +204,7 @@ void ls_model( SCALAR dt, int Initialize ) {
basic_gear( dt, Initialize );
break;
case UIUC:
#if ENABLE_UIUC_MODEL
inertias( dt, Initialize );
subsystems( dt, Initialize );
// During initialization period, re-initialize velocities
@ -216,6 +217,7 @@ void ls_model( SCALAR dt, int Initialize ) {
uiuc_gear_2_wrapper( dt, Initialize );
uiuc_network_send_2_wrapper();
uiuc_record_2_wrapper(dt);
#endif
break;
}
}

View file

@ -297,8 +297,6 @@ Initial Flight Gear revision.
--------------------------------------------------------------------------*/
#include "FDM/UIUCModel/uiuc_wrapper.h"
#include "ls_types.h"
#include "ls_constants.h"
#include "ls_generic.h"
@ -315,6 +313,9 @@ Initial Flight Gear revision.
extern Model current_model; /* defined in ls_model.c */
extern SCALAR Simtime; /* defined in ls_main.c */
#if ENABLE_UIUC_MODEL
# include "FDM/UIUCModel/uiuc_wrapper.h"
void uiuc_init_vars() {
static int init = 0;
@ -325,7 +326,7 @@ void uiuc_init_vars() {
uiuc_initial_init();
}
#endif
void ls_step( SCALAR dt, int Initialize ) {
static int inited = 0;
@ -366,10 +367,11 @@ void ls_step( SCALAR dt, int Initialize ) {
/* Initialize quaternions and transformation matrix from Euler angles */
// Initialize UIUC aircraft model
#if ENABLE_UIUC_MODEL
if (current_model == UIUC) {
uiuc_init_2_wrapper();
}
#endif
e_0 = cos(Psi*0.5)*cos(Theta*0.5)*cos(Phi*0.5)
+ sin(Psi*0.5)*sin(Theta*0.5)*sin(Phi*0.5);
e_1 = cos(Psi*0.5)*cos(Theta*0.5)*sin(Phi*0.5)
@ -388,11 +390,13 @@ void ls_step( SCALAR dt, int Initialize ) {
T_local_to_body_32 = 2*(e_2*e_3 - e_0*e_1);
T_local_to_body_33 = e_0*e_0 - e_1*e_1 - e_2*e_2 + e_3*e_3;
#ifdef ENABLE_UIUC_MODEL
// Initialize local velocities (V_north, V_east, V_down)
// based on transformation matrix calculated above
if (current_model == UIUC) {
uiuc_local_vel_init();
}
#endif
/* Calculate local gravitation acceleration */

View file

@ -53,6 +53,7 @@
--------------------------------------------------------------------------*/
#if ENABLE_UIUC_MODEL
#include <math.h>
#include "ls_types.h"
@ -121,3 +122,5 @@ void uiuc_network_send_2_wrapper()
{
uiuc_network_send_routine();
}
#endif // ENABLE_UIUC_MODEL