Entwicklung autonomer mobiler Systeme MBM im Sommersemester 2023
(EN google-translate)
(PL google-translate)
|












#1 Fr 24.03.2023
|
Ein Beispiel mit ChatGPT (21.03.2023 https://chat.openai.com/chat):
FRAGE: Schreibe eine Klasse "Matrix" in Java/Processing, die die folgende Schnittstelle iMatrix implementiert und mit show() die gespeicherte zweidimensionale Integer-Matrix im Grafik-Fenster anzeigt. Dieses zweidimensionale Integer-Array wird bei Erzeugen eines Objektes dem Konstruktor übergeben und eine Referenz der Matrix soll im Objekt als private Attribut gespeichert werden. Die Darstellung soll die Zahlen in den Zeilen und Spalten der Matrix in einem rechteckigen Schema darstellen. Die Matrix soll zudem so angezeigt werden, dass Einer, Zehner usw. untereinander in Flucht dargestellt werden. Hier ist die Schnittstelle: public interface iMatrix { public abstract void show(); } ANTWORT: Hier ist eine mögliche Implementierung der Klasse "Matrix" in Java/Processing, die die Schnittstelle iMatrix implementiert und eine zweidimensionale Integer-Matrix im Grafik-Fenster anzeigt: public class Matrix implements iMatrix { private int[][] matrix; private PApplet parent; public Matrix(PApplet parent, int[][] matrix) { this.parent = parent; this.matrix = matrix; } public void show() { int numRows = matrix.length; int numCols = matrix[0].length; int cellSize = 40; int startX = 50; int startY = 50; parent.textSize(20); parent.noStroke(); for (int i = 0; i < numRows; i++) { for (int j = 0; j < numCols; j++) { int value = matrix[i][j]; int x = startX + j * cellSize; int y = startY + i * cellSize; parent.fill(255); parent.rect(x, y, cellSize, cellSize); parent.fill(0); parent.text(value, x + cellSize/2, y + cellSize/2); } } } } Die Klasse nimmt im Konstruktor eine Referenz auf das Processing-Objekt parent sowie ein zweidimensionales Integer-Array matrix als Argumente. Die Matrix wird als private Attribut matrix gespeichert. Die Methode show() zeichnet die Matrix im Grafik-Fenster. Die Größe der Zellen wird auf cellSize festgelegt, der Abstand zum linken und oberen Rand auf startX und startY. Die Methode iteriert über die Zeilen und Spalten der Matrix und zeichnet für jede Zelle ein weißes Rechteck mit schwarzer Zahl in der Mitte. Die Zahlen werden mit der Processing-Methode text() in der Mitte der Zelle platziert und mit der Methode textSize() auf 20 Pixel gesetzt. Die Methode noStroke() sorgt dafür, dass keine Umrandung der Zellen gezeichnet wird. Um die Klasse zu nutzen, kann ein Objekt von Matrix mit einer Matrix-Referenz erstellt und die show-Methode aufgerufen werden: int[][] matrix = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; Matrix matrixObj = new Matrix(this, matrix); matrixObj.show();
Code 0-1: Frage an ChatGPT und dessen Antwort.
Ohne Anspruch auf Vollständigkeit zergliedert sich die Lehrveranstaltung in folgende Einzelthemen:
|
Ergänzend sollen auch aktuelle Forschungsergebnisse angeschaut werden. Dies erfolgt seminaristisch.
FTS

Autonomes Fahren Level 1 bis 5

Warum ist autonomes Fahren noch nicht so weit?

Miteinander zu kombinierende Teilsysteme



Autonomes Fahren und Sicherheit
Schaut man sich das zweite Video an, so wird einem sofort klar, dass es hier auch um Sicherheit gehen soll. So hat Schweden sich das Ziel gesetzt, keine Verkehrstoten mehr zu haben und die Firma Volvo, dass es keine Unfälle mehr mit Autos dieser Marke geben soll.


Autonomes Fahren und Ethik

Gehen Sie in Zweiergruppen die Szenarien durch.
Diskutieren Sie anschließend im Plenum Ihre Erfahrungen.
Feedback
Was sind Ihre Erwartungen an diesen Kurs?
#2 Fr 31.03.2023
Themen:
|
public void setup() { size(500,500); frameRate(1); } boolean AN = true; public void draw() { background(255); if(AN) fill(0,255,0); else fill(255,0,0); ellipse(width/2, height/2, height/2, height/2); AN = !AN; }
Code 0-2: Unterrichtsbeispiel zu Processing.
public void setup() { size(500,500); frameRate(1); } boolean AN = true; public void draw() { background (255); textSize(100); if(AN) { fill (0,255,0); } else { fill (255,0,0); } ellipse(width/2, height/2, height/2, height/2); if(AN) { fill (0); text("AN", 175, 275); } else { fill (0); text("AUS", 150, 275); } AN = !AN; }
Code 0-3: Variante 2
public void setup() { size(500,500); frameRate(1); } boolean AN = true; public void draw() { background (255); textSize(100); if(AN) { fill (0,255,0); ellipse(width/2, height/2, height/2, height/2); fill(0); text("AN", 175, 275); } else { fill (255,0,0); ellipse(width/2, height/2, height/2, height/2); fill(0); text("AUS", 150, 275); } AN = !AN; }
Code 0-4: Variante 3
public void drawSchild(int[] FARBE, String text) { fill (FARBE[0],FARBE[1],FARBE[2]); ellipse(width/2, height/2, height/2, height/2); fill(0); text(text, 175, 275); } public void setup() { size(500,500); frameRate(1); } boolean AN = true; public void draw() { background (255); textSize(100); if(AN) { drawSchild(new int[] {0,255,0},"AN"); } else { drawSchild(new int[] {255,0,0},"AUS"); } AN = !AN; }
Code 0-5: Variante 4

Bild 0-1: Screenshot.
OOP
Auto auto1,auto2; public void setup() { auto1 = new Auto(new int[] {255,0,0},new int[] {0,255,0}); auto2 = new Auto(new int[] {255,0,255},new int[] {128,0,0}); size(500,500); } public void draw() { for(int i=0;i<width;i+=250) auto1.draw(i,height/2); for(int i=0;i<width;i+=220) auto2.draw(i,height/4); }
Code 0-6: Hauptsketch
public class Auto { int[] COL1; int[] COL2; public Auto(int[] COL1, int[] COL2) { this.COL1 = COL1.clone(); this.COL2 = COL2.clone(); } public void draw(float x, float y) { fill(COL1[0],COL1[1],COL1[2]); rect(x,y,200,50); rect(x+30,y-30,80,30); fill(COL2[0],COL2[1],COL2[2]); ellipse(x+30,y+50,20,20); ellipse(x+200-30,y+50,20,20); } }
Code 0-7: Tab "Auto"

Bild 0-2: Screenshot
Auto auto1,auto2; public void setup() { int[] arr = new int[3]; int[] arr1 = {1,2,3}; // arr[0]=9; auto1 = new Auto(new int[] {255,0,0},new int[] {0,255,0}); auto2 = new Auto(new int[] {255,0,255},new int[] {128,0,0}); size(600,600); } int x=0; public void draw() { background(123); for(int i=-width;i<width;i+=200) auto1.draw(x+i,height/2); for(int i=-width;i<width;i+=200) auto2.draw(x*2+i,height/4); x+=4; x%=width/2; }
Code 0-8: Variante: Fahrende Kolonne.
Auto auto1,auto2,auto3; public void setup() { int[] arr = new int[3]; int[] arr1 = {1,2,3}; // arr[0]=9; auto1 = new Auto(new int[] {255,0,0},new int[] {0,255,0}); auto2 = new Auto(new int[] {255,0,255},new int[] {128,0,0}); auto3 = new Auto(new int[] {0,255,0},new int[] {128,128,0}); size(800,600); } int x=0; public void draw() { background(123); for(int i=-width;i<width;i+=200) auto1.draw(x+i,height/2); for(int i=-width;i<width;i+=200) auto2.draw(x*2+i,height/4); for(int i=-2*width;i<width*2;i+=200) auto3.draw(x*4+i,height/4+height/2); x+=4; x%=width/2; //if(x>=width/2) x=0; }
Code 0-9: Variante: drei fahrende Kolonnen.
Eine Klasse, die Vektoren erzeugt
public class Vektor { private double x,y; public Vektor(double xx, double yy) { x = xx; y = yy; } public double length() { return Math.sqrt(x*x+y*y); } } public void setup() { Vektor v1 = new Vektor(1,2); Vektor v2 = new Vektor(3,4); println("|v1|="+v1.length()); println("|v2|="+v2.length()); println("v1.x="+v1.x); } public void draw() { }
Code 0-10: Eine Klasse, die Vektoren erzeugt

Bild 0-3: Variante: drei fahrende Kolonnen.
Modellierung und Simulation eines Fahrzeugschwarms

Bild 0-4: Screenshot zu AVSIM004_multiCar




Vorübungen mit AVSIM zur Einarbeitung (jeweils allein):
|
Übungen mit AVSIM (jeweils in Zweiergruppen):
|