Development of force feedback (also called haptic) support for FlightGear started in 2009 with the SourceForge project Haptics for FlightGear however all of the modules should be considered as probably best suited to being a development project.
The lack of commercially available (and affordable) force feedback devices has hampered development somewhat.
The SDL library provides a generic interface to haptic devices. Generally there are a number of different things that can be provided as feedback via the input device; however for flight simulation it is really only the control loading and vibration (rumble) to simulate buffet. There is a lot of difference between aircraft types as to what is relevant for the different types of feedback.
- Light aircraft almost always have a direct connection between the controls and the surfaces, usually using wires or rods; sometimes the control surfaces are balanced. These type of controls usually have increasing amount of force required as airspeed increases.
- Certain (usually older) transport aircraft (e.g. DC3) also have direct linkages between the controls and the surfaces; and almost always have balanced controls or a mechanical advantage because otherwise the forces required at higher airspeeds would make control movement difficult.
- Modern airliners (pre FBW) tend to have hydraulically assisted controls, and often these are setup to provide a fairly linear response throughout the airspeed range
- Modern airlines (with FBW) and side stick (typically AirBus) will still have a feedback to the side stick but typically this is to provide the feel that the pilot expects and is fairly linear. Modern airlines with central controls and FBW (Boeing) tend to also be more linear but with more feel than side stick.
- Old fighter aircraft (WWII, first generation jets) will either have direct connection between controls and surfaces or a degree of hydraulic assistance. The feedback is generally more linear but can be progressively stronger with airspeed or deflection angle.
- Some modern fighter aircraft (without FBW) with hydraulic assistance will have a linear feedback (e.g. F-15)
- FBW fighters (generally sidestick) often have very little feedback at the controls
The only general simulation we can provide is often something that feels right rather than the accurate simulation by aircraft type, e.g. progressively more difficult based on surface loading or vibration/rumble at higher angles of attack.
Current git hub development repository was last updated in 2016 by Viktor Radnai and is a fork of the original development respository was FG-Haptic on Gitorious and was tested only on Linux, as the author (Zan) has no build environment on Windows. No built modules yet available. Only source code and nasal/xml scripts. Requires SDL 2.0 to function (might also work with 1.3 or later, but is tested with 2.0).
There is an alternative project that currently is implemented in the core for yasim only and as a set of revised python scripts for JSBSim . This can be found here hapticsforfg (SourceForge).
FG Haptics installation and how to use
- You need to have SDL 2.0 development libraries installed
- Edit Makefile for the library paths if necessary
- Type make and it should build
- Copy ff-protocol.xml to Protocols/ in FG data directory.
- Copy force-feedback.nas to Nasal/ in FG data directory.
- Copy force-feedback.xml to gui/dialogs/ in FG data directory.
- Run fg-haptic or fg-haptic.exe
- Launch flightgear with following command line: fgfs --telnet=5401 --generic=socket,out,20,localhost,5402,tcp,ff-protocol
- If menu bar is not visible, press F10
- In flightgear's Help->Force feedback options you can configure force settings
- In-sim options dialog
- Support for multiple devices simultaneously
- Devices do not need to be the same ones that are used as inputs
- Devices can have different effects applied on them
- Add-on, can be installed on older FlightGear versions too
- Stick shaker when about to stall
- Stick pusher
- Control surface forces (JSBSim support, no YASim or others yet, but to be done)
- Pilot G forces
Fg-haptic uses two communication methods with FG; telnet and general protocol. Telnet is used to send force-feedback device info to FG during intialisation, and later on it is used to fetch device configuration. General protocol is used to send force details from FG (one way communication). Telnet is quite slow, update of device configuration may take up to 10 seconds, while general protocol sends data currently 20 times per second.
All properties used by fg-haptic currently reside under /haptic/. All effects are directly under that (like stick-force/) and each device is below /haptic/device[X]/, showing device info and configuration.
Generic protocol, ff-protocol, uses following format: reconfigure_request|aileron|elevator|rudder|pilot_x|pilot_y|pilot_z|stick_shaker_trigger|ground_rumble_period
Stick forces are based on the following equation, which represents force caused by air flowing towards a surface:
F=0.5*airspeed^2*density*area*Cd, where Cd is drag coefficient and area is perpendicular to airflow.
Since the surfaces can turn, the effective area is:
effective_area=area*sin(angle), where angle is the deflection angle, and it should take angle of attack into account:
angle=deflection_angle-AoA, since that is the real direction of air flow with relation to the surface. For rudder, we use slip angle instead of AoA.
Also slip may be taken into account, if the air flows from side, it has less effect on the surface, thus giving:
Another thing we take into account is stall and deep stall. If AoA is over the stall limit, or over deep stall limit, forces acting on elevator and aileron are quickly ramped to zero, representing separated airflow.
In this implementation, multiplication by 0.5, Cd and area are combined to a single coefficient for aileron, elevator and rudder, that are aircraft specific. Coefficients should be set so that the force does not exceed 1.0 (maximum value) in normal operation, and they can also be set to 0 or other value to represent fly-by-wire systems. Also slip coefficients can be defined to fine tune the stick feeling. A good starting value to try for each coefficient is:
coeff=1.0/((Vne^2)*sin(max_deflection)*0.00257), where Vne is the maximum (never exceed) speed in knots, max deflection is the maximum deflection of the control surface and 0.00257 is standard air density (slugs/ft3). This value can then be fine tuned.