Changeset 4:bcc93ecb8cb6 for src/fs.py
- Timestamp:
- 01/29/12 14:00:30 (12 years ago)
- Branch:
- default
- hg-Phase:
- (<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/fs.py
r3 r4 1 1 # Module for generic flight-simulator interfaces 2 2 3 # Flight simulator type: MS Flight Simulator 2004 4 TYPE_FS2K4 = 1 3 #------------------------------------------------------------------------------- 5 4 6 # Flight simulator type: MS Flight Simulator X 7 TYPE_FSX = 2 5 import const 8 6 9 # Flight simulator type: X-Plane 9 10 TYPE_XPLANE9 = 3 7 #------------------------------------------------------------------------------- 11 8 12 # Flight simulator type: X-Plane 10 13 TYPE_XPLANE10 = 4 14 15 class ConnectionListener: 9 class ConnectionListener(object): 16 10 """Base class for listeners on connections to the flight simulator.""" 17 11 def connected(self, fsType, descriptor): … … 24 18 print "fs.ConnectionListener.disconnected" 25 19 20 #------------------------------------------------------------------------------- 21 22 class SimulatorException(Exception): 23 """Exception thrown by the simulator interface for communication failure.""" 24 25 #------------------------------------------------------------------------------- 26 27 def createSimulator(type, connectionListener): 28 """Create a simulator instance for the given simulator type with the given 29 connection listener. 30 31 The returned object should provide the following members: 32 FIXME: add info 33 """ 34 assert type==const.TYPE_MSFS9, "Only MS Flight Simulator 2004 is supported" 35 import fsuipc 36 return fsuipc.Simulator(connectionListener) 37 38 #------------------------------------------------------------------------------- 39 40 class AircraftState(object): 41 """Base class for the aircraft state produced by the aircraft model based 42 on readings from the simulator. 43 44 The following data members should be provided at least: 45 - timestamp: the simulator time of the measurement in seconds since the 46 epoch (float) 47 - paused: a boolean indicating if the flight simulator is paused for 48 whatever reason (it could be a pause mode, or a menu, a dialog, or a 49 replay, etc.) 50 - trickMode: a boolean indicating if some "trick" mode (e.g. "SLEW" in 51 MSFS) is activated 52 - overspeed: a boolean indicating if the aircraft is in overspeed 53 - stalled: a boolean indicating if the aircraft is stalled 54 - onTheGround: a boolean indicating if the aircraft is on the ground 55 - grossWeight: the gross weight in kilograms (float) 56 - heading: the heading of the aircraft in degrees (float) 57 - pitch: the pitch of the aircraft in degrees. Positive means pitch down, 58 negative means pitch up (float) 59 - bank: the bank of the aircraft in degrees. Positive means bank left, 60 negative means bank right (float) 61 - ias: the indicated airspeed in knots (float) 62 - vs: the vertical speed in feet/minutes (float) 63 - altitude: the altitude of the aircraft in feet (float) 64 - flapsSet: the selected degrees of the flaps (float) 65 - flaps: the actual degrees of the flaps (float) 66 - n1[]: the N1 values of the turbine engines (array of floats 67 of as many items as the number of engines, present only for aircraft with 68 turbines) 69 - rpm[]: the RPM values of the piston engines (array of floats 70 of as many items as the number of engines, present only for aircraft with 71 pistons) 72 - reverser[]: an array of booleans indicating if the thrust reversers are 73 activated on any of the engines. The number of items equals to the number 74 of engines. 75 - navLightsOn: a boolean indicating if the navigation lights are on 76 - antiCollisionLightsOn: a boolean indicating if the anti-collision lights are on 77 - strobeLightsOn: a boolean indicating if the strobe lights are on 78 - langingLightsOn: a boolean indicating if the landing lights are on 79 - pitotHeatOn: a boolean indicating if the pitot heat is on 80 - gearsDown: a boolean indicating if the gears are down 81 - spoilersArmed: a boolean indicating if the spoilers have been armed for 82 automatic deployment 83 - spoilersExtension: the percentage of how much the spoiler is extended 84 (float) 85 86 FIXME: needed when taxiing only: 87 - zfw: the Zero Fuel Weight in klograms (float) 88 89 FIXME: needed for touchdown only: 90 - ambientWindDirection: the ambient wind direction around the aircraft (float) 91 - ambientWindSpeed: the ambient wind speed around the aircraft in knowns (float) 92 - tdRate: the touchdown rate calculated by FSUIPC (float) 93 """ 94
Note:
See TracChangeset
for help on using the changeset viewer.