Replies: 3 comments 4 replies
-
Yep, I'm not sure why FGFCS isn't exported. Lines 224 to 233 in af9532d However you can set the relevant control commands via the property tree that is exposed, e.g. import jsbsim
fdm = jsbsim.FGFDMExec('.', None)
fdm.load_script('scripts/c1721.xml')
fdm.run_ic()
while fdm.run():
fdm['fcs/elevator-cmd-norm'] = elevatorCommand
fdm['fcs/aileron-cmd-norm'] = aileronCommand |
Beta Was this translation helpful? Give feedback.
2 replies
-
So each call to while fdm.run():
# Get aircraft status
lat = fdm['...']
lon = fdm['...']
altitude = fdm['....']
speed = fdm['...']
# Make use of aircraft status to perform calculations for radar detection, missile hit caclulation etc.
performRadarDetection(lat, lon, altitude)
performMissileHitDetection(lat, lon, altitude, speed)
# Set control inputs for the next simulation time step
fdm['fcs/elevator-cmd-norm'] = elevatorCommand
fdm['fcs/aileron-cmd-norm'] = aileronCommand |
Beta Was this translation helpful? Give feedback.
1 reply
-
What about this? def step(airplane_command, fdm):
# Simulate aircraft flight according to commands in one step(0.05s)
fdm['fcs/elevator-cmd-norm'] = airplane_command.elevatorCommand
fdm['fcs/aileron-cmd-norm'] = airplane_command.aileronCommand
....
fdm.run()
# Get status
lat = fdm['...']
lon = fdm['...']
altitude = fdm['....']
speed = fdm['...']
# Use status to perform calculation
radar_detection = performRadarDetection(lat, lon, altitude)
missile_hit = performMissileHitDetection(lat, lon, altitude, speed)
# return some information
return radar_detection, missile_hit ... |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Greeting! I installed jsbsim and wanted to use Python to simulate the flight of an airplane . What I want to achieve is, given an input, including aileron, rudder, elevator and throttle, I can get its 12 statuses(u,v,w,p,q,r and so on) . It seems that FGFCS could achieve but I did not find FGFCS on Python module.
So how can I achieve it?
Beta Was this translation helpful? Give feedback.
All reactions