Changes for page Dependencies and Compilation
Last modified by Soeren Domroes on 2025/01/30 12:18
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,190 +1,1 @@ 1 -= Building and Running the Pinball Autopilot on the Pi = 2 - 3 -The source code lies and building happens inside the folder called {{code language="none"}}pinballProject{{/code}}. For a fresh built, you need a not too old version of {{code language="none"}}make{{/code}}, a C++ compiler (we only tested {{code language="none"}}g++{{/code}}), a 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 pre-requisits met, you can use the {{code language="none"}}Makefile{{/code}} to build everything. 6 - 7 -|=((( 8 -Command 9 -)))|=((( 10 -Functionality (All the builds are incremental, i.e. only happen once when the source code is unchanged.) 11 -))) 12 -|((( 13 -{{code language="none"}} 14 -make 15 -{{/code}} 16 -)))|((( 17 -same as 18 - 19 -{{code language="none"}} 20 -make build_all 21 -{{/code}} 22 -))) 23 -|((( 24 -{{code language="none"}} 25 -make build_all 26 -{{/code}} 27 -)))|((( 28 -Build the main executable as well as the tools 29 - 30 -{{code language="none"}} 31 -video_capture 32 -{{/code}} 33 - 34 - and 35 - 36 -{{code language="none"}} 37 -calibrate 38 -{{/code}} 39 - 40 -. 41 -))) 42 -|((( 43 -{{code language="none"}} 44 -make build 45 -{{/code}} 46 -)))|((( 47 -Build the main executable “ 48 - 49 -{{code language="none"}} 50 -main 51 -{{/code}} 52 - 53 -”. 54 -))) 55 -|((( 56 -{{code language="none"}} 57 -make run 58 -{{/code}} 59 -)))|((( 60 -Build and execute the main executable. 61 -))) 62 -|((( 63 -{{code language="none"}} 64 -make ...xyz 65 -{{/code}} 66 -)))|((( 67 -Make file called “ 68 - 69 -{{code language="none"}} 70 -...xyz 71 -{{/code}} 72 - 73 -”, if a recipe exists. Most notably for 74 - 75 -{{code language="none"}} 76 -...xyz 77 -{{/code}} 78 - 79 - ~= 80 - 81 -{{code language="none"}} 82 -calibrate 83 -{{/code}} 84 -))) 85 -|((( 86 -{{code language="none"}} 87 -make capture 88 -{{/code}} 89 -)))|((( 90 -Build {{code language="none"}}video_capture{{/code}} and execute it. This tool can only be executed on the Pi and can record a video 91 -during manual gameplay which is then uploaded to mega.nz with a new numerical file-name. 92 -))) 93 -|((( 94 -{{code language="none"}}make get{{/code}} 95 -)))|((( 96 -Executes a python script that can (interactively) get a recorded video from the mega.nz folder. 97 -Intended for getting video input files transferred to a different machine (not the Pi) for testing the image detection. 98 -))) 99 -|(% colspan="1" %)(% colspan="1" %) 100 -((( 101 -{{code language="none"}} 102 -make clean 103 -{{/code}} 104 -)))|(% colspan="1" %)(% colspan="1" %) 105 -((( 106 -Removes all generated files except for 107 - 108 -{{code language="none"}} 109 -_pi_logged_in 110 -{{/code}} 111 - 112 -, downloaded videos and the downloaded Kieler Compiler. 113 -))) 114 -|(% colspan="1" %)(% colspan="1" %) 115 -((( 116 -{{code language="none"}} 117 -make clean_all 118 -{{/code}} 119 -)))|(% colspan="1" %)(% colspan="1" %) 120 -((( 121 -Like 122 - 123 -{{code language="none"}} 124 -make clean 125 -{{/code}} 126 - 127 -, but without the exceptions. This will delete everything in the folder 128 - 129 -{{code language="none"}} 130 -video 131 -{{/code}} 132 - 133 -! 134 -))) 135 - 136 -For instructions on how to use the {{code language="none"}}./calibrate{{/code}}, see [[doc:World Coordinate System]]. 137 - 138 -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. 139 - 140 -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). 141 - 142 -= Setting up the Pi for Better Real Time Performance = 143 - 144 -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 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 tasks on those cores. 145 - 146 -= Building and Running on Any Other Linux Machine = 147 - 148 -The program can be built and partially run on other machines. There you potentially need to install all the requirements yourself. Just {{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}}. We’ve observed problems with a too old version for {{code language="none"}}make{{/code}}, for example 4.2 should be 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 already. 149 - 150 -Running works like on the Pi. The main program 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, at the time of this writing there is a file called {{code language="none"}}1{{/code}} that you can get via {{code language="none"}}make get{{/code}} as well as a few more named files that were created before we had the {{code language="none"}}make capture{{/code}} command. 151 - 152 -After choosing a video file, the program starts using the video input in “real time”; since things are not really real-time, the controller does not work too well. (Simulating time properly is not fundamentally a problem but something we didn’t finish implementing.) This means you can mostly ignore the debug-printouts about ticks happening. What you can do is test the image processing / ball detection. This works better than on the Pi, because we are providing controls for pausing or changing the playback speed. 153 - 154 -|=((( 155 -Key 156 -)))|=((( 157 -Playback effect 158 -))) 159 -|((( 160 -{{code language="none"}} 161 -<space> 162 -{{/code}} 163 -)))|((( 164 -play/pause 165 -))) 166 -|((( 167 -{{code language="none"}} 168 -+ 169 -{{/code}} 170 -)))|((( 171 -increase playback speed ×2 172 -))) 173 -|((( 174 -{{code language="none"}} 175 -- 176 -{{/code}} 177 -)))|((( 178 -decrease playback speed ×0.5 179 -))) 180 -|(% colspan="1" %)(% colspan="1" %) 181 -((( 182 -{{code language="none"}} 183 -. 184 -{{/code}} 185 -)))|(% colspan="1" %)(% colspan="1" %) 186 -((( 187 -while paused, advance by one frame 188 -))) 189 - 190 -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). 1 +[TBA]
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -7307274 41 +73072743 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/PP18/pages/7307274 4/Dependencies and Compilation1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/PP18/pages/73072743/Dependencies and Compilation