Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Force feedback

From FlightGear wiki
Jump to: navigation, search

Development of force feedback (also called haptic) support for FlightGear started in December 2011.

Repository

The development is currently happening at FG-Haptic on Gitorious. It is tested on Linux only, as the author (Zan) has no build environment on Windows. Testers wanted!

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).

Installation and how to use

Building

  1. You need to have SDL 2.0 development libraries installed
  2. Edit Makefile for the library paths if necessary
  3. Type make and it should build
  4. Done

Installation

  1. Copy ff-protocol.xml to Protocols/ in FG data directory.
  2. Copy force-feedback.nas to Nasal/ in FG data directory.
  3. Copy force-feedback.xml to gui/dialogs/ in FG data directory.

Using

  1. Run fg-haptic or fg-haptic.exe
  2. Launch flightgear with following command line: fgfs --telnet=5401 --generic=socket,out,20,localhost,5402,tcp,ff-protocol
  3. If menu bar is not visible, press F10
  4. In flightgear's Help->Force feedback options you can configure force settings
  5. Enjoy

Features

The options dialog.

General features

  • 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

Effects

  • 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

Technical details

System description

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

Force calculations

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:
effective_area_2=effective_area*(1-sin(slip_angle)).

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.


Force feedback

TBD

External links