FlightGear Python Interface
flightgear-python is an interface package to the FlightGear flight simulation software aimed at simplicity.
Install: pip3 install flightgear-python
Don't know where to begin? Check out the quick-start documentation.
Flight Dynamics Model (FDM) example, from examples/simple_fdm.py
"""
Simple Flight Dynamics Model (FDM) example that makes the altitude increase and the plane roll in the air.
"""
import time
from flightgear_python.fg_if import FDMConnection
def fdm_callback(fdm_data, event_pipe):
if event_pipe.child_poll():
phi_rad_child, = event_pipe.child_recv() # unpack tuple
# set only the data that we need to
fdm_data['phi_rad'] = phi_rad_child # we can force our own values
fdm_data.alt_m = fdm_data.alt_m + 0.5 # or just make a relative change
return fdm_data # return the whole structure
"""
Start FlightGear with `--native-fdm=socket,out,30,localhost,5501,udp --native-fdm=socket,in,30,localhost,5502,udp`
(you probably also want `--fdm=null` and `--max-fps=30` to stop the simulation fighting with
these external commands)
"""
if __name__ == '__main__': # NOTE: This is REQUIRED on Windows!
fdm_conn = FDMConnection()
fdm_event_pipe = fdm_conn.connect_rx('localhost', 5501, fdm_callback)
fdm_conn.connect_tx('localhost', 5502)
fdm_conn.start() # Start the FDM RX/TX loop
phi_rad_parent = 0.0
while True:
phi_rad_parent += 0.1
# could also do `fdm_conn.event_pipe.parent_send` so you just need to pass around `fdm_conn`
fdm_event_pipe.parent_send((phi_rad_parent,)) # send tuple
time.sleep(0.5)
Supported interfaces:
- Native Protocol (currently only UDP)
- Flight Dynamics Model (
net_fdm.hxx) version 24, 25 - Controls (
net_ctrls.hxx) version 27 - GUI (
net_gui.hxx) version 8
- Flight Dynamics Model (
- Generic Protocol
- Telnet
- Nasal code execution (
run_nasal())
- Nasal code execution (
- HTTP
Metadata
Release files for flightgear_python 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flightgear_python-2.1.0.tar.gz | 15.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flightgear_python-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.1 kB
Release files / flightgear_python-2.1.0.tar.gz
| Download URL | flightgear_python-2.1.0.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aec0e6eede08ccce2723e665fc8a2655e5cfec67a5435c67251504714b3833fa
|
|
BLAKE2b-256 checksum How to use checksums |
14ca65a3a4fc03def769d1bde175e54ffe596a83d6aec868f13bbf182634bd6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.8.20 Linux/6.17.0-1013-aws
|
Release files / flightgear_python-2.1.0-py3-none-any.whl
| Download URL | flightgear_python-2.1.0-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a0e2a4a66c9eccc4b27eb3601a1114a20879e56a0bf4210705fbce8c3b5b676
|
|
BLAKE2b-256 checksum How to use checksums |
12373792e792a79c40fb8d191b060b07d8ea504ec1a503931270dd5eb6cd0159
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.8.20 Linux/6.17.0-1013-aws
|