Changes for page Dependencies and Compilation
Last modified by Soeren Domroes on 2025/01/30 12:18
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Parent
-
... ... @@ -1,1 +1,0 @@ 1 -PP18.Pinball Project - Winter Term 201920.Project Documentation.WebHome - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.stu12 26121 +XWiki.stu120505 - Content
-
... ... @@ -1,194 +1,1 @@ 1 -= Building and Running the Pinball Autopilot on the Raspberry Pi = 2 - 3 -The source code lies and building happens inside the folder called {{code language="none"}}pinballProject{{/code}}. For a fresh build, you need a not too old version of {{code language="none"}}make{{/code}}, a C++ compiler (we only tested {{code language="none"}}g++{{/code}}), an internet connection (for downloading the Kieler Compiler), the libraries {{code language="none"}}wiringPi{{/code}} and {{code language="none"}}opencv{{/code}} as well as the command-line tools [[mega-cmd>>url:https://mega.nz/cmd||shape="rect"]] and {{code language="none"}}python2{{/code}}. The tool for mega.nz (and also {{code language="none"}}python2{{/code}}) can be omitted (see below on how to compile without them), everything else except for {{code language="none"}}opencv{{/code}} comes pre-installed with Raspbian. For {{code language="none"}}opencv{{/code}} you need a 4.x version, 4.2.0 ought to work for example. Make sure to enable the option that the entries for {{code language="none"}}pkg-config{{/code}} get configured. It can be built from source on the Raspberry Pi in a few hours, make sure not to use too many threads for compilation because of limited RAM, also perhaps increase the swap. 4 - 5 -With all the prerequisites met, you can use the {{code language="none"}}Makefile{{/code}} to build everything. 6 - 7 -(% class="wrapped" %) 8 -|=((( 9 -Command 10 -)))|=((( 11 -Functionality (All the builds are incremental, i.e. only happen once when the source code is unchanged.) 12 -))) 13 -|((( 14 -{{code language="none"}} 15 -make 16 -{{/code}} 17 -)))|((( 18 -same as 19 - 20 -{{code language="none"}} 21 -make build_all 22 -{{/code}} 23 -))) 24 -|((( 25 -{{code language="none"}} 26 -make build_all 27 -{{/code}} 28 -)))|((( 29 -Build the main executable as well as the tools 30 - 31 -{{code language="none"}} 32 -video_capture 33 -{{/code}} 34 - 35 - and 36 - 37 -{{code language="none"}} 38 -calibrate 39 -{{/code}} 40 - 41 -. 42 -))) 43 -|((( 44 -{{code language="none"}} 45 -make build 46 -{{/code}} 47 -)))|((( 48 -Build the main executable “ 49 - 50 -{{code language="none"}} 51 -main 52 -{{/code}} 53 - 54 -”. 55 -))) 56 -|((( 57 -{{code language="none"}} 58 -make run 59 -{{/code}} 60 -)))|((( 61 -Build and execute the main executable. 62 -))) 63 -|((( 64 -{{code language="none"}} 65 -make ...xyz 66 -{{/code}} 67 -)))|((( 68 -Make file called “ 69 - 70 -{{code language="none"}} 71 -...xyz 72 -{{/code}} 73 - 74 -”, if a recipe exists. Most notably for 75 - 76 -{{code language="none"}} 77 -...xyz 78 -{{/code}} 79 - 80 - ~= 81 - 82 -{{code language="none"}} 83 -calibrate 84 -{{/code}} 85 -))) 86 -|((( 87 -{{code language="none"}} 88 -make capture 89 -{{/code}} 90 -)))|((( 91 -Build {{code language="none"}}video_capture{{/code}} and execute it. This tool can only be executed on the Pi and can record a video 92 -during manual gameplay which is then uploaded to mega.nz with a new numerical file-name. 93 -))) 94 -|((( 95 -{{code language="none"}}make get{{/code}} 96 -)))|((( 97 -Executes a python script that can (interactively) get a recorded video from the mega.nz folder. 98 -Intended for getting video input files transferred to a different machine (not the Pi) for testing the image detection. 99 -))) 100 -|(% colspan="1" %)(% colspan="1" %) 101 -((( 102 -{{code language="none"}} 103 -make clean 104 -{{/code}} 105 -)))|(% colspan="1" %)(% colspan="1" %) 106 -((( 107 -Removes all generated files except for 108 - 109 -{{code language="none"}} 110 -_pi_logged_in 111 -{{/code}} 112 - 113 -, downloaded videos and the downloaded Kieler Compiler. 114 -))) 115 -|(% colspan="1" %)(% colspan="1" %) 116 -((( 117 -{{code language="none"}} 118 -make clean_all 119 -{{/code}} 120 -)))|(% colspan="1" %)(% colspan="1" %) 121 -((( 122 -Like 123 - 124 -{{code language="none"}} 125 -make clean 126 -{{/code}} 127 - 128 -, but without the exceptions. This will delete everything in the folder 129 - 130 -{{code language="none"}} 131 -video 132 -{{/code}} 133 - 134 -! 135 -))) 136 - 137 -For instructions on how to use the {{code language="none"}}./calibrate{{/code}}, see [[doc:World Coordinate System]]. 138 - 139 -Working without mega.nz (and python): On the pi, you need to create a file called {{code language="none"}}_pi_logged_in{{/code}} (e.g. with {{code language="none"}}touch _pi_logged_in{{/code}}) before calling {{code language="none"}}make{{/code}} for the first time. On a different machine, you don’t need to do this. You cannot use {{code language="none"}}make capture{{/code}} or {{code language="none"}}make get{{/code}} without these command-line tools. 140 - 141 -If future updates of {{code language="none"}}mega-cmd{{/code}} or the command-line Kieler Compiler {{code language="none"}}kico.jar{{/code}} include relevant breaking changes, you might need to resolve those problems (work without {{code language="none"}}mega-cmd{{/code}} or acquire a {{code language="none"}}kico.jar{{/code}} from around March 2020). 142 - 143 -= Setting up the Pi for Better Real Time Performance = 144 - 145 -The program will stick its latency-sensitive threads for controlling the IO pins and for image processing to the cores 3 and 4 of the 4-core Raspberry Pi. To ensure best real-time performance, please configure the kernel parameter (% style="color: rgb(0,0,0);font-family: SFMono-Medium , SF Mono , Segoe UI Mono , Roboto Mono , Ubuntu Mono , Menlo , Courier , monospace;" %)2,3{{code language="none"}}isolcpus={{/code}}(%%) (they count starting from 0) to the file {{code language="none"}}/boot/cmdline.txt{{/code}} and reboot. This will make sure that the operating system doesn’t schedule any other tasks on those cores. 146 - 147 -= Building and Running on Any Other Linux Machine = 148 - 149 -The program can be built and partially run on other machines. There you potentially need to install all the requirements yourself. However, {{code language="none"}}wiringPi{{/code}} is not needed. Also don’t use a machine where the current user is called {{code language="none"}}pi{{/code}}, since that would confuse the compilation flags. We’ve observed problems with a too old version for {{code language="none"}}make{{/code}}, without knowing the exact lower bound, 4.2.1 is definitely new enough. Possibly {{code language="none"}}python2{{/code}} needs to be installed on your machine. Compared to a Raspberry Pi, compilation of {{code language="none"}}opencv{{/code}} on your machine is going to be a lot more fun (way faster and no issues with too little RAM). Regarding versions, see the relevant section above; note that {{code language="none"}}pkg-config{{/code}} is needed, too, in case you don’t have that installed already. 150 - 151 -Running the {{code language="none"}}make{{/code}} commands works like on the Pi. Just {{code language="none"}}make capture{{/code}} is not available. The main program will behave differently. It will prompt you for the name (without extension) of a video file in the {{code language="none"}}video{{/code}} folder. Make sure to get some file in there; at the time of writing this, there is a file called {{code language="none"}}1{{/code}} in the mega.nz-folder that you can get via {{code language="none"}}make get{{/code}}, as well as a few more named video files that were created before we had the {{code language="none"}}make capture{{/code}} command. 152 - 153 -After choosing a video file, the program starts using the video input in “real time”; however, since things are not really real-time, the logic controller part does not work too well. (Simulating the flow of time properly is not fundamentally a problem but something we didn’t finish implementing.) This means you should mostly ignore the debug-printouts about ticks happening. What you can really test is the image processing / ball detection. This works better than on the Pi, because we are providing controls for pausing or changing the playback speed. Press a key while any of the windows opened by the main program is in focus. 154 - 155 -(% class="wrapped" %) 156 -|=((( 157 -Key 158 -)))|=((( 159 -Playback effect 160 -))) 161 -|((( 162 -{{code language="none"}} 163 -<space> 164 -{{/code}} 165 -)))|((( 166 -play/pause 167 -))) 168 -|((( 169 -{{code language="none"}} 170 -+ 171 -{{/code}} 172 -)))|((( 173 -increase playback speed ×2 174 -))) 175 -|((( 176 -{{code language="none"}} 177 -- 178 -{{/code}} 179 -)))|((( 180 -decrease playback speed ×0.5 181 -))) 182 -|(% colspan="1" %)(% colspan="1" %) 183 -((( 184 -{{code language="none"}} 185 -. 186 -{{/code}} 187 -)))|(% colspan="1" %)(% colspan="1" %) 188 -((( 189 -while paused, advance by one frame 190 -))) 191 - 192 -If you recalibrate the coordinate system on the Pi, you might want to transfer the config file for the coordinate system (however there is nothing really depending on the coordinate transformation being correct inside the image detection anyways). 193 - 194 -The ability to compiler the whole project off the Pi allows for catching type errors etc. more quickly, since compilation on the Pi tends to be a lot slower and also there‘s not the option to use the Kieler IDE on it (so you’d maybe also need to transfer the code). The {{code language="none"}}pinballProject{{/code}} folder contains an Eclipse project that can be used with Kieler. Building from the Kieler IDE still happens by invoking the Makefile. There should be a build configuration using {{code language="none"}}make{{/code}} included in the project. (I’m only specifying “should” since we didn’t really test the experience of importing the project into a workspace too often.) 1 +[TBA]
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -7307273 51 +73072743 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/PP18/pages/7307273 5/Dependencies and Compilation1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/PP18/pages/73072743/Dependencies and Compilation