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

From FlightGear wiki
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 17: Line 17:
 
</gallery>
 
</gallery>
  
== Update Raspbian ==
+
== Possible Paths ==
Use the below commands to update your Raspberry Pi:
 
  
<syntaxhighlight lang="bash">
+
[[File:FlightGear System.jpg|FlightGear and the Raspberry Pi family.]]
sudo apt-get update
 
sudo apt-get full-upgrade
 
</syntaxhighlight>
 
  
Do not use the below update command unless you know how and why to use it. This command will install experimental software that has a good chance of breaking your operating system. It is like flying into a thunder storm cloud.
+
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.
  
<syntaxhighlight lang="bash">
+
== Did You Know ==
sudo rpi-update          (DO NOT USE)
 
</syntaxhighlight>
 
  
==Compiling ==
+
===Sun, tree and other textures===
===When to recompile/build===
+
[[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.
  
Watch for release announcements [1] or subscribe to the flightgear-commitlogs mailing list [2] (lots of emails).
 
 
 
[1]  https://www.flightgear.org/category/news/
 
 
[2]  https://sourceforge.net/projects/flightgear/lists/flightgear-commitlogs
 
 
===Download_and_compile.sh===
 
[[Scripted Compilation on Linux Debian/Ubuntu]]
 
 
There can be a complication when using a version of FlightGear that has been built with download_and_compile.sh. This involves the combination of  two situations; the version is being used and changes are being performed to files within the FlightGear build, furthermore the build is being updated at a later time. During updates, Git keeps an eye on any changes too files within this build. Git assumes that you are a software developer, of course this is no problem if you know what you are doing. So if Git sees a change or a new file is created, like to a joystick file, it thinks you are a developer and keeps track of changes. The issue shows up, after changes were performed, when download_and_compile.sh goes to update the FlightGear build. Git gets involved and needs to know how to integrate your changes with the changes from the update performed by download_and_compile.sh. An easy solution is to make a second copy of FlightGear to use and just update the original. Or make a copy of fgdate and use the FlightGear launcher to point to this working/running version of fgdata. Here we are assuming that the modified or created files are only within fgdata.
 
 
 
====Raspberry Pi OS 64-bit====
 
 
OSG will need patched, [[Howto:Build_and_run_FlightGear_on_Raspberry_Pi_4#Patching|OSG patch]]. If source files and folders were used for Raspbian 32-bit, delete the build and install folders.
 
 
FlightGear may fail to compile with the below error:
 
<syntaxhighlight>
 
/usr/bin/ld: ../../3rdparty/sqlite3/libfgsqlite3.a(sqlite3.c.o): in function `sqlite3_column_name16':
 
/media/pi/ea5ced60-d2bc-44fc-adb8-5781729826a1/flightgear/dnc-managed/flightgear/3rdparty/sqlite3/sqlite3.c:76778:(.text+0x16470): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `sqlite3_value_text16' defined in .text section in ../../3rdparty/sqlite3/libfgsqlite3.a(sqlite3.c.o)
 
/usr/bin/ld: /media/pi/ea5ced60-d2bc-44fc-adb8-5781729826a1/flightgear/dnc-managed/flightgear/3rdparty/sqlite3/sqlite3.c:76778:
 
collect2: error: ld returned 1 exit status
 
</syntaxhighlight>
 
 
The fix is to edit this file; <code>/flightgear/dnc-managed/flightgear/3rdparty/sqlite3/CMakeLists.txt</code>. Within CMakeLists.txt, change <code>fpic</code> to <code>fPIC</code>
 
 
Scott wrote:
 
<blockquote>
 
The main difference between -fpic and -fPIC is that little-pic generates
 
faster code, but severely limits you to a small address space (e.g. 64KB
 
data buffer).  big-PIC will leverage a much larger address space (e.g.
 
2GB) and therefore requires more address bytes to reach the full address
 
range.  More address bytes equates to a small performance hit.
 
 
I don't program the ARM enough to know what the hard limit is when using
 
-fpic, but whatever the limit is, the compiler is telling you that this
 
limit has been exceeded.
 
 
I always use -fPIC as it is rarely worth the fuss to try -fpic first and
 
then switch to -fPIC when that fails.
 
 
Scott
 
</blockquote>
 
 
 
Now follow the instruction on the download_and_compile.sh page.
 
 
===Raspbian===
 
This is not meant to be a fast copy and past compiler method. Below, is meant to be compiling more by learning or understanding. However, there will be plenty of opportunities for copying and pasting.
 
 
===Dependencies===
 
 
[[Howto:Build_and_run_FlightGear_on_Raspberry_Pi_4#Download_and_compile.sh|Download_and_Compile.sh]] does a good job of installing the needed dependencies, as of 01/03/2021. Refer to that script for more information.
 
 
====Extra Information====
 
The command <code>dpkg -s package_name</code> can be used, in the terminal to verify if a package is installed. Replace 'package_name' with the name of the dependency from the above list.
 
 
Before installing any missing dependencies, update Raspbian per the above (Download_and_Compile.sh will do this for you) [[Howto:Build_and_run_FlightGear_on_Raspberry_Pi_4#Update_Raspbian|Update Raspbian]] instructions. The below terminal command can be used to install any missing dependencies:
 
 
<syntaxhighlight lang="bash">
 
sudo apt-get install package_name
 
</syntaxhighlight>
 
 
===git===
 
A popular method to control software revisions is with <code>git</code>. Some basic knowledge of <code>git</code> is helpful and interesting. So, try to learn the basics.
 
 
{| class="wikitable"
 
|-
 
! '''<big>♦♦♦ Warning ♦♦♦</big>'''
 
|-
 
| Edward wrote:
 
<blockquote>
 
Please only run 'git clone' once ever!  That is once per machine, new
 
install, etc.  Otherwise SourceForge will permanently blacklist your IP
 
address.  The strain on their infrastructure with our huge repositories is
 
far too much.
 
</blockquote>
 
 
|}
 
 
When using some <code>git</code> commands you might be prompted by <code>git config --global user.email "you@example.com"</code> and or <code>git config --global user.name "Your Name"</code>. In that case a user account is needed at [http://www.github.com www.github.com]. So, before starting the compiling process it would be advisable to first go to their web page and create a free user account. After acquiring the user account, use the below commands (one at a time) in order to satisfy the above <code>git</code> requirement. Replace 'you@example.com' with your <code>git</code> account email address and also replace 'Your Name' with the user name for this account. It might be best to choose a user name without a space in it.
 
 
<syntaxhighlight lang="bash">
 
git config --global user.email "you@example.com"
 
 
git config --global user.name "Your Name"
 
</syntaxhighlight>
 
 
Link to <code>git</code> [https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration configuration and customization] information page.
 
 
Some Essential git commands:
 
* <code>git status</code>
 
* <code>git checkout</code>
 
* <code>git pull</code>
 
** Can be used to update the fgmeta folder when using the download_and_compile.sh script. Use this command from within the fgmeta folder.
 
* <code>git reset --hard</code>
 
* <code>git log</code>
 
 
Also see [[FlightGear Git]].
 
 
===Copy Path(s)===
 
[[File:Copy Path(s).jpeg|thumb|150px|Easy way to copy the path of a file or folder.]]
 
 
During the manual compiling process there will be times when the path of a file or folder is needed for a Terminal command. One easy GUI short cut is to right click on the file or folder to pull up an option list. Find the option 'Copy Path(s)' and click on it. The path of the file or folder will be copied. Next, in the Terminal, click on 'Edit' at the top of the Terminal window and then click on 'Paste' in order to past the link into the Terminal. See the screen shot to the left.
 
 
===Location of Files===
 
The SD card performs well for common computer tasks and running FlightGear. However, compiling large programs could wear out the SD card before it's time. This is an excellent application for a SSD drive. Especially if many compiled versions of FlightGear are planned. For that reason this Wiki will choose to compile and install FlightGear on a [[Howto:Build_and_run_FlightGear_on_Raspberry_Pi_4#Hard_Drives|SSD drive]].
 
 
This is a good time to create some needed folders on the SSD. For this Wiki the folder '''FlightGear''' was created in the root of the SSD. Within this newly created folder '''FlightGear''', create two more folders named '''fg-install''' and '''source'''. Use your favorite method to navigate and create folders, whether it be the Terminal or GUI. Furthuremore, these files can have other names as long as those other names are globally used.
 
 
===Build Order===
 
 
PLIB, OSG, SimGear, FlightGear
 
 
===Patching; OSG patch example===
 
There could come a time when the source needs to be patched before compiling. In this case the <code>patch</code> command can be used along with it's argument <code>-p</code>. For example; the OpenSceneGraph-3.4.0 requires the '0007-Explicit-signed-char-type-for-portability-base64.patch' patch, in order for it to compile for the ARM architecture.
 
 
In this example, the patch can be found at this link: [https://sources.debian.org/patches/openscenegraph-3.4/3.4.1+dfsg1-5/ OpenSceneGraph-3-4-0 patch]. The <code>download</code> link for '0007-Explicit-signed-char-type-for-portability-base64.patch' is what we are looking for. This file can be downloaded with the <code>wget</code> command as seen below:
 
 
<syntaxhighlight>wget --trust-server-names https://sources.debian.org/src/openscenegraph-3.4/3.4.1+dfsg1-5/src/osgPlugins/osgjs/Base64.cpp/</syntaxhighlight>
 
 
Place, the above patch file, into the the source root folder of OpenSceneGraph-3-4-0.
 
 
The argument ,<code>-p</code> adjusts the path of the patch. Below is an example of a snippet from a patch. Reference the line ,<code>--- openscenegraph-3.4.orig/src/osgDB/ConvertBase64.cpp</code>. The folder <code>openscenegraph-3.4.orig/</code> can not be used, in our example. In this case, one of the path folders need to be ignored, hence <code>-p1</code>. If two path folders needed to be ignored; <code>-p2</code>.
 
 
<syntaxhighlight>Index: openscenegraph-3.4/src/osgDB/ConvertBase64.cpp
 
===================================================================
 
--- openscenegraph-3.4.orig/src/osgDB/ConvertBase64.cpp
 
+++ openscenegraph-3.4/src/osgDB/ConvertBase64.cpp
 
@@ -28,7 +28,7 @@ namespace osgDB
 
 
    int base64_decode_value(char value_in)
 
    {
 
-        static const char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
 
+        static const signed char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
 
        static const char decoding_size = sizeof(decoding);
 
        value_in -= 43;
 
        if (value_in < 0 || value_in > decoding_size) return -1;</syntaxhighlight>
 
 
Navigate the terminal into the root folder of OpenSceneGraph-3.4.0 source. Side note: the <code>patch</code> command might need to be installed. Now enter the below command into the terminal:
 
 
<syntaxhighlight>patch -p1 <0007-Explicit-signed-char-type-for-portability-base64.patch</syntaxhighlight>
 
 
===OpenRTI===
 
OpenRTI is optional. If you're using it, you need to compile it before SimGear (and therefore, before FlightGear). It's orthogonal to OSG.
 
 
==Backtrace using gdb: and Download_and_compile.sh==
 
Tracking down a crash with <code>double free corruption (fasttop)</code>
 
 
Set environment variable:
 
<syntaxhighlight>
 
set environment MALLOC_CHECK_ 2
 
</syntaxhighlight>
 
 
Next run FlightGear with debug:
 
<syntaxhighlight lang="bash">
 
./run_fgfs_debug.sh --launcher
 
</syntaxhighlight>
 
 
Use the below gdb commands <code> handle SIGPIPE nostop and handle SIG32 nostop</code>  to skip innocent events:
 
<syntaxhighlight>
 
gdb: handle SIGPIPE nostop
 
gdb: handle SIG32 nostop
 
</syntaxhighlight>
 
 
Use <code>r</code> within gdb to run FlightGear:
 
<syntaxhighlight>
 
gdb: r
 
</syntaxhighlight>
 
 
After the crash use the gdb command <code>bt</code> to print the backtrace:
 
<syntaxhighlight>
 
gdb: bt
 
</syntaxhighlight>
 
 
==osgviewer==
 
Using the command line osgviewer to display models. These instructions are for FlightGear and OSG built with download_and_compile.sh.
 
 
<syntaxhighlight>
 
cd /flightgear/dnc-managed/install/openscenegraph/bin
 
 
export LD_LIBRARY_PATH=../openscenegraph/lib:$LD_LIBRARY_PATH
 
 
./osgviewer "path to your model file"
 
</syntaxhighlight>
 
 
Type <code>h</code> for the help menu.
 
 
== Feature Scaling - FlightGear ==
 
{{See also|FlightGear and OpenGL ES}}
 
 
=== Menu Bar ===
 
 
Hiding the menu bar improves FPS too some degree. More so when FlightGear is running in a window. It can be toggled on/off with [Shift] + [F10] or the Auto Hide option can be used.
 
 
=== GPU Profile ===
 
{{Main article|Graphics card profiles}}
 
 
The following GPU profile was provided by enrogue <ref>https://forum.flightgear.org/viewtopic.php?f=45&t=36922&p=364937#p364914</ref>
 
<syntaxhighlight lang="xml">
 
<?xml version="1.0"?>
 
 
<PropertyList>
 
  <shaders>
 
    <custom-settings type="bool">true</custom-settings>
 
    <clouds type="double">0</clouds>
 
    <generic type="double">1</generic>
 
    <landmass type="double">3</landmass>
 
    <model type="double">0</model>
 
    <contrails type="double">1</contrails>
 
    <crop type="double">0</crop>
 
    <skydome type="bool">false</skydome>
 
    <transition type="double">0</transition>
 
    <urban type="double">0</urban>
 
    <water type="double">3</water>
 
    <wind-effects type="double">0</wind-effects>
 
    <vegetation-effects type="double">0</vegetation-effects>
 
    <forest type="double">0</forest>
 
    <lights type="double">3</lights>
 
    <quality-level-internal type="double">3</quality-level-internal>
 
    <quality-level type="double">-1</quality-level>
 
  </shaders>
 
  <random-objects type="bool">true</random-objects>
 
  <random-vegetation type="bool">true</random-vegetation>
 
  <random-vegetation-shadows type="bool">false</random-vegetation-shadows>
 
  <random-vegetation-normals type="bool">false</random-vegetation-normals>
 
  <vegetation-density type="double">1</vegetation-density>
 
  <random-buildings type="bool">false</random-buildings>
 
  <building-density type="double">1</building-density>
 
  <point-sprites type="bool">true</point-sprites>
 
  <particles type="bool">true</particles>
 
  <clouds3d-enable type="bool">true</clouds3d-enable>
 
  <clouds3d-vis-range type="double">10000</clouds3d-vis-range>
 
  <clouds3d-detail-range type="double">10000</clouds3d-detail-range>
 
  <clouds3d-density type="double">0.25</clouds3d-density>
 
  <shadows>
 
    <enabled type="bool">true</enabled>
 
  </shadows>
 
</PropertyList>
 
</syntaxhighlight>
 
 
=== FG1000 ===
 
{{Main article|FG1000}}
 
 
For the time being, the FG1000 must be considered hardly usable on the RPi, i.e. ~200ms/5fps. We're currently in the process of investigating what can be done to make it possible to use the device on the RPi, since that would seem like a perfect use-case.
 
 
One thing that's obvious is that initialization of the device takes unusually long.
 
To see what's going on, we can wrap the initialization code inside $FG_ROOT/gui/menubar.xml in between profiling calls:
 
 
{{See also|Built-in Profiler}}
 
<syntaxhighlight lang="diff">
 
diff --git a/gui/menubar.xml b/gui/menubar.xml
 
index ff3faa1ac..6c94b2e76 100644
 
--- a/gui/menubar.xml
 
+++ b/gui/menubar.xml
 
@@ -834,6 +834,7 @@
 
                        <binding>
 
                                <command>nasal</command>
 
                                <script>
 
+                                      fgcommand("profiler-start");
 
                                        var nasal_dir = getprop("/sim/fg-root") ~ "/Aircraft/Instruments-3d/FG1000/Nasal/";
 
                                        if (! defined("fg1000")) {
 
                                                io.load_nasal(nasal_dir ~ 'FG1000.nas', "fg1000");
 
@@ -846,6 +847,7 @@
 
                                        var fg1000system = fg1000.FG1000.getOrCreateInstance();
 
                                        var pfdindex = fg1000system.addPFD();
 
                                        fg1000system.displayGUI(pfdindex);
 
+                                      fgcommand("profiler-stop");
 
 
                                </script>
 
                        </binding>
 
</syntaxhighlight>
 
 
 
Another thing worth trying is running the built-on OSG optimizer on the root group, this requires patching SG/FG respectively:
 
 
<syntaxhighlight lang="diff">
 
diff --git a/simgear/canvas/elements/CanvasGroup.hxx b/simgear/canvas/elements/CanvasGroup.hxx
 
index 33687637..288da23d 100644
 
--- a/simgear/canvas/elements/CanvasGroup.hxx
 
+++ b/simgear/canvas/elements/CanvasGroup.hxx
 
@@ -20,6 +20,8 @@
 
#ifndef CANVAS_GROUP_HXX_
 
#define CANVAS_GROUP_HXX_
 
 
+#include <osgUtil/Optimizer>
 
+
 
#include "CanvasElement.hxx"
 
 
#include <list>
 
@@ -97,6 +99,11 @@ namespace canvas
 
      osg::BoundingBox
 
      getTransformedBounds(const osg::Matrix& m) const override;
 
 
+      void optimize () {
 
+            osgUtil::Optimizer opt;
 
+            opt.optimize(_scene_group.get()  );
 
+      }
 
+
 
    protected:
 
 
      static ElementFactories  _child_factories;
 
 
</syntaxhighlight>
 
 
<syntaxhighlight lang="diff">
 
diff --git a/src/Scripting/NasalCanvas.cxx b/src/Scripting/NasalCanvas.cxx
 
index 602f06989..23aadfb36 100644
 
--- a/src/Scripting/NasalCanvas.cxx
 
+++ b/src/Scripting/NasalCanvas.cxx
 
@@ -521,7 +521,8 @@ naRef initNasalCanvas(naRef globals, naContext c)
 
    .bases<NasalElement>()
 
    .method("_createChild", &f_groupCreateChild)
 
    .method( "_getChild", &f_groupGetChild)
 
-    .method("_getElementById", &sc::Group::getElementById);
 
+    .method("_getElementById", &sc::Group::getElementById)
 
+    .method("optimize", &sc::Group::optimize);
 
  NasalText::init("canvas.Text")
 
    .bases<NasalElement>()
 
    .method("heightForWidth", &sc::Text::heightForWidth)
 
</syntaxhighlight>
 
 
== Feature Scaling - Raspberry Pi OS ==
 
 
=== Screen Resolution ===
 
[[File:Screen Layout Editor.jpeg|thumb|150px|Raspberry Pi screen layout editor for adjusting screen resolution.]]
 
 
When running FlightGear, using the full screen option, 1024 X 768 resolution works well. Possibly because this is FlightGear's native resolution. In order to choose this resolution go to the Raspbian program menu 'Preferences' and run 'Screen Configuration'. Now right click on the screen that needs to be adjusted to 1024 X 768, on the Screen Layout Editor seen to the right. If using two screens, it might be best to set both screens to the same resolution. Also, it is best to have the two HDMI boxes touching so that the mouse cursor doesn't have a dead spot. Click on the green check to finish.
 
 
=== Memory split ===
 
The memory split option is found in the <code>raspi-config</code> program, under "7 Advanced Options."
 
<syntaxhighlight lang="diff">
 
sudo raspi-config
 
</syntaxhighlight>
 
 
This option adjusts <code>gpu_mem</code> and thus allots the GPU memory. Starting with the Pi4, most of the GPU memory is controlled by the the Linux kernal and there is a disadvantage when <code>gpu_mem</code> is set too high. Never exceed  512MB, less is better. <code> vcgencmd get_mem gpu</code> will report GPU memory set by <code>gpu_mem</code>.
 
 
For more information see [https://www.raspberrypi.org/documentation/configuration/config-txt/memory.md Memory options in config.txt]
 
 
==Interfacing==
 
Expanding the flight simulator system beyond the primary Raspberry Pi4, that is running FlightGear, is one way to increase the computing power of such a small computer.
 
 
===Avare===
 
 
[[File:Avare.jpg|thumb|200px|Avare connected to the Raspberry Pi4 and FlightGear. Avare is a moving aviation chart app.]]
 
 
Avare is a free aviation app, with no ads, that works well with FlightGear. It is an app that is used by many pilots. It will provide a moving map of the FlightGear aircraft, using all FAA charts and a lot more. These charts are for the USA, however some of these FAA Charts cover Puerto Rico, plus parts of Canada, Mexico and the Caribbean. For other parts of the world, there are other apps that might work. Avare can be downloaded from Google Play Store. A tablet is a good choice for running this app.
 
 
FlightGear and Avare are easy to bind together. Along with the main Avare app, the I/O app will also need to be installed on the tablet. This app is ‘Avare External I/O Plugin’. The scheme is that the Raspberry Pi4 and FlightGear will become the GPS signal used by the Avare app, this position is transferred via WiFi. So, the tablets internal GPS needs to be OFF. Avare will always prompt you to turn ON the internal GPS, so when asked to ‘Turn On GPS’, choose ‘No’. In ‘Preferances’ the GPS position source can and should be set to ‘Avare IO Module Only’, however the prompt to turn ON the internal GPS will still pop up when starting the app.
 
 
The below command tells FlightGear what to connect to and it's protocol. This can be placed in the GFly type programs or if in Terminal, place the command after fgfs. The address, 192.168.??.?, needs to be the address of the tablet running Avare. Some home networks will randomly choose an address, hence this could change. It will be displayed in the IO app. The number 49002 needs to be the same number that is in the Avare IO app. Use the Xplane option.
 
 
{| class="wikitable"
 
|-
 
! Comm !! Comm Type !! Direction !! Hertz !! Machine Address !! Port !! Style !! Protocol
 
|-
 
| --generic || socket || out || 2 || 192.168.??.?? || 49002 || udp || avare
 
|}
 
 
The table above helps to explain the command line below.
 
 
<syntaxhighlight lang="bash">
 
--generic=socket,out,2,192.168.??.??,49002,udp,avare
 
</syntaxhighlight>
 
 
After FlightGear has started with the above command, open the Avare External I/O Plugin app. Choose the Xplane option and then tap on ‘Listen’. There should be lines of communication being displayed after ‘Listen’ is enabled. Leave this running and now open the main Avare app. Do not choose to use the internal GPS. Now your FlightGear aircraft placement should be displayed on the FAA map of choice.
 
 
===Official 7" Touch Screen===
 
 
[[File:Official 7" touch screen.jpg|thumb|150px|The Official 7" Touch Screen for the Raspberry Pi with an external numeric keypad.]]
 
 
[[File:Bottom veiw, 7" touch screen.jpg|thumb|150px|Bottom view of the 7" touch screen for the Raspberry Pi.]]
 
 
[[File:Phi-PFD and official Raspberry touch screen.jpg|thumb|150px|The Phi PFD displayed on the official Raspberry Pi touch screen.]]
 
 
There is the Official 7” Touch Screen for the Raspberry Pi. This screen will work with a number of different models of the Raspberry Pi’s. There is a case for it (there is no Official case) and the Pi, however the new Pi4 doesn’t fit this case, seen in the photo at the right.  This combination does resemble a modern aircraft instrument. There is a new case that will fit the Pi4 and other models, SmartPi Touch 2.
 
 
[https://smarticase.com/ SmartPi Touch 2]
 
 
Phi will work with almost any device with a browser. In this example the Touch Screen is used with a Raspberry Pi3 B+. There is a screen touch keyboard, however only the numeric keyboard is needed to operate the Radio Stack and the full keyboard doesn’t make efficient use of the screen area. To the right, an external numeric keypad is being used. It makes an interesting combination to touch on screen hot spots and use the external keyboard to input the radio frequencies. A numeric touch screen keypad is being looked into.
 
 
Pass the below command to FlightGear, during startup, using your favorite method:
 
 
<syntaxhighlight lang="bash">
 
--httpd=8080
 
</syntaxhighlight>
 
 
In the browser address bar, the one with the 7” Touch Screen, type the below address. Replace the '??' with your numbers. This address needs to be the address of the Raspberry Pi4 that is running FlightGear. Some home networks randomly assign addresses, so when launching FlightGear it is good practice to check the address. To easily find this address, place the mouse cursor on the WiFi/Network icon that is on the top menu bar. It is to the far right.
 
 
<syntaxhighlight lang="bash">
 
192.168.??.??:8080
 
</syntaxhighlight>
 
 
In order to adjust the screen brightness use the below command to write a value into the brightness file. Adjusting the number ‘128’ to a lower value will reduce the brightness of the screen.
 
 
<syntaxhighlight lang="bash">
 
sudo sh -c ‘echo “128”>/sys/class/backlight/rpi_backlight/brightness’
 
</syntaxhighlight>
 
 
Other, less expensive, models of Raspberry Pi’s should also work. As long as it has the port for the Official Touch Screen and can run a browser. There are also third party touch screens on the market. However, purchasing official Raspberry products help to support the Raspberry Foundation promote computer education. Hopefully some of the young budding computer scientists will find value in FlightGear!
 
 
==64-bit operating system==
 
The Raspberry Pi4 can run FlightGear with a 64-bit OS.
 
 
===Ubuntu Server===
 
 
[https://jamesachambers.com/raspberry-pi-4-ubuntu-server-desktop-18-04-3-image-unofficial/  Unofficial distribution of Ubuntu Server 18.04.4 for Raspberry Pi 4.]
 
 
[https://launchpad.net/~saiarcot895/+archive/ubuntu/flightgear FlightGear PPA for Raspberry Pi 4.]
 
 
==Cooling==
 
[[File:Cooling fan Raspberry Pi4.jpg|thumb|150px|Noctua cooling fan used to cool the Raspberry Pi4 while running FlightGear.]]
 
 
The video core GPU temperature can be read with the use of the terminal and the below command:
 
 
<syntaxhighlight lang="bash">
 
vcgencmd measure_temp
 
</syntaxhighlight>
 
 
The Raspberry Pi4 starts to throttle at 80c, and will be fully throttled when it hits 85. When flying the DC-3 Dakota at a steady cruse altitude, in a low scenery dense area, the core temperature was reported to be ~75c. This was with ambient temperature of ~24c. The temperature rapidly dropped to ~45c when the cooling fan was energized. There was no heat sink installed for this test. FlightGear was running in fullscreen mode on monitor 1 and terminal was running on monitor 2. Screen resolution was possibly 1024 x 768.
 
 
The fan in the photo is a Noctua NF-A4x10 5V. It is installed with two rubber bands forming an X. Then the fan is simply sandwiched in the middle of the X. The ends of the rubber bands are looped over the ends of the four standoffs. The rubber bands, in addition to holding the fan, help to isolate vibrational noise. In this setup the fan was powered by an orphaned cell phone charger.
 
 
There are also inexpensive heat sink kits.  Some opt for no after market cooling options at all, however it has been reported the the Pi4 will self cool the best when placed/mounter in the vertical direction.
 
 
==Memory==
 
 
===SD Card===
 
For casual running of FlightGear, a quality SD card works well. Look for Class A1 cards. The 'A' is for applications. In addition to a write speed of 10MB/s, these support at least 1500 read operations and 500 write operations per second. Do not use cheap fake SD cards. Interestingly, there is a new tool to test your SD cards. This new tool is called agnostics and can be installed with the below commands:
 
 
<syntaxhighlight lang="bash">
 
sudo apt update
 
sudo apt install agnostics
 
</syntaxhighlight>
 
 
What device does it test?
 
 
Simon Long wrote (from the below link)
 
<blockquote>
 
It tests whatever device currently containst the directory /var/tmp. If you want to test another device, modify the relevant line in sd_bench.fio to select a directory on the device you want to test.
 
</blockquote>
 
 
To learn much more about the SD cards and agnostics, see the below link:
 
 
[https://www.raspberrypi.org/blog/sd-card-speed-test/ SD Card Speed Test]
 
 
====SD Card Speed Test====
 
 
{| class="wikitable"
 
|-
 
! SD Card !! Bar Code !! SWS KB/sec !! RWS IOPS !! RRS IOPS !! Comment
 
|-
 
| SP Superior Pro 64GB || X0026RJ70Z || 38986 || 1067 || 3344 || Used for ~ 1 month
 
|-
 
| Example || Example || Example || Example || Example || Example
 
|-
 
| Example || Example || Example || Example || Example || Example
 
|}
 
 
===Hard Drives===
 
{{not done}}
 
  
 
[[Category:Raspberry Pi]]
 
[[Category:Raspberry Pi]]
 
[[Category:Building from source‎]]
 
[[Category:Building from source‎]]

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.