Comments (17)
Yes I manually test flew the craft. It's very unstable but I was able to successfully fly it with gentle control inputs and constant attention/adjustments. Large aileron inputs immediately cause the craft to enter rolling spin/destabilize, which soon produce extreme/impossible numbers, resulting in NaNs. I don't think there's an actual JSBSim bug here, the model is just very unstable for manual flight and could use adjustment/improvement. Another thing I noticed is that the original repo is updating JSBSim at 240hz, which generally speaking higher rates improve stability. Good luck with your work!
from jsbsim.
Ok I think I've got it, I made some other experiments with an initial velocity and different throttle and aileron commands. Some lead to stable trajectories, some other to unstable ones and NaNs... If I understand correctly, I should check the stability of my UAV to know precisely what conditions lead to unstable trajectories. I naively thought that JSBSim would "simulate" the instability as in a real life scenario. But I know have a slightly better understanding on how it works behind the scenes and the reasons behind the fdm outputting NaNs.
from jsbsim.
You're starting the aircraft stationary with no velocity based on initial conditions file.
Any reason you're changing the default timestep?
What do the plots show for angular rates, attitude angles, airspeed, altitude etc.?
Setting the aileron will generate a rolling moment, now if the moment of inertia for example is way too small given the moment generated then it is possible that once JSBSim integrates the resulting moment to get an angular rate, integrates it again to get an attitude angle etc. that if there is a massive mismatch you could end up with NaNs.
from jsbsim.
I stand corrected. In my previous post I said that the direct thruster should not be attached to an electric engine. It turns out that it can. In this case the power output of the engine, in hp, is converted directly into thrust by the "direct thruster" by multiplying by 550. In the case of your engine/thruster combination this results in a maximum thrust of 5.9 lbs.
Whether this should be allowed in JSBSim or not is a different topic. In the case of the x8 model it works fine.
from jsbsim.
Hello @seanmcleod, thanks for the quick reply,
You're starting the aircraft stationary with no velocity based on initial conditions file.
Yes, I wanted to leave everything at 0, except the aileron command in order to isolate the problem. I just tested it with ubody = 5.0 m/s and I have the same problem.
Any reason you're changing the default timestep?
If you're talking about the fdm.set_dt()
: No, no particular reason, apart that I've seen it repetetively in other repositories. I thought it was mandatory to set a simulation timestep. I just commented out this line, the problem resolves itself for the value +/-0.3 but when I increase it to 0.4, I get NaNs again :/
What do the plots show for angular rates, attitude angles, airspeed, altitude etc.?
Is there an integrated utility program to jsbsim that allows for plot visulization ? Anyways, here are two plots I made : both of them : same initial conditions, no initial velocity, I let the default timestep : The first one is with an aileron command of -0.3 (this now works, by not changing the default timestep), the second one is with an aileron command of -0.4 (this one generates NaNs after ~630 timesteps)
Sim with -0.3 (now working) :
Sim with -0.4 (gives NaNs after a bit) :
Setting the aileron will generate a rolling moment, now if the moment of inertia for example is way too small given the moment generated then it is possible that once JSBSim integrates the resulting moment to get an angular rate, integrates it again to get an attitude angle etc. that if there is a massive mismatch you could end up with NaNs.
I'm sorry, but I don't understand what you've just said here. I get that setting the aileron will generate a rolling moment, and that JSBSim integrates from accelerations to positions but what about the mismatch and the moment of inertia being way too small ?
from jsbsim.
I get that setting the aileron will generate a rolling moment, and that JSBSim integrates from accelerations to positions but what about the mismatch and the moment of inertia being way too small ?
Take a translational example, i.e.
Although looking at your graphs it looks similar to some of the results you see when the aircraft hits the ground very hard, with massive excessive spring/gear forces etc.
How sure are you that you aren't hitting the ground? You seem to be logging the sea level altitude, as opposed to AGL and I see reference to an elevation
element in your initial conditions file.
Is there no output in the console about ground contact etc.?
from jsbsim.
How sure are you that you aren't hitting the ground? You seem to be logging the sea level altitude, as opposed to AGL and I see reference to an
elevation
element in your initial conditions file.Is there no output in the console about ground contact etc.?
I don't have any ground_reactions
set up in my xml file, when testing for other aileron values that don't break the simulation, my aircraft goes below 0 without a problem. I tried replacing the sea level altitude by the above ground altitude, I get the same numbers (except h-sl-m being in meters and h-agl-km being in km).
For the elevation
element, I got it from the initial conditions file present in the repository I cited earlier that I follow as an example of what I want to do. No reason I know to why it's there, I tried removing it, doesn't resolve the problem.
from jsbsim.
Okay, so you're basically dropping a stationary aircraft from some altitude and it's entering a spin right? Getting to the point of angular rates in the region of thousands of degrees per second, I'm assuming the y-axis of your angular velocities graph is in rad/s right?
And after getting to rates in the order of a couple of thousands of deg/s JSBSim then starts spitting out NaNs?
from jsbsim.
Okay, so you're basically dropping a stationary aircraft from some altitude and it's entering a spin right? Getting to the point of angular rates in the region of thousands of degrees per second, I'm assuming the y-axis of your angular velocities graph is in rad/s right?
rad/s, correct.
And after getting to rates in the order of a couple of thousands of deg/s JSBSim then starts spitting out NaNs?
I think so. In order to have readable graphs, since I stopped the simulation right before the NaNs error occur : here's the csv file that I plot the data from, just in case you want to check the last lines before it spits NaNs.
from jsbsim.
So these are the last couple of entries, take 437 rad/s for the first roll rate in the snippet below, that's 25,038 deg/s.
Roll rate (rad/s) | Pitch rate (rad/s) | Yaw rate (rad/s) |
---|---|---|
437.3738449 | 26.77790139 | -578.405973 |
443.8719697 | -2214.108471 | -601.5700519 |
-8198.758529 | -5168.244707 | 10498.49683 |
176081.2867 | -504479.3471 | -240302.6891 |
-824439661.4 | -502235492.2 | 1056244540 |
1.78073E+15 | -5.09655E+15 | -2.43034E+15 |
-8.42E+28 | -5.14E+28 | 1.08E+29 |
1.86E+55 | -5.33E+55 | -2.54E+55 |
-9.20E+108 | -5.61E+108 | 1.18E+109 |
2.22E+215 | -6.36E+215 | -3.03E+215 |
nan | nan | nan |
So you've dropped an aircraft at zero velocity, and it's almost immediately gone into a spin that looks unstable.
So I'm not sure what you're really expecting. Do you know based on some other real world data that this aircraft with those sorts of starting conditions has stable spin characteristics?
Or have you explicitly checked or edited the FDM to ensure that it would be stable in a spin by editing the relevant aerodynamic coefficients?
from jsbsim.
The aircraft you are using seems experimental and was only designed/tested for use with the autopilot included in that repo. The model itself does not appear to stabilized in anyway for manual control without an autopilot/stabilization system. Are you trying to fly the craft outside the scope of that repo you linked? You'll need to test/tune/improve the model if you intend on manually controlling it. You can search/read about creating aircraft models for JSBSim or ask for help with the model specifically. There also exists quadcopters, drones, and possibly other miniature craft if you search around. From which you could compare and add improvements to the X8 to have better manual control flights and better stabilizing in it's roll/center axis.
from jsbsim.
@gallonmate Yup, I'm aiming to build a similar control system based on machine learning techniques. But before going in the proper dev of that part, I just wanted to play around with the UAV and check what are the control inputs that the plane has etc... I stumbled upon that error and I was unsatisfied not understanding those NaNs.
from jsbsim.
@gallonmate Thanks, for your additionnal info ! Yup, I don't think there's a bug with JSBSim either now. With that said, @seanmcleod, I think we can close this issue, is that ok for you ?
from jsbsim.
Some lead to stable trajectories, some other to unstable ones and NaNs... If I understand correctly, I should check the stability of my UAV to know precisely what conditions lead to unstable trajectories.
So first thing to consider is that "garbage in = garbage out", in other words if the FDM has "garbage" data then you can't trust the results you see in JSBSim. So the first thing you need to check and inspect is the FDM data in terms of what sort of coverage it has to understand under what conditions it will provide useful data.
For example, take the lift versus AoA for the 737 model, you'll see that it only provides data for AoA in the range from -11.5 degrees to +26.4 degrees.
Lines 648 to 666 in 98535e8
Now if the AoA is outside that range then JSBSim clips the output.
Which means JSBSim continues executing and generating output but you can't trust the output since it's operating outside the range of the FDM data. In your example you dropped the UAV with zero velocity, so pretty much immediately the AoA would've been 90 degrees, and I haven't double-checked but I very much doubt your model has FDM data for that AoA.
So if you want to have any confidence in JSBSim's output first double-check that the aircraft is being operated within the parameters for which you have FDM data. This also assumes that the FDM data is somewhat accurate for the regions it covers.
from jsbsim.
Understood, the x8.xml is a lot less detailed than the 737 or the cessna files. I'm guessing the FDM is not very complete since it doesn't cover a lot of regions hence can turn unstable pretty quicky, but this unstability is also backed up by @gallonmate experience of piloting the UAV. Since I don't have a wind tunnel, nor the UAV to experiment on it and get more data, I'm kinda bounded to work with the existing FDM of the x8.
By any chance, is there any software based solution to find the FDM of a given aircraft ?
from jsbsim.
Should we consider this topic resolved and close this issue ?
from jsbsim.
Sure, thanks for the information !
from jsbsim.
Related Issues (20)
- JSBSim Simulink Function HOT 36
- Rust HOT 13
- Can autopilot feature come to jsbsim- unreal engine 5? HOT 2
- MSVC: toupper is not a member of std HOT 1
- Missing target_include_directories in libJSBSim
- JSBSIM_ prefix in CMake options
- Cython warnings about 'tp_print' which is deprecated
- Wrong calculation of vPQRdot in FGAccelerations class HOT 4
- Fixing the mixture for JSBSim piston aircraft HOT 54
- Request: turbine spindown table or property support HOT 2
- Aircraft crashed on air when rolling consecutively HOT 15
- How Jsbsim models the "+" shaped tail fins of missiles and rockets. HOT 1
- After changing pitch and long initial conditions the yaw angle changes also for no reason HOT 1
- JSBSim interface to Matlab on Windows: throttle command from joystick doesn't work HOT 5
- Trim succeeds and results in NaN values HOT 1
- JSBSim and s-function have different results and different reactivity themselves HOT 1
- Building for Unreal 5 on Linux not working HOT 7
- Javascript alternative? HOT 2
- Linearization and simplex trim from console executable and xml script HOT 16
- FGTurbine Shutdown Spin HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsbsim.