Raccolta di esercizi svolti per la materia scolastica Robotica e AI con Open Roberta Lab, l'ambiente di programmazione a blocchi per robot. Tutti i programmi sono pensati per un robot LEGO Mindstorms EV3 e possono essere eseguiti nel simulatore integrato di Open Roberta Lab.
Per ogni esercizio il repository contiene il programma esportato (XML), il codice Java generato automaticamente da Open Roberta e la configurazione della scena di simulazione (JSON). Per alcuni esercizi è presente anche un video dell'esecuzione nel simulatore.
Cartelle
| Cartella | Descrizione |
|---|---|
File XML dei progetti/ |
Programmi a blocchi esportati da Open Roberta Lab (robot ev3), reimportabili nell'editor |
Codice Java dei progetti/ |
Codice Java (leJOS / runtime Open Roberta) generato a partire dai blocchi |
File JSON dei progetti/ |
Configurazioni della simulazione (*-sim_configuration.json): posizione iniziale del robot, ostacoli e aree colorate |
Video dei progetti/ |
Registrazioni .mp4 di alcuni esercizi eseguiti nel simulatore (cerchio, esagono, rombo, triangolo, robot in città) |
Esercizi
| Esercizio | Cosa fa il robot |
|---|---|
| Il quadrato | Percorre un quadrato: 4 volte avanti di 30 cm e rotazione di 90° a destra (LED verde lampeggiante) |
| Es. compito per casa per il 15.11.2022 | Percorso composto da tre lati di un quadrato, una curva e una serie di tratti con rotazioni di 45° e 90° |
| Il cerchio (compito per il 18.11.2022) | Disegna un cerchio con una curva a velocità diverse sulle due ruote |
| Il rombo (compito per il 18.11.2022) | Ruota di 45° e poi percorre 4 lati da 50 cm con rotazioni di 90° |
| Il triangolo (compito per il 18.11.2022) | Percorre tre lati con rotazioni a sinistra per formare un triangolo |
| L'esagono (compito per il 18.11.2022) | Percorre una figura a sei lati alternando tratti rettilinei e rotazioni |
| Il numero otto | Disegna un "8" con due curve consecutive in direzioni opposte |
| Il robot in città | Segue un percorso prestabilito fatto di tratti dritti, rotazioni, curve e pause |
| Il labirinto circolare | Segue una linea usando il sensore di colore (porta S3): curva in un senso se vede il nero, nell'altro altrimenti |
| Il labirinto contorto | Dopo un tratto iniziale, avanza e corregge la direzione in base al colore letto dal sensore di colore (porta S3) |
- Open Roberta Lab (programmazione a blocchi NEPO) e il suo simulatore
- LEGO Mindstorms EV3 come robot di riferimento (motori grandi sulle porte B e C, sensore di colore sulla porta S3 nei labirinti)
- Java (codice generato automaticamente, basato su leJOS e sulla libreria runtime di Open Roberta)
- XML e JSON per l'esportazione di programmi e scene di simulazione
- Apri Open Roberta Lab e scegli il robot EV3.
- Importa uno dei file della cartella
File XML dei progetti/dal menu di modifica del programma (importazione di un programma). - Avvia la simulazione; per ricreare la stessa scena è possibile caricare il file
*-sim_configuration.jsoncorrispondente dalla cartellaFile JSON dei progetti/. - In alternativa, guarda direttamente i video in
Video dei progetti/.
Nota: i file
.javasono codice generato da Open Roberta per il robot EV3 e dipendono dalle sue librerie (de.fhg.iais.roberta.*,lejos.*): non si compilano con un semplicejavace servono soprattutto come riferimento per vedere come i blocchi vengono tradotti in Java.
- Un browser web per usare Open Roberta Lab (online)
- Facoltativo: un robot LEGO Mindstorms EV3 per eseguire i programmi su hardware reale
- Un lettore video per i file
.mp4
A collection of exercises completed for the school subject Robotics and AI ("Robotica e AI") using Open Roberta Lab, the block-based programming environment for robots. All programs target a LEGO Mindstorms EV3 robot and can be run in Open Roberta Lab's built-in simulator.
For each exercise the repository contains the exported program (XML), the Java code automatically generated by Open Roberta, and the simulation scene configuration (JSON). Some exercises also include a video of the run in the simulator.
Folders
| Folder | Description |
|---|---|
File XML dei progetti/ |
Block programs exported from Open Roberta Lab (robot ev3), which can be re-imported into the editor |
Codice Java dei progetti/ |
Java code (leJOS / Open Roberta runtime) generated from the blocks |
File JSON dei progetti/ |
Simulation configurations (*-sim_configuration.json): robot start pose, obstacles and colour areas |
Video dei progetti/ |
.mp4 recordings of some exercises running in the simulator (circle, hexagon, rhombus, triangle, robot in the city) |
Exercises
| Exercise | What the robot does |
|---|---|
| Il quadrato (The square) | Drives a square: 4 times forward 30 cm and a 90° right turn (green LED flashing) |
| Es. compito per casa per il 15.11.2022 (Homework, 15 Nov 2022) | A path made of three sides of a square, a curve and a series of segments with 45° and 90° turns |
| Il cerchio (The circle, homework 18 Nov 2022) | Draws a circle with a curve using different speeds on the two wheels |
| Il rombo (The rhombus, homework 18 Nov 2022) | Turns 45°, then drives 4 sides of 50 cm with 90° turns |
| Il triangolo (The triangle, homework 18 Nov 2022) | Drives three sides with left turns to form a triangle |
| L'esagono (The hexagon, homework 18 Nov 2022) | Drives a six-sided shape alternating straight segments and turns |
| Il numero otto (The number eight) | Draws an "8" with two consecutive curves in opposite directions |
| Il robot in città (The robot in the city) | Follows a predefined route of straight segments, turns, curves and pauses |
| Il labirinto circolare (The circular maze) | Follows a line using the colour sensor (port S3): curves one way when it sees black, the other way otherwise |
| Il labirinto contorto (The twisted maze) | After an initial segment, drives forward and corrects its direction based on the colour read by the colour sensor (port S3) |
- Open Roberta Lab (NEPO block programming) and its simulator
- LEGO Mindstorms EV3 as the target robot (large motors on ports B and C, colour sensor on port S3 in the maze exercises)
- Java (auto-generated code based on leJOS and the Open Roberta runtime library)
- XML and JSON for exporting programs and simulation scenes
- Open Open Roberta Lab and select the EV3 robot.
- Import one of the files from
File XML dei progetti/via the program edit menu (import program). - Start the simulation; to recreate the same scene you can load the matching
*-sim_configuration.jsonfile fromFile JSON dei progetti/. - Alternatively, just watch the videos in
Video dei progetti/.
Note: the
.javafiles are code generated by Open Roberta for the EV3 robot and depend on its libraries (de.fhg.iais.roberta.*,lejos.*): they do not compile with a plainjavacand are mainly useful as a reference for how the blocks are translated into Java.
- A web browser to use Open Roberta Lab (online)
- Optional: a LEGO Mindstorms EV3 robot to run the programs on real hardware
- A video player for the
.mp4files