-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathchapter12.tex
More file actions
1141 lines (817 loc) · 27.6 KB
/
Copy pathchapter12.tex
File metadata and controls
1141 lines (817 loc) · 27.6 KB
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
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Companion Computer}
\chapter[\texorpdfstring{\protect{\vspace{2pt}\englischertitel}}{\englischertitel}]{}
\kapitel{\deutschertitel}
\thispagestyle{empty}
\label{KapitelCompanionComputer}
\begin{paracol}{2}[]
{\raggedright\huge\bfseries\sffamily \englischertitel \par\ } \\[1.8ex]
\switchcolumn
{\raggedright\huge\bfseries\sffamily \deutschertitel \par\ } \\[1.8ex]
\coleng
A companion computer is useful for handling computationally intensive tasks such as artificial intelligence, computer vision, dynamic path replanning, cloud communication, and mission planning, while leaving the drone’s stabilization and low-level flight control to the flight controller. Common examples of companion computers include the Raspberry Pi and NVIDIA Jetson platforms.
\colger
TBD
\colende
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Raspberry Pi as a Companion Computer}
\makroabschnitt
\label{AbschnittRaspberryPiCompanionComputer}
There are different versions of the Raspberry Pi, each serving different purposes depending on performance requirements and intended applications. To assist in selecting the appropriate model, a brief description of the available versions is provided in Section~\ref{AbschnittObjekterkennungHuckepack}.
\colger
TBD
\colende
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Flashing Raspberry Pi OS}
\makrounterabschnitt
It is recommended to install the headless version of Raspberry Pi OS, which is designed to operate without a monitor, keyboard, or mouse. Since the Raspberry Pi serves as a companion computer mounted on the UAV and is intended to be used remotely, a headless operating system is the most suitable choice. In addition, the absence of a graphical desktop environment reduces CPU utilization, memory consumption, and power usage.
\colger
TBD
\coleng
To flash Raspberry Pi OS, the following components are required:
\colger
TBD
\coleng
\begin{itemize}
\item Raspberry pi
\end{itemize}
\begin{itemize}
\item MicroSD card (at least 4 GB)
\end{itemize}
\begin{itemize}
\item MicroSD card reader
\end{itemize}
\begin{itemize}
\item Raspberry Pi Imager software (available for Windows, macOS, and Linux)
\end{itemize}
\colger
TBD
\colende
\begin{figure}[htbp]
\centering
\begin{minipage}[t]{0.48\textwidth}
\centering
\includegraphics[width=\linewidth]{pi_imager_screenshot_1.png}
\vspace{0pt} % sorgt für Top-Ausrichtung
\end{minipage}\hfill
\begin{minipage}[t]{0.48\textwidth}
\centering
\includegraphics[width=\linewidth]{pi_imager_screenshot_2.png}
\vspace{0pt}
\end{minipage}
\caption{Raspberry Pi Imager Software Screenshots. Left: OS selection. Right: Network configuration.}
\label{AbbildungRaspberryPiImagerSoftwareScreenshots1}
\end{figure}
\FloatBarrier
\colstart
Next, open Raspberry Pi Imager and select the appropriate Raspberry Pi model. Under Operating System, choose Raspberry Pi OS (Other) → Raspberry Pi OS Lite (See Figure~\ref{AbbildungRaspberryPiImagerSoftwareScreenshots1} left).
\colger
TBD
\coleng
Before writing the operating system to the microSD card, it is essential to do some configuration.
\colger
TBD
\coleng
\begin{itemize}
\item Configure the home WiFi network by entering the SSID and WiFi password (See Figure~\ref{AbbildungRaspberryPiImagerSoftwareScreenshots1} right).
\end{itemize}
\begin{itemize}
\item Configure the username and password to access the Raspberry Pi remotely, or enable SSH access with a public key (See Figure~\ref{AbbildungRaspberryPiImagerSoftwareScreenshots2} left).
\end{itemize}
\colende
\begin{figure}[htbp]
\centering
\begin{minipage}[t]{0.48\textwidth}
\centering
\includegraphics[width=\linewidth]{pi_imager_screenshot_3.png}
\vspace{0pt} % sorgt für Top-Ausrichtung
\end{minipage}\hfill
\begin{minipage}[t]{0.48\textwidth}
\centering
\includegraphics[width=\linewidth]{pi_imager_screenshot_4.png}
\vspace{0pt}
\end{minipage}
\caption{Raspberry Pi Imager Software Screenshots. Left: Password configuration. Right: Configuration summary.}
\label{AbbildungRaspberryPiImagerSoftwareScreenshots2}
\end{figure}
\FloatBarrier
\colstart
Once the configuration is complete, click Write to flash the operating system onto the microSD card. After the flashing process has finished, insert the microSD card into the Raspberry Pi and power on the device.
\colger
TBD
\colende
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Configuring Remote Communication}
\makrounterabschnitt
After booting, the Raspberry Pi automatically attempts to connect to the configured home WiFi network. If the connection is successful, the router assigns an IP address to the device.
\colger
TBD
\coleng
To determine the assigned IP address, open a command prompt on a computer connected to the same network and execute:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
ping <hostname>.local
//example: ping raspberrypi.local
\end{lstlisting}
\colstart
Alternatively, the IP address can be obtained from the list of connected devices in the router's administration interface.
\colger
TBD
\coleng
Once the IP address has been identified, establish an SSH connection using:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
ssh <username>@<ip_address>
//example: ssh pi@192.168.0.153
\end{lstlisting}
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Configuring a Fallback WiFi Hotspot}
\makrounterunterabschnitt
For field operations, a known WiFi network may not always be available. Therefore, it is useful to configure the Raspberry Pi so that it automatically creates its own wireless access point whenever it cannot connect to a predefined network. The desired behavior is as follows:
\colger
TBD
\coleng
\begin{itemize}
\item Known WiFi network available: Connect to the known network, allwing the other devices on the network to communicate with the Raspberry Pi.
\end{itemize}
\begin{itemize}
\item \item No known WiFi network available: Create a wireless access point for the Raspberry Pi, enabling direct communication with other devices without relying on an external network.
\end{itemize}
\colger
TBD
\colende
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Step 1: Create a new WiFi connection using NetworkManager:}
\makrounterunterabschnitt
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
sudo nmcli connection add \
type wifi \
ifname wlan0 \
con-name Pi-Hotspot \
autoconnect no \
ssid RespberryPi-Hotspot \
\end{lstlisting}
\colstart
The connection should be configured as an access point:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
sudo nmcli connection modify Pi-Hotspot \
802-11-wireless.mode ap \
ipv4.method shared \
wifi-sec.key-mgmt wpa-psk \
wifi-sec.psk "ChooseAStrongPassword"
\end{lstlisting}
\colstart
To verify that both the home WiFi connection and the hotspot configuration are stored, execute:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
nmcli connection show
// This should show:
// HomeWiFi
// Pi-Hotspot
\end{lstlisting}
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Step 2: Create a Fallback Script}
\makrounterunterabschnitt
This script checks whether the Raspberry Pi has successfully connected to a WiFi network. If no connection is detected, the hotspot is activated. The script can be saved as \verb!/usr/local/bin/wifi-fallback.sh! using the following command:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
sudo nano /usr/local/bin/wifi-fallback.sh
\end{lstlisting}
\colstart
Insert the following configuration into the file:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
#!/bin/bash
# Wait a little after boot
sleep 30
# Check whether WiFi is connected
if nmcli -t -f GENERAL.STATE device show wlan0 | grep -q "100"; then
exit 0
fi
echo "Could not connect to WiFi. Starting hotspot..."
nmcli connection up Pi-Hotspot
\end{lstlisting}
\colstart
Once the script is saved, make it executable with the following command:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
sudo nano /etc/systemd/system/wifi-fallback.service
\end{lstlisting}
\colstart
Now, in order to execute the fallback script automatically during system startup, create a systemd service:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
sudo nano /etc/systemd/system/wifi-fallback.service
\end{lstlisting}
\colstart
Insert the following configuration into the file:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
[Unit]
Description=Fallback WiFi Hotspot
After=NetworkManager.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/wifi-fallback.sh
[Install]
WantedBy=multi-user.target
\end{lstlisting}
\colstart
Save the file and enable the service to start automatically during system boot:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
sudo systemctl daemon-reload
sudo systemctl enable wifi-fallback.service
\end{lstlisting}
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Step 3: Verifying the Fallback Configuration}
\makrounterunterabschnitt
To test the fallback mechanism, disable the home WiFi network and reboot the Raspberry Pi. After some time, the Raspberry Pi should create its wireless access point. Connect another device to the hotspot using the configured SSID and password. The Raspberry Pi typically assigns itself the IP address 10.42.0.1, allowing SSH access via:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true, % <-- Zeilenumbruch aktivieren
breakatwhitespace=true, % <-- nur bei Leerzeichen umbrechen
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, % Pfeil am Zeilenende
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60}
}
\begin{lstlisting}[style=shell]
ssh pi@10.42.0.1
// Here pi is the configured username.
\end{lstlisting}
\colstart
TBD
\colger
TBD
\colende
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Hardware Connections}
\makrounterabschnitt
Connect the RX pin of the flight controller (FC) to the TX pin of the Raspberry Pi, and the TX pin of the FC to the RX pin of the Raspberry Pi (See figure \ref{AbbildungCompleteDroneWiringDiagramWithRaspberryPiZero2WCompanionComputer}). Detailed information about the Raspberry Pi GPIO pins and serial interfaces can be found at the following website:
\colger
TBD
\colende
\smallskip
\url{https://elinux.org/RPi_Low-level_peripherals}
\smallskip
\colstart
Powering the Raspberry Pi from the flight controller requires careful consideration. Most FPV flight controllers can supply a maximum current of approximately 2 A through their regulated 5 V output. Based on the version and heavy computation, the Raspberry Pi may consume a significant portion of this available current, leaving insufficient power for other peripherals such as the ExpressLRS receiver, GPS module, and video transmission system. Although in some cases, Pi can be powered directly from the flight controller's 5 V telemetry output, this configuration is generally not recommended.
\colger
TBD
\coleng
A more reliable solution is illustrated in Figure~\ref{AbbildungCompleteDroneWiringDiagramWithRaspberryPiZero2WCompanionComputer}, where the Raspberry Pi is powered directly from the main battery (VBAT) through a Battery Eliminator Circuit (BEC). In that case an extra component is required to step down the battery voltage to a stable 5 V supply for the Raspberry Pi. To know more about BECs, see Section~\ref{AbschnittObjekterkennungImplementierungHuckepack}.
\colger
TBD
\colende
\begin{figure}[htb!]
\centering
\includegraphics[width=\linewidth]{Complete_Drone_Wiring_Diagram_with_Raspberry_Pi_Zero_2_W_Companion_Computer.png}
\caption{Complete Drone Wiring Diagram with Raspberry Pi Zero 2 W Companion Computer.}
\label{AbbildungCompleteDroneWiringDiagramWithRaspberryPiZero2WCompanionComputer}
\end{figure}
\FloatBarrier
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Configuring ArduPilot for Companion Computer Communication}
\makrounterabschnitt
To enable communication between ArduPilot and the companion computer, open Config → Full Parameter List and modify the following parameters:
\colger
TBD
\coleng
\begin{itemize}
\item \verb!SERIAL1_PROTOCOL! = 9 (Enables the MAVLink 2 protocol for the corresponding serial port)
\end{itemize}
\begin{itemize}
\item \verb!SERIAL1_BAUD! = 921 (Sets the serial communication baud rate to 921600 bps.)
\end{itemize}
\colger
TBD
\coleng
Replace x with the UART number of the flight controller to which the Raspberry Pi is connected (e.g., SERIAL2).
\colger
TBD
\colende
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Configuring the Raspberry Pi Serial Port}
\makrounterabschnitt
Log in to the Raspberry Pi via SSH and launch the Raspberry Pi configuration utility by executing:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true,
breakatwhitespace=false,
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space},
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60},
columns=fullflexible,
keepspaces=true
}
\begin{lstlisting}[style=shell]
sudo raspi-config
\end{lstlisting}
\begin{figure}[htbp]
\centering
\begin{minipage}[t]{0.48\textwidth}
\centering
\includegraphics[width=\linewidth]{pi_software_configuration_tool_screenshot_1.png}
\vspace{0pt} % sorgt für Top-Ausrichtung
\end{minipage}\hfill
\begin{minipage}[t]{0.48\textwidth}
\centering
\includegraphics[width=\linewidth]{pi_software_configuration_tool_screenshot_2.png}
\vspace{0pt}
\end{minipage}
\caption{Raspberry Pi Software Configuration Tool.}
\label{AbbildungRaspiConfigTool}
\end{figure}
\FloatBarrier
\colstart
From the configuration menu, navigate to Interface Options → Serial Port (See Figure~\ref{AbbildungRaspiConfigTool}) and configure as follows:
\colger
TBD
\coleng
\begin{itemize}
\item Select No when prompted with "Would you like a login shell to be accessible over serial?"
\end{itemize}
\begin{itemize}
\item Select Yes when prompted with "Would you like the serial port hardware to be enabled?"
\end{itemize}
\colger
TBD
\coleng
Once completed and restarted, the primary UART of the Rasberry pi will abe avaliable at \verb!/dev/serial0! and can be used for communication with the flight controller.
\colger
TBD
\colende
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Safety Considerations Before Flight Testing}
\makrounterabschnitt
Before performing any flight tests using the companion computer, appropriate safety measures should be taken. When the UAV is controlled through the companion computer using MAVLink commands, the manual throttle, roll, pitch, and yaw inputs from the radio controller are overridden. Consequently, it is highly recommended to configure one or more emergency switches on the radio controller before testing.
\colger
TBD
\coleng
\begin{itemize}
\item Assign a switch to change the flight mode to a safe mode, such as Land or RTL.
\end{itemize}
\begin{itemize}
\item Assign a separate switch to disarm the vehicle immediately in case of unexpected behavior.
\end{itemize}
\begin{itemize}
\item Verify that the emergency switches function correctly before enabling companion computer control.
\end{itemize}
\colger
TBD
\colende
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Test Flight Using the Raspberry Pi}
\makrounterabschnitt
This section assumes that communication between the Raspberry Pi and the flight controller has already been established, and that the Raspberry Pi is accessible via SSH.
\colger
TBD
\coleng
The following software packages are required to execute the example Python scripts.
\colger
TBD
\coleng
Step 1: Update the package repository and install Vim to edit text:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true,
breakatwhitespace=false,
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space},
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60},
columns=fullflexible,
keepspaces=true
}
\begin{lstlisting}[style=shell]
sudo apt update
sudo apt install vim -y
\end{lstlisting}
\colstart
Step 2: Install the Python virtual environment package and create a dedicated virtual environment for the project:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true,
breakatwhitespace=false,
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space},
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60},
columns=fullflexible,
keepspaces=true
}
\begin{lstlisting}[style=shell]
sudo apt update
sudo apt install python3-venv -y
python3.11 -m venv venv
\end{lstlisting}
\colstart
Activate the virtual environment:
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true,
breakatwhitespace=false,
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space},
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60},
columns=fullflexible,
keepspaces=true
}
\begin{lstlisting}[style=shell]
source venv/bin/activate
\end{lstlisting}
\colstart
Step 3: Install the required Python packages
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true,
breakatwhitespace=false,
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space},
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60},
columns=fullflexible,
keepspaces=true
}
\begin{lstlisting}[style=shell]
pip install pymavlink mavproxy future
\end{lstlisting}
\renewcommand{\deutschertitel}{TBD}
\renewcommand{\englischertitel}{Testing Basic Vehicle Control from Companion Computer}
\makrounterabschnitt
Run the following Python script to verify that the Raspberry Pi can successfully communicate with the flight controller by issuing arm and disarm commands. If the connection does not work, verify that the serial port configuration and baud rate match the settings configured on the flight controller and Pi.
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true,
breakatwhitespace=false,
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space},
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60},
columns=fullflexible,
keepspaces=true
}
\begin{lstlisting}[style=shell]
from pymavlink import mavutil
import time
master = mavutil.mavlink_connection("/dev/serial0", baud=921600)
print("Waiting for heartbeat...")
master.wait_heartbeat()
print("Connected")
# ARM
print("Arming motors...")
master.arducopter_arm()
# Wait until armed
master.motors_armed_wait()
print("Armed!")
# Wait 2 seconds
time.sleep(5)
# DISARM
print("Disarming motors...")
master.arducopter_disarm()
print("Done")
\end{lstlisting}
\colstart
The following is test code for arming the UAV, taking off to an altitude of approximately 0.5 m, and then landing after completing the test sequence.
\colger
TBD
\colende
\lstdefinestyle{shell}{
backgroundcolor=\color{gray!10},
basicstyle=\ttfamily\small,
frame=single,
breaklines=true,
breakatwhitespace=false,
postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space},
showstringspaces=false,
xleftmargin=0em,
xrightmargin=0em,
framerule=0.5pt,
rulecolor=\color{gray!60},
columns=fullflexible,
keepspaces=true
}
\begin{lstlisting}[style=shell]
from pymavlink import mavutil
import time
import sys
# ---------------- Configuration ----------------
PORT = "/dev/serial0"
BAUD = 921600
TAKEOFF_ALT = 0.4 # meters
MAX_ALTITUDE = 0.5 # meters