Howto:Build and run FlightGear on Raspberry Pi 4

From FlightGear wiki
Revision as of 21:30, 18 February 2020 by Puffergas (talk | contribs) (→‎Joysticks)
Jump to navigation Jump to search


You will find that controlling your aircraft, with the official Raspberry Pi keyboard and mouse, too be rather difficult. A joystick will solve this problem. The Logitech Extreme 3D PRO is plug and play, for the most part, with FlightGear. Most modern joysticks should also work. There is a dialog box to assign common joystick controls, in FlightGear. Controls are also properties, however that is for later. This joystick dialog box is found in the top menu bar under “Files”. Next you will find “Joystick Configration” to click on and that will bring up the desired dialog box.

If the joystick’s travel is not being used efficiently or the neutral dead band is not right, the joystick can be calibrated. Install jstest-gtk through the Raspbian software installer or use the terminal and apt-get install command.

sudo apt-get install jstest-gtk

After running jstest-gtk click on your joystick within the jstest-gtk window. Next click on the “Calibration” button. The calibration can be performed within this dialog box. Consider making note of these values before performing the calibration. Do not forget to cycle the hat switch that is on top of the stick. This is because this switch is considered as a proportional input just like the stick axis. In order to save these new settings, after a reboot or new power up, do not close jstest-gtk at this moment. First open a terminal and enter the below command in order to save the new calibration values. The “device_name” of the joystick is in the first dialog box of jstest-gtk. It will be something like js0, js1 etc.

Jscal-store <device_name>

Some or most Linux distributions will need more work to store these new calibration values, in the way of RULES. However, it seems that Raspbian doesn’t require anymore work.

The above calibration may not adjust for any center dead band. Notice that the calibration values are representing binary numbers in that the maximums are in power of two’s. Except where the maximum value is 1 or -1. It is common to see these values close to 512 or 1024. Consider the values below. To find the maximum value add the RangeMin to the RangeMax. For example; 0 + 1024 = 1024. The first pair of numbers, not considering the axis number, should add up to the maximum value.

Axis CenterMin CenterMax RangeMin RangeMax
0 512 512 0 1024
1 512 512 0 1024
2 128 128 0 256
3 128 128 0 256
4 0 0 -1 1
5 0 0 -1 1

In order to introduce a dead band consider the values below:

Axis CenterMin CenterMax RangeMin RangeMax
0 500 524 0 1024
1 500 524 0 1024
2 120 136 0 256
3 120 136 0 256
4 0 0 -1 1
5 0 0 -1 1

Or the values in the calibration dialog box screenshot, entitled "Joystick calibration using jstest-gtk dialog box".

Axis 4 and 5 are examples of the hat switch.

Joystick calibration using jstest-gtk dialog box.


Performance settings