JSBSim VTOL/thrust vectoring feature #1310
Replies: 7 comments
-
There should be no need to modify the JSBSim source code to implement thrust vectoring. Here is a simple example of thrust vectoring; import jsbsim
import math
AIRCRAFT_NAME="737"
# Path to JSBSim files, location of the folders "aircraft", "engines" and "systems"
PATH_TO_JSBSIM_FILES="../.."
# Avoid flooding the console with log messages
#jsbsim.FGJSBBase().debug_lvl = 0
fdm = jsbsim.FGFDMExec(PATH_TO_JSBSIM_FILES)
# Load the aircraft model
fdm.load_model(AIRCRAFT_NAME)
# Set engines running
fdm['propulsion/set-running'] = -1
# Initial conditions
fdm['ic/h-sl-ft'] = 1000
fdm['ic/vc-kts'] = 250
fdm['ic/gamma-deg'] = 0
# Initialize the aircraft with initial conditions
fdm.run_ic()
# Trim
try:
fdm['simulation/do_simple_trim'] = 1
except jsbsim.TrimFailureError:
print("Trim failed....")
pass # Ignore trim failure
print('')
print(f'fbx: {fdm["forces/fbx-prop-lbs"]} fby: {fdm["forces/fby-prop-lbs"]} fbz: {fdm["forces/fbz-prop-lbs"]}')
print(f'Engine: {fdm["propulsion/engine[0]/thrust-lbs"]*2}')
print(f'Thruster pitch: {fdm["propulsion/engine[0]/pitch-angle-rad"]}')
# Modify thruster pitch angle for some thrust vectoring
fdm["propulsion/engine[0]/pitch-angle-rad"] = math.radians(30)
fdm["propulsion/engine[1]/pitch-angle-rad"] = math.radians(30)
fdm.run()
print('')
print(f'fbx: {fdm["forces/fbx-prop-lbs"]} fby: {fdm["forces/fby-prop-lbs"]} fbz: {fdm["forces/fbz-prop-lbs"]}')
print(f'Engine: {fdm["propulsion/engine[0]/thrust-lbs"]*2}')
print(f'Thruster pitch: {math.degrees(fdm["propulsion/engine[0]/pitch-angle-rad"]):.1f}') With the following output: End of vehicle configuration loading.
-------------------------------------------------------------------------------
Full Trim
Trim successful
Trim Results:
Angle of Attack: 3.17 wdot: 5.47e-05 Tolerance: 1e-03 Passed
Throttle: 0.61 udot: -5.10e-05 Tolerance: 1e-03 Passed
Pitch Trim: -0.20 qdot: -7.49e-11 Tolerance: 1e-04 Passed
Roll Angle: -0.00 vdot: -3.63e-14 Tolerance: 1e-03 Passed
Ailerons: 0.00 pdot: 2.98e-16 Tolerance: 1e-04 Passed
Rudder: 0.00 rdot: -9.75e-32 Tolerance: 1e-04 Passed
fbx: 12859.608467405447 fby: 0.0 fbz: 0.0
Engine: 12859.608467405447
Thruster pitch: 0.0
fbx: 11136.747616295526 fby: 0.0 fbz: -6429.8042341651435
Engine: 12859.608468330289
Thruster pitch: 30.0 |
Beta Was this translation helpful? Give feedback.
-
Depending on the level of fidelity you're looking to achieve you may also want to model a reduction in thrust based on the angle of the thrust vectoring nozzle. May or may not be relevant for the V-22 Osprey. |
Beta Was this translation helpful? Give feedback.
-
I came across this NASA report - Optimal Pitch Thrust-Vector Angle and Benefits for all Flight Regimes Here are their results for cruise for a generic widebody airliner. So I couldn't resist testing this out in JSBSim, using the 737 model in the repo. Which shows very similar results. In fact the overall thrust reduction is almost identical at 40lbf. Optimisation, although this was simply a brute force approach, is finding the lowest thrust value in order to minimize fuel burn for a given altitude and speed. Trade-offs being that a greater thrust angle means less lift needed from the wings, so for the same airspeed you can fly at a smaller AoA which reduces drag, smaller AoA also means you need a smaller moment from the horizontal stabilizer which means less negative lift from the stabilizer and less drag from the stabilizer. But at some point as the thrust vector angle increases you get to a point where there isn't enough horizontal thrust to match the drag, so overall thrust needs to increase etc. Not sure what is happening with the slight discontinuity around 1.8deg thrust vector angle. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the info! maybe I didn't think as far as thrust reduction yet (gonna do that with f-35 later). I am right now trying to visualize it using the unreal engine plugin, where the plugin (or jsbsimsimmovementcomponent.cpp) read the data from aircraft.xml. the part I am struggling with is that inside aircraft.xml file, the thrust orientation is always fixed, and I tried to implement a control axis that controls the direction of the thrust. I don't know did you try the thrust vectoring B737 script inside Unreal Engine? I really appreciate some advice on that. Thank you!!! |
Beta Was this translation helpful? Give feedback.
-
I was trying to point out with the 737 example that all I needed to do in order to get thrust vectoring to work, with no changes what so ever to the 737.xml was to simply update the
I really doubt that the Unreal plug-in is updating/overwriting the |
Beta Was this translation helpful? Give feedback.
-
Since this topic has not seen any progress in months and it is not addressing either a bug report or a feature request, it is moved to discussions. |
Beta Was this translation helpful? Give feedback.
-
To implement VTOL, it's not strictly necessary to modify the JSBSim code itself. Here's an example of how it can be done entirely within Unreal code. This is my current solution - it might not be the most optimal, but it works well and avoids the gimbal lock issue when using For each engine, I store the pitch and yaw angles (in radians) for vectoring:
Then I calculate the orientation using quaternions and convert the direction into JSBSim’s body frame:
Transforming into JSBSim thrust vector and computing Euler angles:
Then I pass the values to JSBSim:
P.S. I’ve been thinking for a long time about writing a dedicated plugin for UE that includes VTOL support code - not sure how useful it would be for the community, but I’d love to give it a try someday. I’m a big fan of JSBSim, and I just want to say a huge thanks to the amazing team behind it! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Recently I was working on VTOL feature for V-22 Osprey in jsbsim, and want to test it out inside Unreal Engine.
From FGThruster.cpp, I assume this is the part that supports thrust vectoring but I didn't see any existing aircraft implenting it:
therefore, I add a line under FGThruster.h to calculate the thrust vectoring angle:
for the aircraft script file, I also delete the orientation part, since the thrust is no longer a fixed value:
and added a new channel called thrust vectoring under the FCS part:
with these changes, UnrealEngine crashes with following report:
So Is there anything I missed while working on the VTOL function? Need some advice plsss
Beta Was this translation helpful? Give feedback.
All reactions