EmulatoreEmulator-desktop

Un binario Windows che compila l'albero src/ reale del firmware contro stub Arduino/ESP32 e lo disegna con raylib. Non è una ricostruzione del viso: esegue lo stesso codice che gira sulla board. A Windows binary that compiles the real firmware src/ tree against Arduino/ESP32 stubs and draws it with raylib. It is not a re-implementation of the face: it runs the same code that runs on the board.

Cosa condivide con il dispositivoWhat it shares with the device

L'emulatore è utile perché ricompila gli stessi sorgenti: un cambiamento al Brain o al FaceEngine si verifica subito, senza flashare.The emulator is useful because it recompiles the same sources: a change to Brain or FaceEngine is verified immediately, without flashing.

Il progetto sparky-amoled/emulator/ include un EmuStubs.cpp che sostituisce le parti impossibili da replicare su PC — rete, server web, BLE, streaming video, metriche, schermi News e Stream — con implementazioni vuote o minime. Tutto il resto è il codice di produzione: motore del viso, Brain, macchina a stati degli atti, gestione dello schermo, pipeline audio e APU del Game Boy.The sparky-amoled/emulator/ project includes an EmuStubs.cpp that replaces the parts impossible to replicate on a PC — network, web server, BLE, video streaming, metrics, News and Stream screens — with empty or minimal implementations. Everything else is production code: face engine, Brain, act state machine, screen handling, audio pipeline, and the Game Boy APU.

Il risultato è un banco di prova per il comportamento: reazioni agli eventi, espressioni, transizioni, script e catture. Non è un sostituto del dispositivo per la rete, la BLE, lo streaming o le prestazioni reali: l'hardware, la memoria contigua e i tempi della board restano il riferimento.The result is a test bench for behaviour: event reactions, expressions, transitions, scripts, and captures. It is not a replacement for the device when it comes to networking, BLE, streaming, or real performance: the hardware, contiguous memory, and board timings remain the reference.

  • CondivisoShared
    FaceEngine, Expressions, Acts, Brain, InputMap, AppRegistry, audio.FaceEngine, Expressions, Acts, Brain, InputMap, AppRegistry, audio.
  • StubStubbed
    Net, WebService, Ble, VideoStream, Metrics, News, Stream.Net, WebService, Ble, VideoStream, Metrics, News, Stream.
  • InterfacciaInterface
    raylib: finestra, tastiera, mouse, screenshot PNG.raylib: window, keyboard, mouse, PNG screenshots.
  • StrumentiTooling
    tools/emu_build.ps1 e tools/mock-model.js per il modello di risposta.tools/emu_build.ps1 and tools/mock-model.js for the reply model.

CompilazioneBuilding

La build host richiede un compilatore C++ e raylib disponibili nel percorso previsto dal Makefile.The host build requires a C++ compiler and raylib available at the path expected by the Makefile.

ComandiCommands

cd sparky-amoled/emulator
make
./robot_emu.exe --script "2:expr=Happy; 4:shot=cap.png"

PrerequisitiPrerequisites

  • Compilatore C++ con supporto C++17.C++ compiler with C++17 support.
  • Raylib installata nel percorso indicato dal Makefile.Raylib installed at the path set in the Makefile.
  • Windows per l'eseguibile robot_emu.exe.Windows for the robot_emu.exe binary.
  • tools/emu_build.ps1 automatizza i passaggi ripetibili.tools/emu_build.ps1 automates the repeatable steps.
Stato della build host:Host-build status: Non è stata verificata una build host completa dell'emulatore nel repository: fino a quel momento i riferimenti di questa pagina valgono come documentazione del codice sorgente, non come collaudo. L'unico modulo compilato con successo su host finora è stata l'APU, con MSVC. No complete host build of the emulator has been verified in the repository: until that happens, the references on this page are documentation of the source code, not a test report. The only module compiled successfully on a host so far has been the APU, with MSVC.

ComandiCommands

Il protocollo testuale accetta i comandi da 0 a 9 e i comandi nominativi; l'output è JSON con reply, emotion, gesture, display e session.The text protocol accepts commands from 0 to 9 and named commands; the output is JSON with reply, emotion, gesture, display, and session.

ComandoCommandEffettoEffect
faceMostra il catalogo delle espressioni disponibili.Shows the catalogue of available expressions.
actMostra il catalogo degli atti animati.Shows the catalogue of animated acts.
setImposta espressione, atto, volume, luminosità o altra proprietà.Sets expression, act, volume, brightness, or another property.
sayMostra un testo nel fumetto del viso.Shows text in the face balloon.
stopInterrompe animazione, audio e fumetto in corso.Stops the running animation, audio, and balloon.
resetRiporta l'emulatore allo stato iniziale.Returns the emulator to its initial state.
moodLegge o imposta il mood corrente del Brain.Reads or sets the Brain's current mood.
pingVerifica che il processo risponda.Checks that the process responds.
ttsRichiede la sintesi vocale del testo indicato.Requests speech synthesis of the given text.
0 – 9Scorciatoie per le nove espressioni preferite, dalla normale alla risata.Shortcuts for the nine favourite expressions, from neutral to laugh.

Tastiera e mouseKeyboard and mouse

Nella finestra raylib i tasti agiscono direttamente sul Brain, senza passare dalla rete.In the raylib window, keys act directly on the Brain, without going through the network.

Espressioni e attiExpressions and acts

  • 1…9 — le nove espressioni preferite.the nine favourite expressions.
  • Tab / Shift+Tab — espressione successiva o precedente.next or previous expression.
  • 0 — atto selezionato; [ e ] cambiano atto.selected act; [ and ] change act.
  • Y / U — atti “Yes” e “No”.“Yes” and “No” acts.
  • H — scrive un messaggio nel fumetto.writes a message in the balloon.

Ambiente e simulazioneEnvironment and simulation

  • S — rumore improvviso.sudden noise.
  • W — parola di attivazione.wake word.
  • V, ←, → — voce e direzione del suono.voice and sound direction.
  • I — richiesta di informazioni.information request.
  • C — stato di ricarica.charging state.
  • B / N + Shift — pulsanti laterali BOOT e PWR, pressione breve o lunga.BOOT and PWR side buttons, short or long press.

StrumentiTools

  • A — attiva o disattiva il comportamento autonomo.toggles autonomous behaviour.
  • Q — mostra la macchina a stati.shows the state machine.
  • P — salva uno screenshot PNG.saves a PNG screenshot.
  • F — raddoppia la velocità di simulazione fino a 8×.doubles simulation speed up to 8×.
  • Invio — pausa e riprende.pauses and resumes.
  • Mouse: clic e trascinamento sul vetro simulano tocco e carezza.Mouse: click and drag on the glass simulate tap and petting.

Modalità scriptScript mode

Gli script rendono riproducibili le scene: espressione, atto, testo, tocco, rumore, voce e cattura in una timeline ordinata.Scripts make scenes reproducible: expression, act, text, tap, noise, voice, and capture in one ordered timeline.

La sintassi è tempo:comando=valore, con i passi separati da punto e virgola. Il tempo è in secondi dall'avvio. Quando tutti i passi sono stati eseguiti e non ci sono catture in coda, l'emulatore termina da solo: è il modo più semplice per generare una sequenza di immagini per la documentazione.The syntax is tempo:comando=valore, with steps separated by semicolons. Time is in seconds from start-up. Once every step has run and no captures remain, the emulator exits by itself: this is the simplest way to produce an image sequence for documentation.

robot_emu.exe --script "2:expr=Happy; 4:shot=captures/smile.png; 5:act=Yes; 7:say=Ciao; 9:quit"

I comandi disponibili nello script includono expr, act, say, tap, hold, stroke, noise, voice, wake, hour, battery, charging, auto, states, info, shot e quit.The commands available in a script include expr, act, say, tap, hold, stroke, noise, voice, wake, hour, battery, charging, auto, states, info, shot, and quit.

Comando scriptScript commandEsempioExample
expr3:expr=Curious
act5:act=Yes
say7:say=Ciao
tap1:tap=184,224
hold2:hold=120,120
noise2:noise
voice4:voice=-45
shot6:shot=captures/a.png

Limiti da conoscereLimits to know

L'emulatore riproduce la logica, non l'hardware. Le differenze sono intenzionali e documentate.The emulator reproduces logic, not hardware. The differences are intentional and documented.

Nessuno stack di rete reale:No real network stack: Non esiste un servizio di compatibilità che esponga le 115 route HTTP del dispositivo. Le API del robot devono essere provate sul dispositivo o con uno stub dedicato; l'emulatore serve il viso, il Brain e le app. Allo stesso modo mancano BLE, streaming video, metriche reali e i contenuti News e Stream. There is no compatibility service exposing the device's 115 HTTP routes. The robot's APIs must be tested on the device or with a dedicated stub; the emulator serves the face, the Brain, and the apps. Likewise, BLE, video streaming, real metrics, and News/Stream content are missing.

Cosa mancaWhat is missing

Wi-Fi e scansione delle reti, server web, stack BLE, streaming MJPEG, metriche di produzione, feed RSS e schermate Stream.Wi-Fi and network scanning, web server, BLE stack, MJPEG streaming, production metrics, RSS feeds, and Stream screens.

Cosa non è simulatoWhat is not simulated

Tempi reali della board, consumo energetico, dimensione della memoria contigua, PSRAM reale e qualità del display AMOLED.Real board timings, power consumption, contiguous-memory size, actual PSRAM, and AMOLED display quality.

Come validareHow to validate

Usa l'emulatore per il comportamento e la logica, poi la board per integrazione, rete, memoria e resa sul vetro.Use the emulator for behaviour and logic, then the board for integration, networking, memory, and on-glass rendering.