Howto:Build and run FlightGear on Raspberry Pi 4: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
 
(180 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Joysticks ==
{{FlightGearRaspberryPi4 Navigation}}
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 Configuration' 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.
It is now possible to run FlightGear on a Raspberry Pi, starting with the model Pi 4. The objective of [[Howto:Build and run FlightGear on Raspberry Pi 4]] is to introduce Pi users to FlightGear and possibly FlightGear users to the Raspberry Pi family. One of the main objectives of the Raspberry Pi is education. Hopefully this marriage will introduce some young programmers to FlightGear. Although this will mainly deal with the Pi 4, other models may find applications in the area of flight panels and instruments.


sudo apt-get install jstest-gtk
== Gallery ==


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.
<gallery mode=packed widths=230px heights=230px>
Pi4 ADW-ERI 1.png|Raspberry Pi4
Pi4 ADW-ERI 2.png|Raspberry Pi4
Pi4 ADW-ERI 4.png|Raspberry Pi4
Pi4 ADW-ERI 5.png|Raspberry Pi4
Pi4 ADW-ERI 7.png|Raspberry Pi4
Pi4 ADW-ERI 13.png|Raspberry Pi4
Pi4 ADW-ERI 15.png|Raspberry Pi4
Pi4 ADW-ERI 16.png|Raspberry Pi4
Pi4 Desk.jpg|Raspberry Pi4 running flightGear. One touchscreen and Raspberry P3 A+ with Phi PFD and a second with Phi radio stack.
</gallery>


sudo jscal-store /dev/input/js0
== Possible Paths ==


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.
[[File:FlightGear System.jpg|FlightGear and the Raspberry Pi family.]]


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. Since this scheme starts with 0, not 1, 1022 or 510 might be the maximum value. The first pair of numbers, not considering the axis number, should add up to the maximum value.
The Raspberry Pi can run FlightGear or perform other duties. Creating avionics steam gauges to more modern touch screen avionics devices. These ancillary Raspberries can serve a standard desktop computer running FlightGear or another Raspberry running FlightGear with most of the settings set to low.


{| class="wikitable"
== Did You Know ==
|-
! Axis !! CenterMin !! CenterMax !! RangeMin !! RangeMax
|-
| 0 || 511 || 511 || 0 || 1022
|-
| 1 || 511 || 511 || 0 || 1022
|-
| 2 || 127 || 127 || 0 || 254
|-
| 3 || 127 || 127 || 0 || 254
|-
| 4 || 0 || 0 || -1 || 1
|-
| 5 || 0 || 0 || -1 || 1
|}


In order to introduce a dead band consider the values below:
===Sun, tree and other textures===
[[File:Rendering.png|thumb|How to fix some texture issues with the Raspberry Pi4.]]
Did you know that the sun, tree and other textures can be fixed by enabling the "Cache graphics for faster loading" option, that is found in the launcher? This works for version 2020.3.5.


{| class="wikitable"
|-
! Axis !! CenterMin !! CenterMax !! RangeMin !! RangeMax
|-
| 0 || 491 || 531 || 20 || 1002
|-
| 1 || 491 || 531 || 20 || 1002
|-
| 2 || 117 || 137 || 10 || 254
|-
| 3 || 117 || 137 || 10 || 254
|-
| 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".
[[Category:Raspberry Pi]]
 
[[Category:Building from source‎]]
Axis 4 and 5 are examples of the hat switch.
 
[[File:Jstest-gtk Joystick Calibration.jpg|thumb|Joystick calibration using jstest-gtk dialog box.]]
 
 
<big>'''Saitek Saitek Pro Flight Quadrant'''</big>
 
This throttle quadrant is now produced by Logitech and works with FG and the Raspberry Pi4. If used with a single engine aircraft or a multi engine aircraft where the engines are controlled with one stick on the quadrant, this will be a plug and play setup. However, there will be a noticeable dead band in the middle of the travel. Furthermore, it is possible that all the usable stick travel is not utilized. Both of these issues can be addressed by calibrating the quadrant as in the joystick example above. Below is the calibration data before calibration and below that is the data after calibration. Notice that the center dead band is removed.
 
{| class="wikitable"
|-
! Axis !! CenterMin !! CenterMax !! RangeMin !! RangeMax
|-
| 0 || 112 || 124 || 15 || 239
|-
| 1 || 112 || 124 || 15 || 239
|-
| 2 || 112 || 124 || 15 || 239
|}
 
After calibration below:
{| class="wikitable"
|-
! Axis !! CenterMin !! CenterMax !! RangeMin !! RangeMax
|-
| 0 || 127 || 127 || 0 || 255
|-
| 1 || 127 || 127 || 0 || 255
|-
| 2 || 127 || 127 || 0 || 255
|}
 
If this quadrant is used with a multi engine aircraft and each engine throttle is controlled by a separate quadrant lever, the levers will only use half of its travel. In order to resolve this, the joystick configuration file will need a small edit. This file is located in homepi/.fgfs/Input, assuming your user name is ‘pi’. Notice that ‘.fgfs’ is a hidden folder in your Home folder. Only edit the joystick configuration files that are in your Home folder. Do not edit the files that are native to FlightGear. In this example we will be editing ‘Saitek-Saitek-Pro-Flight-Quadrant.xml’.
 
Let us assume that this configuration is for the twin engine DC-3 Dakota and axis-0 will be assigned to ALL engine mixture levers, axis-1 will be assigned to ‘Throttle Engine 0’ and axis-2 is assigned to ‘Throttle Engine 1’. Note that within this .XML configuration file that <axis> is another way to express <axis n=’0’>. The axis-0 doesn’t need the n=’0’. Find <axis n=’1’> and change the ‘offset’ from 0 to -1  also change ‘factor’ from 1 to -0.5. Do the same for <axis n='2'>.
 
==Compiling ==
==Performance settings ==
==Interfacing==

Latest revision as of 03:04, 19 January 2021


It is now possible to run FlightGear on a Raspberry Pi, starting with the model Pi 4. The objective of Howto:Build and run FlightGear on Raspberry Pi 4 is to introduce Pi users to FlightGear and possibly FlightGear users to the Raspberry Pi family. One of the main objectives of the Raspberry Pi is education. Hopefully this marriage will introduce some young programmers to FlightGear. Although this will mainly deal with the Pi 4, other models may find applications in the area of flight panels and instruments.

Gallery

Possible Paths

FlightGear and the Raspberry Pi family.

The Raspberry Pi can run FlightGear or perform other duties. Creating avionics steam gauges to more modern touch screen avionics devices. These ancillary Raspberries can serve a standard desktop computer running FlightGear or another Raspberry running FlightGear with most of the settings set to low.

Did You Know

Sun, tree and other textures

How to fix some texture issues with the Raspberry Pi4.

Did you know that the sun, tree and other textures can be fixed by enabling the "Cache graphics for faster loading" option, that is found in the launcher? This works for version 2020.3.5.