2000-03-22 22:01:33 +00:00
|
|
|
/**********************************************************************
|
2000-09-06 19:52:37 +00:00
|
|
|
|
|
|
|
FILENAME: uiuc_wrapper.cpp
|
2000-03-22 22:01:33 +00:00
|
|
|
|
2000-09-06 19:52:37 +00:00
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
DESCRIPTION: A wrapper(interface) between the UIUC Aeromodel (C++ files)
|
|
|
|
and the LaRCsim FDM (C files)
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
STATUS: alpha version
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
REFERENCES:
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
HISTORY: 01/26/2000 initial release
|
From: David Megginson <david@megginson.com>
I have created a set of patches to provide configurable landing gear
for the UIUC models. The patches (including four new files) are
available at
http://megginson.com/private/fgfs/uiuc-20010309.tar.gz
A modified UIUC configuration file for the Twin Otter (DHC-6) is
available at
http://megginson.com/private/fgfs/aircraft.dat
It should be possible to configure appropriate gear for all of the
UIUC models now. As a bonus, the models also support braking, both
absolute and differential, as well as nose-wheel steering (all of
which are currently missing from the UIUC models) -- when you land,
you don't have to keep rolling off the end of the runway anymore, and
you don't have to bank to steer in a taxi.
My sample configuration file contains absolutely bizarre, wild
guesses, and many places that I didn't even bother to guess properly.
The only actual data I had was the wing-span of the DHC-6 (65ft),
which I used for positioning the wing tips. The wing-tips for this
model actually work now -- I hit the aileron hard while accelerating
for take-off, and the wingtip noticeably strikes the ground and
bounces up (quite dramatic in external view using the DHC-6 model from
Wolfram's site).
Details
-------
The UIUC models now support up to 16 gear points each where a gear
point is anything in the aircraft that can come in contact with the
ground, including the tail and wing-tips. I have added the following
new fields to the UIUC configuration files, where <index> is an
integer between 0 and 15, and <value> is a real number:
gear <index> Dx_gear <value> # x offset from CG [ft]
gear <index> Dy_gear <value> # y offset from CG [ft]
gear <index> Dz_gear <value> # z offset from CG [ft]
gear <index> cgear <value> # spring damping [lbs/ft/sec]
gear <index> kgear <value> # springiness [lbs/ft]
gear <index> muGear <value> # rolling coefficient
gear <index> strutLength <value> # gear travel [ft] (not yet used)
Most of these names were already pencilled into the UIUC documentation
(as TODO items), but I had to make up Dx_gear, Dy_gear, and Dz_gear --
if those are inappropriate, I'd appreciate suggestions for better
names.
It will be necessary to modify the other UIUC configuration files to
include some kind of gear support as well, or the planes will sink
nose-first into the ground down to their CG's (it's actually quite
funny to watch with an external view).
Background
----------
As I frequently remind everyone here, I have no math background worth
spitting at, so I will not even pretend to have done the hard stuff.
The UIUC code uses a copy of a very old version of the LaRCsim
c172_gear.c -- I wanted to update it with Tony Peden's excellent newer
version, which includes differential braking among other goodies (the
UIUC models don't support brakes, period).
I copied the newer code into uiuc_aero.c, and it compiled and ran, but
all of the planes ended up sitting on their tails with their noses in
the air. Since Tony made his gear code nicely parameterized, I
experimented with different values, and found that it wasn't too hard
to balance the Twin Otter by moving the gear back a bit. At first, I
used properties to set different values, but then I decided to
integrate the whole thing properly into the UIUC configuration
framework. Thanks to Tony Peden, who did the real modelling work -- I
can take credit only for two or three hours of integration. It turns
out that Tony's code is generalized enough to deal with a wide range
of different gear structures -- I suspect that it will even work for
the 747, when I get around to trying some values.
2001-03-29 03:16:25 +00:00
|
|
|
03/09/2001 (DPM) added support for gear
|
2000-09-06 19:52:37 +00:00
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
|
From: David Megginson <david@megginson.com>
I have created a set of patches to provide configurable landing gear
for the UIUC models. The patches (including four new files) are
available at
http://megginson.com/private/fgfs/uiuc-20010309.tar.gz
A modified UIUC configuration file for the Twin Otter (DHC-6) is
available at
http://megginson.com/private/fgfs/aircraft.dat
It should be possible to configure appropriate gear for all of the
UIUC models now. As a bonus, the models also support braking, both
absolute and differential, as well as nose-wheel steering (all of
which are currently missing from the UIUC models) -- when you land,
you don't have to keep rolling off the end of the runway anymore, and
you don't have to bank to steer in a taxi.
My sample configuration file contains absolutely bizarre, wild
guesses, and many places that I didn't even bother to guess properly.
The only actual data I had was the wing-span of the DHC-6 (65ft),
which I used for positioning the wing tips. The wing-tips for this
model actually work now -- I hit the aileron hard while accelerating
for take-off, and the wingtip noticeably strikes the ground and
bounces up (quite dramatic in external view using the DHC-6 model from
Wolfram's site).
Details
-------
The UIUC models now support up to 16 gear points each where a gear
point is anything in the aircraft that can come in contact with the
ground, including the tail and wing-tips. I have added the following
new fields to the UIUC configuration files, where <index> is an
integer between 0 and 15, and <value> is a real number:
gear <index> Dx_gear <value> # x offset from CG [ft]
gear <index> Dy_gear <value> # y offset from CG [ft]
gear <index> Dz_gear <value> # z offset from CG [ft]
gear <index> cgear <value> # spring damping [lbs/ft/sec]
gear <index> kgear <value> # springiness [lbs/ft]
gear <index> muGear <value> # rolling coefficient
gear <index> strutLength <value> # gear travel [ft] (not yet used)
Most of these names were already pencilled into the UIUC documentation
(as TODO items), but I had to make up Dx_gear, Dy_gear, and Dz_gear --
if those are inappropriate, I'd appreciate suggestions for better
names.
It will be necessary to modify the other UIUC configuration files to
include some kind of gear support as well, or the planes will sink
nose-first into the ground down to their CG's (it's actually quite
funny to watch with an external view).
Background
----------
As I frequently remind everyone here, I have no math background worth
spitting at, so I will not even pretend to have done the hard stuff.
The UIUC code uses a copy of a very old version of the LaRCsim
c172_gear.c -- I wanted to update it with Tony Peden's excellent newer
version, which includes differential braking among other goodies (the
UIUC models don't support brakes, period).
I copied the newer code into uiuc_aero.c, and it compiled and ran, but
all of the planes ended up sitting on their tails with their noses in
the air. Since Tony made his gear code nicely parameterized, I
experimented with different values, and found that it wasn't too hard
to balance the Twin Otter by moving the gear back a bit. At first, I
used properties to set different values, but then I decided to
integrate the whole thing properly into the UIUC configuration
framework. Thanks to Tony Peden, who did the real modelling work -- I
can take credit only for two or three hours of integration. It turns
out that Tony's code is generalized enough to deal with a wide range
of different gear structures -- I suspect that it will even work for
the 747, when I get around to trying some values.
2001-03-29 03:16:25 +00:00
|
|
|
David Megginson <david@megginson.com>
|
2000-09-06 19:52:37 +00:00
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
VARIABLES:
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
INPUTS: *
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
OUTPUTS: *
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
CALLED BY: *
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
CALLS TO: *
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
COPYRIGHT: (C) 2000 by Michael Selig
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
|
|
USA or view http://www.gnu.org/copyleft/gpl.html.
|
|
|
|
|
|
|
|
**********************************************************************/
|
2000-03-22 22:01:33 +00:00
|
|
|
|
2000-10-02 21:49:04 +00:00
|
|
|
#include <simgear/compiler.h>
|
|
|
|
|
2000-03-22 22:01:33 +00:00
|
|
|
#include "uiuc_aircraft.h"
|
|
|
|
#include "uiuc_aircraftdir.h"
|
|
|
|
#include "uiuc_coefficients.h"
|
|
|
|
#include "uiuc_engine.h"
|
From: David Megginson <david@megginson.com>
I have created a set of patches to provide configurable landing gear
for the UIUC models. The patches (including four new files) are
available at
http://megginson.com/private/fgfs/uiuc-20010309.tar.gz
A modified UIUC configuration file for the Twin Otter (DHC-6) is
available at
http://megginson.com/private/fgfs/aircraft.dat
It should be possible to configure appropriate gear for all of the
UIUC models now. As a bonus, the models also support braking, both
absolute and differential, as well as nose-wheel steering (all of
which are currently missing from the UIUC models) -- when you land,
you don't have to keep rolling off the end of the runway anymore, and
you don't have to bank to steer in a taxi.
My sample configuration file contains absolutely bizarre, wild
guesses, and many places that I didn't even bother to guess properly.
The only actual data I had was the wing-span of the DHC-6 (65ft),
which I used for positioning the wing tips. The wing-tips for this
model actually work now -- I hit the aileron hard while accelerating
for take-off, and the wingtip noticeably strikes the ground and
bounces up (quite dramatic in external view using the DHC-6 model from
Wolfram's site).
Details
-------
The UIUC models now support up to 16 gear points each where a gear
point is anything in the aircraft that can come in contact with the
ground, including the tail and wing-tips. I have added the following
new fields to the UIUC configuration files, where <index> is an
integer between 0 and 15, and <value> is a real number:
gear <index> Dx_gear <value> # x offset from CG [ft]
gear <index> Dy_gear <value> # y offset from CG [ft]
gear <index> Dz_gear <value> # z offset from CG [ft]
gear <index> cgear <value> # spring damping [lbs/ft/sec]
gear <index> kgear <value> # springiness [lbs/ft]
gear <index> muGear <value> # rolling coefficient
gear <index> strutLength <value> # gear travel [ft] (not yet used)
Most of these names were already pencilled into the UIUC documentation
(as TODO items), but I had to make up Dx_gear, Dy_gear, and Dz_gear --
if those are inappropriate, I'd appreciate suggestions for better
names.
It will be necessary to modify the other UIUC configuration files to
include some kind of gear support as well, or the planes will sink
nose-first into the ground down to their CG's (it's actually quite
funny to watch with an external view).
Background
----------
As I frequently remind everyone here, I have no math background worth
spitting at, so I will not even pretend to have done the hard stuff.
The UIUC code uses a copy of a very old version of the LaRCsim
c172_gear.c -- I wanted to update it with Tony Peden's excellent newer
version, which includes differential braking among other goodies (the
UIUC models don't support brakes, period).
I copied the newer code into uiuc_aero.c, and it compiled and ran, but
all of the planes ended up sitting on their tails with their noses in
the air. Since Tony made his gear code nicely parameterized, I
experimented with different values, and found that it wasn't too hard
to balance the Twin Otter by moving the gear back a bit. At first, I
used properties to set different values, but then I decided to
integrate the whole thing properly into the UIUC configuration
framework. Thanks to Tony Peden, who did the real modelling work -- I
can take credit only for two or three hours of integration. It turns
out that Tony's code is generalized enough to deal with a wide range
of different gear structures -- I suspect that it will even work for
the 747, when I get around to trying some values.
2001-03-29 03:16:25 +00:00
|
|
|
#include "uiuc_gear.h"
|
2000-03-22 22:01:33 +00:00
|
|
|
#include "uiuc_aerodeflections.h"
|
|
|
|
#include "uiuc_recorder.h"
|
|
|
|
#include "uiuc_menu.h"
|
2000-09-06 19:52:37 +00:00
|
|
|
#include "uiuc_betaprobe.h"
|
2000-09-26 21:44:52 +00:00
|
|
|
#include <FDM/LaRCsim/ls_generic.h>
|
2000-03-22 22:01:33 +00:00
|
|
|
|
2001-04-13 21:00:07 +00:00
|
|
|
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
|
2001-03-23 22:59:18 +00:00
|
|
|
SG_USING_STD(cout);
|
|
|
|
SG_USING_STD(endl);
|
2001-04-13 21:00:07 +00:00
|
|
|
#endif
|
2000-10-02 21:49:04 +00:00
|
|
|
|
2000-03-22 22:01:33 +00:00
|
|
|
extern "C" void uiuc_init_aeromodel ();
|
|
|
|
extern "C" void uiuc_force_moment(double dt);
|
|
|
|
extern "C" void uiuc_engine_routine();
|
From: David Megginson <david@megginson.com>
I have created a set of patches to provide configurable landing gear
for the UIUC models. The patches (including four new files) are
available at
http://megginson.com/private/fgfs/uiuc-20010309.tar.gz
A modified UIUC configuration file for the Twin Otter (DHC-6) is
available at
http://megginson.com/private/fgfs/aircraft.dat
It should be possible to configure appropriate gear for all of the
UIUC models now. As a bonus, the models also support braking, both
absolute and differential, as well as nose-wheel steering (all of
which are currently missing from the UIUC models) -- when you land,
you don't have to keep rolling off the end of the runway anymore, and
you don't have to bank to steer in a taxi.
My sample configuration file contains absolutely bizarre, wild
guesses, and many places that I didn't even bother to guess properly.
The only actual data I had was the wing-span of the DHC-6 (65ft),
which I used for positioning the wing tips. The wing-tips for this
model actually work now -- I hit the aileron hard while accelerating
for take-off, and the wingtip noticeably strikes the ground and
bounces up (quite dramatic in external view using the DHC-6 model from
Wolfram's site).
Details
-------
The UIUC models now support up to 16 gear points each where a gear
point is anything in the aircraft that can come in contact with the
ground, including the tail and wing-tips. I have added the following
new fields to the UIUC configuration files, where <index> is an
integer between 0 and 15, and <value> is a real number:
gear <index> Dx_gear <value> # x offset from CG [ft]
gear <index> Dy_gear <value> # y offset from CG [ft]
gear <index> Dz_gear <value> # z offset from CG [ft]
gear <index> cgear <value> # spring damping [lbs/ft/sec]
gear <index> kgear <value> # springiness [lbs/ft]
gear <index> muGear <value> # rolling coefficient
gear <index> strutLength <value> # gear travel [ft] (not yet used)
Most of these names were already pencilled into the UIUC documentation
(as TODO items), but I had to make up Dx_gear, Dy_gear, and Dz_gear --
if those are inappropriate, I'd appreciate suggestions for better
names.
It will be necessary to modify the other UIUC configuration files to
include some kind of gear support as well, or the planes will sink
nose-first into the ground down to their CG's (it's actually quite
funny to watch with an external view).
Background
----------
As I frequently remind everyone here, I have no math background worth
spitting at, so I will not even pretend to have done the hard stuff.
The UIUC code uses a copy of a very old version of the LaRCsim
c172_gear.c -- I wanted to update it with Tony Peden's excellent newer
version, which includes differential braking among other goodies (the
UIUC models don't support brakes, period).
I copied the newer code into uiuc_aero.c, and it compiled and ran, but
all of the planes ended up sitting on their tails with their noses in
the air. Since Tony made his gear code nicely parameterized, I
experimented with different values, and found that it wasn't too hard
to balance the Twin Otter by moving the gear back a bit. At first, I
used properties to set different values, but then I decided to
integrate the whole thing properly into the UIUC configuration
framework. Thanks to Tony Peden, who did the real modelling work -- I
can take credit only for two or three hours of integration. It turns
out that Tony's code is generalized enough to deal with a wide range
of different gear structures -- I suspect that it will even work for
the 747, when I get around to trying some values.
2001-03-29 03:16:25 +00:00
|
|
|
extern "C" void uiuc_gear_routine();
|
2000-03-22 22:01:33 +00:00
|
|
|
|
2000-05-23 22:08:00 +00:00
|
|
|
AIRCRAFT *aircraft_ = new AIRCRAFT;
|
|
|
|
AIRCRAFTDIR *aircraftdir_ = new AIRCRAFTDIR;
|
2000-03-22 22:01:33 +00:00
|
|
|
|
|
|
|
void uiuc_init_aeromodel ()
|
|
|
|
{
|
|
|
|
string aircraft;
|
|
|
|
|
2001-04-13 21:00:07 +00:00
|
|
|
if (aircraft_dir != (string)"")
|
2000-03-22 22:01:33 +00:00
|
|
|
aircraft = aircraft_dir + "/";
|
|
|
|
|
|
|
|
aircraft += "aircraft.dat";
|
|
|
|
cout << "We are using "<< aircraft << endl;
|
|
|
|
uiuc_initializemaps(); // Initialize the <string,int> maps
|
|
|
|
uiuc_menu(aircraft); // Read the specified aircraft file
|
|
|
|
}
|
|
|
|
|
|
|
|
void uiuc_force_moment(double dt)
|
|
|
|
{
|
|
|
|
double qS = Dynamic_pressure * Sw;
|
|
|
|
double qScbar = qS * cbar;
|
|
|
|
double qSb = qS * bw;
|
|
|
|
|
2000-09-06 19:52:37 +00:00
|
|
|
uiuc_aerodeflections(dt);
|
2000-03-22 22:01:33 +00:00
|
|
|
uiuc_coefficients();
|
2000-09-06 19:52:37 +00:00
|
|
|
|
2000-03-22 22:01:33 +00:00
|
|
|
/* Calculate the wind axis forces */
|
2000-09-06 19:52:37 +00:00
|
|
|
if (CX && CZ)
|
|
|
|
{
|
|
|
|
CD = -CX * cos(Alpha) - CZ * sin(Alpha);
|
|
|
|
CL = CX * sin(Alpha) - CZ * cos(Alpha);
|
|
|
|
}
|
2000-03-22 22:01:33 +00:00
|
|
|
F_X_wind = -1 * CD * qS;
|
|
|
|
F_Y_wind = CY * qS;
|
|
|
|
F_Z_wind = -1 * CL * qS;
|
2000-09-06 19:52:37 +00:00
|
|
|
|
2000-03-22 22:01:33 +00:00
|
|
|
/* wind-axis to body-axis transformation */
|
|
|
|
F_X_aero = F_X_wind * Cos_alpha * Cos_beta - F_Y_wind * Cos_alpha * Sin_beta - F_Z_wind * Sin_alpha;
|
|
|
|
F_Y_aero = F_X_wind * Sin_beta + F_Y_wind * Cos_beta;
|
|
|
|
F_Z_aero = F_X_wind * Sin_alpha * Cos_beta - F_Y_wind * Sin_alpha * Sin_beta + F_Z_wind * Cos_alpha;
|
2000-09-06 19:52:37 +00:00
|
|
|
|
|
|
|
/* Moment calculations */
|
2000-03-22 22:01:33 +00:00
|
|
|
M_l_aero = Cl * qSb;
|
|
|
|
M_m_aero = Cm * qScbar;
|
2000-09-06 19:52:37 +00:00
|
|
|
M_n_aero = Cn * qSb;
|
2000-03-22 22:01:33 +00:00
|
|
|
|
2000-09-06 19:52:37 +00:00
|
|
|
/* Call fligt data recorder */
|
|
|
|
if (Simtime >= recordStartTime)
|
|
|
|
uiuc_recorder(dt);
|
2000-03-22 22:01:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void uiuc_engine_routine()
|
|
|
|
{
|
|
|
|
uiuc_engine();
|
|
|
|
}
|
|
|
|
|
From: David Megginson <david@megginson.com>
I have created a set of patches to provide configurable landing gear
for the UIUC models. The patches (including four new files) are
available at
http://megginson.com/private/fgfs/uiuc-20010309.tar.gz
A modified UIUC configuration file for the Twin Otter (DHC-6) is
available at
http://megginson.com/private/fgfs/aircraft.dat
It should be possible to configure appropriate gear for all of the
UIUC models now. As a bonus, the models also support braking, both
absolute and differential, as well as nose-wheel steering (all of
which are currently missing from the UIUC models) -- when you land,
you don't have to keep rolling off the end of the runway anymore, and
you don't have to bank to steer in a taxi.
My sample configuration file contains absolutely bizarre, wild
guesses, and many places that I didn't even bother to guess properly.
The only actual data I had was the wing-span of the DHC-6 (65ft),
which I used for positioning the wing tips. The wing-tips for this
model actually work now -- I hit the aileron hard while accelerating
for take-off, and the wingtip noticeably strikes the ground and
bounces up (quite dramatic in external view using the DHC-6 model from
Wolfram's site).
Details
-------
The UIUC models now support up to 16 gear points each where a gear
point is anything in the aircraft that can come in contact with the
ground, including the tail and wing-tips. I have added the following
new fields to the UIUC configuration files, where <index> is an
integer between 0 and 15, and <value> is a real number:
gear <index> Dx_gear <value> # x offset from CG [ft]
gear <index> Dy_gear <value> # y offset from CG [ft]
gear <index> Dz_gear <value> # z offset from CG [ft]
gear <index> cgear <value> # spring damping [lbs/ft/sec]
gear <index> kgear <value> # springiness [lbs/ft]
gear <index> muGear <value> # rolling coefficient
gear <index> strutLength <value> # gear travel [ft] (not yet used)
Most of these names were already pencilled into the UIUC documentation
(as TODO items), but I had to make up Dx_gear, Dy_gear, and Dz_gear --
if those are inappropriate, I'd appreciate suggestions for better
names.
It will be necessary to modify the other UIUC configuration files to
include some kind of gear support as well, or the planes will sink
nose-first into the ground down to their CG's (it's actually quite
funny to watch with an external view).
Background
----------
As I frequently remind everyone here, I have no math background worth
spitting at, so I will not even pretend to have done the hard stuff.
The UIUC code uses a copy of a very old version of the LaRCsim
c172_gear.c -- I wanted to update it with Tony Peden's excellent newer
version, which includes differential braking among other goodies (the
UIUC models don't support brakes, period).
I copied the newer code into uiuc_aero.c, and it compiled and ran, but
all of the planes ended up sitting on their tails with their noses in
the air. Since Tony made his gear code nicely parameterized, I
experimented with different values, and found that it wasn't too hard
to balance the Twin Otter by moving the gear back a bit. At first, I
used properties to set different values, but then I decided to
integrate the whole thing properly into the UIUC configuration
framework. Thanks to Tony Peden, who did the real modelling work -- I
can take credit only for two or three hours of integration. It turns
out that Tony's code is generalized enough to deal with a wide range
of different gear structures -- I suspect that it will even work for
the 747, when I get around to trying some values.
2001-03-29 03:16:25 +00:00
|
|
|
void uiuc_gear_routine ()
|
|
|
|
{
|
|
|
|
uiuc_gear();
|
|
|
|
}
|
|
|
|
|
2000-03-22 22:01:33 +00:00
|
|
|
//end uiuc_wrapper.cpp
|