Board index FlightGear Development Aircraft Flight dynamics model

JSBSim "Ball" crashes FlightGear :(  Topic is solved

Good sims require good FDMs (the "thing" that makes an aircraft behave like an aircraft).

JSBSim "Ball" crashes FlightGear :(  

Postby rebootl » Fri Jun 07, 2019 9:50 am

Hello

After some while I wanted to play around a bit with FG/JSBSim just for fun, but I'm hitting an issue that I don't understand.

Using a very simple FDM, like the example "Ball" for JSBSim manages to crash my FG right after starting it (version 2018.3 on Arch Linux).
FDM something like this:
(even more simplicated)
Code: Select all
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="http://jsbsim.sourceforge.net/JSBSim.xsl"?>
<fdm_config name="BALL" version="2.0" release="BETA"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">

    <fileheader>
     <author> Aeromatic v 0.95 / Cem Aydin </author>
     <filecreationdate>2019-06-05</filecreationdate>
     <version> Version 1.0 </version>
     <description> Models a Ball </description>
    </fileheader>

    <metrics>
        <wingarea unit="FT2"> 1 </wingarea>
        <wingspan unit="FT"> 1 </wingspan>
        <chord unit="FT"> 1 </chord>
        <htailarea unit="FT2"> 0 </htailarea>
        <htailarm unit="FT"> 0 </htailarm>
        <vtailarea unit="FT2"> 0 </vtailarea>
        <vtailarm unit="FT"> 0 </vtailarm>
        <location name="AERORP" unit="M">
            <x> 0 </x>
            <y> 0 </y>
            <z> 0 </z>
        </location>
        <location name="EYEPOINT" unit="IN">
            <x> -2.5 </x>
            <y> 0 </y>
            <z> 1 </z>
        </location>
        <location name="VRP" unit="M">
            <x> 0 </x>
            <y> 0 </y>
            <z> 0 </z>
        </location>
    </metrics>

    <mass_balance>
        <ixx unit="SLUG*FT2"> 20 </ixx>
        <iyy unit="SLUG*FT2"> 10 </iyy>
        <izz unit="SLUG*FT2"> 10 </izz>
        <ixy unit="SLUG*FT2"> -0 </ixy>
        <ixz unit="SLUG*FT2"> -0 </ixz>
        <iyz unit="SLUG*FT2"> -0 </iyz>
        <emptywt unit="KG"> 1 </emptywt>
        <location name="CG" unit="M">
            <x> 0 </x>
            <y> 0 </y>
            <z> 0 </z>
        </location>
    </mass_balance>

    <ground_reactions>
        <contact type="BOGEY" name="LEG_1">
            <location unit="M">
                <x> 0 </x>
                <y> 0 </y>
                <z> 0 </z>
            </location>
            <static_friction> 1 </static_friction>
            <dynamic_friction> 1 </dynamic_friction>
            <spring_coeff unit="N/M"> 5000 </spring_coeff>
            <damping_coeff unit="N/M/SEC"> 500 </damping_coeff>
        </contact>
    </ground_reactions>

    <external_reactions>
    </external_reactions>

    <propulsion/>

    <flight_control name="FGFCS"/>

    <aerodynamics>
        <axis name="DRAG">
            <function name="aero/coefficient/CD">
                <description>Drag</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <value>0.000</value>
                </product>
            </function>
        </axis>
    </aerodynamics>

</fdm_config>


I managed to get it working somehow by adding an altitude, either using the --altitude switch or a preset statement in the -set file.
But that shouldn't be nessesary right?
Or am I missing something? Is the CG getting below the ground or something like that?

Edit: And when adding more weight it starts to bounce uncontrollable etc...

The stack trace doesn't say much to me...
Code: Select all
...
...
SGBinObject::read_bin object 22 = 10 props = 2 elements = 1105
SGBinObject::read_bin object 23 = 10 props = 2 elements = 970
SGBinObject::read_bin object 24 = 10 props = 2 elements = 6831
SGBinObject::read_bin object 25 = 10 props = 2 elements = 17909
SGMaterialCache::~SGMaterialCache() size=291
finalizePosition: timed out waiting for METAR fetch
FGStgTerrain::get_elevation_m: alt 449.894 no material
FGStgTerrain::scenery_available - true
Scenery loaded, will init FDM
Starting and initializing JSBsim
T,p,rho: 518.67, 2116.23, 0.00237691
Start common FDM init
...initializing position...
FGJSBsim::set_Longitude: 0.151253
FGJSBsim::set_Latitude: 0.827191
 cur alt (ft) =  0
Checking for lon = 8.66618deg, lat = 47.3946deg, alt = -9999ft
FGStgTerrain::get_elevation_m: alt 449.892 material 0x5580194a0c70
FGJSBsim::set_Altitude: 1476.12
...initializing ground elevation to 1476.02ft...
...initializing sea-level radius...
 lat = 47.3946 alt = 1476.12
...initializing Euler angles...
FGJSBsim::set_Euler_Angles: 0, 1.5708, 5.02358
...initializing velocities...
FGJSBsim::set_V_calibrated_kts: 0
End common FDM init
Ready to trim, terrain elevation is: 1476.02
Error: caught signal 11:
  /usr/lib/libc.so.6 : ()+0x378b0
  fgfs : JSBSim::FGTrim::trimOnGround()+0x8d6
  fgfs : JSBSim::FGTrim::DoTrim()+0x131a
  fgfs : FGJSBsim::do_trim()+0x6a
  fgfs : FGJSBsim::init()+0x62d
  fgfs : FDMShell::update(double)+0x3e1
  fgfs : SGSubsystemGroup::Member::update(double)+0x55
  fgfs : SGSubsystemGroup::update(double)+0x233
  fgfs : SGSubsystemMgr::update(double)+0x30
  fgfs : ()+0xce0eb5
  fgfs : fgOSMainLoop()+0x7a
  fgfs : fgMainInit(int, char**)+0x1402
  fgfs : main()+0x19c
  /usr/lib/libc.so.6 : __libc_start_main()+0xf3
  fgfs : _start()+0x2e
./fg-start-aircraft: line 22:  4852 Aborted                 (core dumped) fgfs --fg-aircraft="$HOME/FlightGear/Aircraft" --aircraft="$AIRCRAFT" --airport="$AIRPORT" --disable-ai-traffic --log-level="debug"


My actual goal was to create a little rocket like the New Shepard ("jumping dildo" :D). Just for fun, to see how it behaves in FG and play w/ some stuff...
Thx for any inputs!

Regards
rebootl
 
Posts: 110
Joined: Tue May 03, 2011 2:55 pm
Location: Switzerland
OS: Arch Linux

Re: JSBSim "Ball" crashes FlightGear :(

Postby wkitty42 » Fri Jun 07, 2019 4:24 pm

couple of things...

  1. you might want to enable core dumps on your system if they are not already enabled... they can be used in the debugger when/if needed... you might want to google about enabling them if you don't already know how... https://www.google.com/search?q=linux+enable+core+dump
    eg:
    Code: Select all
    ulimit -c unlimited

  2. run FG in the debugger...
    eg:
    Code: Select all
    gdb  --directory=/home/myuser/flightgear-dev/next/flightgear/src --args fgfs --fg-root=$PWD/../fgdata/ $@

  3. if you are building your own FG, build a debug flavor so you can get more details of any crashes...

  4. when FG crashes and you are running it in the debugger, use "bt" to get a backtrace when at the internal gdb command line... it will return better information than given by default...
    in some cases, you might need more detail from other threads... in those cases, you would use "thread apply all bt"... you'll get dumps for all threads...
please note the above are examples... i build my own FG using the download_and_compile.sh script so it is easier to build debug flavor and to also point gdb to the source code so it can pinpoint the actual source lines in the output...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5501
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: JSBSim "Ball" crashes FlightGear :( / (rocket dev)

Postby rebootl » Fri Jun 07, 2019 7:17 pm

Hmm, thx for the reply.

I think I found one issue... One thing i did is i added a 90° pitch preset to the -set file, and i think it doesn't like that...

I'm using the X-15 FDM as a base now. Seems like a good starting point.

So i'll have to figure out how to put it at a 90° initial position, without making the sim freak out... :mrgreen:
rebootl
 
Posts: 110
Joined: Tue May 03, 2011 2:55 pm
Location: Switzerland
OS: Arch Linux

Re: JSBSim "Ball" crashes FlightGear :(

Postby Thorsten » Fri Jun 07, 2019 7:54 pm

I managed to get it working somehow by adding an altitude, either using the --altitude switch or a preset statement in the -set file.
But that shouldn't be nessesary right?


Likely wrong - if it ain't got no gear, then ground interactions below ground might be... interesting. Likely that is what causes the crash.

My actual goal was to create a little rocket like the New Shepard ("jumping dildo" ). Just for fun, to see how it behaves in FG and play w/ some stuff...(...)So i'll have to figure out how to put it at a 90° initial position, without making the sim freak out...


It's fun.

Solution 1 (exemplified by Vostok-1):

Re-define axes - pretend the rocket on the pad is a plane facing forward with a gear down that just moves 'up'/

Pro - it's relatively easy to do, everything will work out okay on the ground.

Con - there's going to be a ring-shaped Euler singularity at the horizon (rather than a point shaped one at the zenith and nadir) - that's going to bite hard eventually.

Solution 2 (exemplified by the Space Shuttle):

Introduce a setup-script - basically float your rocket in the air till FG and the pad are ready, then 'magially' translate it to the ground and let it gently drop into the ground interaction points (usually the JSBSim trim routine would do that for you - but only if you re-define axes...)

Pro - all will work as you hope for later

Con - the script is a bit of a toughie to write, you need to hack some and then some more
Thorsten
 
Posts: 10693
Joined: Mon Nov 02, 2009 8:33 am

Re: JSBSim "Ball" crashes FlightGear :(

Postby rebootl » Fri Jun 07, 2019 8:51 pm

Thx for the reply.

I'll have a look at the Space Shuttle. I did some Nasal before, so i'll try that... :D
rebootl
 
Posts: 110
Joined: Tue May 03, 2011 2:55 pm
Location: Switzerland
OS: Arch Linux

Re: JSBSim "Ball" crashes FlightGear :(

Postby alex1 » Wed Aug 07, 2019 9:20 am

I have found the same problem. Clearly FGTrim onground is broken. I now start all models with --altitude=.1 --vc=0.1 options. Also I have amended airports.xml in /gui/dialogs and added these lines in var apply = func {
setprop("/sim/presets/altitude-ft",1);
setprop("/sim/presets/airspeed-kt",0.1 );
setprop("/sim/presets/onground",false);

This doesn't appear to have any side effects.
alex1
 
Posts: 10
Joined: Thu Nov 24, 2016 9:35 am
Callsign: alex1
Version: 2018.3.2
OS: linux


Return to Flight dynamics model

Who is online

Users browsing this forum: No registered users and 1 guest