The backend includes a ROS 2 → WebSocket bridge that streams topic updates to clients.
- WebSocket server:
ws://localhost:8765 - Default topics:
/mouvement,/vibration
To run the backend with ROS enabled:
cd backend && ./run_with_ros.sh
If ROS is not sourced, the bridge will start but rclpy imports will fail.
Use the repo-level runner:
./run_all.sh start./run_all.sh status./run_all.sh stop
To set the ngrok URL, create a repo-level .env and set NGROK_URL:
echo 'NGROK_URL=https://uncompiled-ernestine-subtemperate.ngrok-free.dev' > .envTo enable the mmWave UART reader, set at least MMWAVE_DATA_PORT:
MMWAVE_DATA_PORT=/dev/ttyUSB1 MMWAVE_CLI_PORT=/dev/ttyUSB0 MMWAVE_CFG=3D_People_Tracking/chirp_configs/ODS_6m_default.cfg ./run_all.sh start
Viewer UART pour TI mmWave (IWR6843 / IWR6843ISK-ODS) — démo "Vital Signs".
Le script vitals_uart_viewer.py lit le port DATA UART (flux binaire TLV) et affiche en temps réel :
breathRate(BPM)heartRate(BPM)- états : CONNECTED/DISCONNECTED, SYNCING/STREAMING, PERSON_DETECTED/NO_PERSON + compteur
FRAME_ERROR
Il peut aussi (optionnel) envoyer un fichier .cfg au démarrage sur le port CLI UART.
Python 3 recommandé.
- Dépendance obligatoire :
pyserial
- Dépendances optionnelles (uniquement si
--plot) :numpy,matplotlib
Installation :
pip install pyserial
pip install numpy matplotlibSi le radar est déjà configuré et en train de streamer (config envoyée par un autre outil) :
python3 vitals_uart_viewer.py --data-port /dev/ttyUSB1python3 vitals_uart_viewer.py \
--cli-port /dev/ttyUSB0 \
--cfg /path/to/profile.cfg \
--data-port /dev/ttyUSB1Notes :
- Si le
.cfgne contient passensorStart, le script envoie automatiquementsensorStartaprès le fichier. - Si
--cfgest fourni sans--cli-port, le script tente d’inférer le port CLI depuis--data-port(ex:/dev/ttyUSB1→/dev/ttyUSB0,COM6→COM5).
python3 vitals_uart_viewer.py --data-port /dev/ttyUSB1 --plotpython3 vitals_uart_viewer.py --data-port /dev/ttyUSB1 --data-baud 921600
python3 vitals_uart_viewer.py --cli-port /dev/ttyUSB0 --cli-baud 115200 --cfg profile.cfg --data-port /dev/ttyUSB1--data-port (obligatoire) Port série DATA (trames TLV binaires)
--data-baud Baudrate DATA (défaut: 921600)
--cli-port (optionnel) Port série CLI (envoi de configuration)
--cli-baud Baudrate CLI (défaut: 115200)
--cfg (optionnel) Chemin vers le .cfg à envoyer sur le CLI
--quiet-cli Ne pas afficher les réponses CLI pendant l’envoi
--plot Affiche les waveforms coeur/respiration (matplotlib)
--dashboard-hz Taux de rafraîchissement console (défaut: 10 Hz)
--max-buffer-bytes Taille max du buffer RX (défaut: 2097152)
DISCONNECTED: vérifier le bon port (/dev/ttyUSB*,/dev/ttyACM*,COM*) et les droits.- Sur Linux, ajouter l’utilisateur au groupe
dialoutpuis se reconnecter.
- Sur Linux, ajouter l’utilisateur au groupe
SYNCINGqui ne passe jamais enSTREAMING:- vérifier que le radar est démarré (
sensorStart) et que le bon port est utilisé pour DATA (souvent le plus “haut”, ex:ttyUSB1). - vérifier le
--data-baud(souvent921600).
- vérifier que le radar est démarré (
FRAME_ERRORqui augmente vite :- mauvais port/baudrate, ou câble/USB instable.
- attention à ne pas ouvrir le même port avec plusieurs programmes en parallèle.
- Resynchronisation par scan du magic word :
02 01 04 03 06 05 08 07 - Header :
'<Q8I'(40 bytes) - TLV header :
'<II'(8 bytes) - Vital Signs TLV :
tlvType=0x410, payload'<2H33f'(136 bytes) <<<<<<< HEAD See.env.examplefor a complete configuration template.
When ElevenLabs (agent) confirms an emergency (event distress_voice) or when a resident does not respond (event no_response), the backend can place an outbound phone call to the nurse using Twilio.
Required env vars:
TWILIO_ACCOUNT_SID- Auth (choose one):
TWILIO_AUTH_TOKENTWILIO_API_KEY_SID+TWILIO_API_KEY_SECRET
TWILIO_FROM_NUMBER(E.164, e.g.+15551234567)NURSIE_NURSE_PHONE_E164(one or more E.164 numbers, comma-separated)NURSIE_PUBLIC_BASE_URL(publicly reachable base URL so Twilio can fetch TwiML)
TwiML endpoint:
GET/POST /twilio/twiml?alert_id=...&resident_id=...
Note: Twilio must be able to reach NURSIE_PUBLIC_BASE_URL (use a tunnel like ngrok for local dev).
On fall_detected, the backend can optionally POST to a fast webhook to start the verbal check in ElevenLabs (Webflow/Make/Zapier/serverless).
Env vars:
NURSIE_VERBAL_CHECK_WEBHOOK_URL(your webhook endpoint)NURSIE_VERBAL_CHECK_WEBHOOK_TOKEN(optional Bearer token)NURSIE_PUBLIC_BASE_URL(used to buildcallback_urlfor/webhooks/elevenlabs) ======= The backend for Nursie AI, built with Flask, MongoDB, and Gemini 1.5 Flash.
-
Environment Variables: Copy
backend/.env.exampletobackend/.envand fill in your keys:cp backend/.env.example backend/.env
-
Install Dependencies:
cd backend pip install -r requirements.txt -
Run Locally:
python backend/app.py
POST /events: Push sensor events.GET /alerts: List active triage alerts.GET /alerts/stream: SSE stream for real-time alerts.POST /webhooks/agent-transcript: Webhook for frontend/device transcripts.POST /webhooks/elevenlabs: Webhook for ElevenLabs conversational AI.GET /voice/next: Fetch and generate the next voice message in queue.
- Framework: Flask
- Database: MongoDB
- AI: Google Gemini (Triage), ElevenLabs (TTS)
- Real-time: Server-Sent Events (SSE)
572d3e95f6e0caa1a7e3b3d6d358f5292f998e35