Interface for FlightGear network connections
Project description
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
- HTTP
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flightgear_python-2.0.3.tar.gz.
File metadata
- Download URL: flightgear_python-2.0.3.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.8.20 Linux/6.8.0-1031-aws
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ccb64e8fa7d1136fac72474e7bbfa8f4af41e91bd24c4f5aeefe9f275b30ed3
|
|
| MD5 |
c62fa7b68b3576e31cc708a9f846abcd
|
|
| BLAKE2b-256 |
96df89c691d85e8d7553169d9df57dde6dd83d31c5246f677377d8a10b04639e
|
File details
Details for the file flightgear_python-2.0.3-py3-none-any.whl.
File metadata
- Download URL: flightgear_python-2.0.3-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.8.20 Linux/6.8.0-1031-aws
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3cd1c60c248956af1a672df31638740833c107ec78b52ad5367104ad026c64c
|
|
| MD5 |
9cb5b97805881d10be4c39c5f5ee0105
|
|
| BLAKE2b-256 |
78fea3a7e13764a287cbbe92817d8a724f3b3fd7fa5ec889d94a29454aa55563
|