Skip to main content

Interface for FlightGear network connections

Project description

FlightGear Python Interface

Documentation Status CircleCI Coverage Status PyPI - Python Version

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.

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):
    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,,5501,udp --native-fdm=socket,in,30,,5502,udp`
(you probably also want `--fdm=null` and `--max-fps=30` to stop the simulation fighting with
these external commands)
"""
fdm_conn = FDMConnection(fdm_version=24)  # May need to change version from 24
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.02
    # 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.01)

Supported interfaces:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flightgear_python-1.0.2.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flightgear_python-1.0.2-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file flightgear_python-1.0.2.tar.gz.

File metadata

  • Download URL: flightgear_python-1.0.2.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.10 CPython/3.6.15 Linux/5.13.0-1023-aws

File hashes

Hashes for flightgear_python-1.0.2.tar.gz
Algorithm Hash digest
SHA256 11db7c5c30e4fe0a4b40832dbdecf1cc4ee2e59bef94d5687ef888c00f5d2d14
MD5 e297df5344a0c051e338ed96c2801bf7
BLAKE2b-256 c79677884439b8c2ec0b7d34b9296d0f648f67c9b129fe01c4b46e32052d1ccf

See more details on using hashes here.

File details

Details for the file flightgear_python-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: flightgear_python-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.10 CPython/3.6.15 Linux/5.13.0-1023-aws

File hashes

Hashes for flightgear_python-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 09cbcc47a3740dab5c7baa5c27972f6efc25deb6db4eb5069f4e44c4096213a8
MD5 46afaeaba7d91776461ffed05fcf5d97
BLAKE2b-256 5d8dc8333f7c4e090895798f24d1170096eaf8fdacfa21868161795ca173ad6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page