find hobbies irl
and frens
frens r inportant
specialy if they revolve around le hobbies
/init
# CLAUDE.md
## Project Overview
Folding-fin stabilized model rocket system with three components that communicate over UDP (port 4444) via WiFi:
1. **Rocket ESP32** (`Firmware/ROLLstabilization.txt`) — Onboard flight computer. Uses MPU6050 gyro for roll-axis stabilization via a PD controller driving 4 servo-actuated fins. Creates its own WiFi AP ("RocketLink_Telemetry"). PID gains and gyro calibration are persisted to ESP32 NVS flash. State machine: IDLE → LAUNCHING (waits for 1.6g accel threshold for 50ms) → FLIGHT (fins active).
2. **Launcher ESP32** (`Firmware/launcher.txt`) — Ground-side relay and sensor hub. Creates WiFi AP ("ROCKET_LAUNCHER"). Communicates with the rocket over Serial2 (115200 baud, pins 16/17) and with the dashboard over UDP. Manages arming sequence (physical switch button with 1s hold), GPS (TinyGPS on Serial1, pin 4), BMP180 barometer (EMA-filtered altitude), and QMC5883L compass for heading fusion. State machine: SAFE → ARMING → READY → IGNITING. Halts on boot if no GPS NMEA data within 5s.
3. **Dashboard** (`Firmware/DASHBOARDpython.txt`) — Python tkinter ground control station. Receives telemetry via UDP, displays real-time roll/rate/servo graphs (matplotlib FuncAnimation), GPS status (3-state indicator), live PID values, and environment data. Supports remote gyro calibration, PID upload, digital launch command, and full-flight graph export.
## Communication Protocol
All messages are UTF-8 over UDP port 4444:
- **Telemetry (Launcher→Dashboard):** `T,<millis>,<roll>,<rate>,<servo_output>`
- **Status (Launcher→Dashboard):** `STATUS:<state>,<Kp>,<Kd>,<skew>`
- **Environment (Launcher→Dashboard):** `ENV,<lat>,<lon>,<alt>,<gpsState>` (gpsState: 0=no NMEA, 1=searching, 2=fix)
- **Fusion (Launcher→Dashboard):** `[FUSION] Hdg: <heading> | Pitch: <pitch>` (currently ignored by dashboard)
- **Commands (Dashboard→Launcher):** `launch`, `calibrate`, `PID,<Kp>,<Kd>`, `HELLO` (keepalive)
- **Rocket serial (Launcher↔Rocket):** `DATA,<ax>,<ay>,<az>,<roll>,<rate>,<out>,<state>,<kp>,<kd>,<skew>`, `ARM`, `CALIBRATE`, `IGNITE`, `READY`, `IGNITED`, `ALIVE`
## Hardware Pin Mapping
**Rocket ESP32:** Servos — UP=27, DOWN=14, RIGHT=26, LEFT=25. MPU6050 on I2C (21/22).
**Launcher ESP32:** Serial2 RX/TX=16/17, GPS RX=4, Switch=5, Button=18, LED=23, Buzzer=2 (active LOW), Launch servo=19 (ON=170°, OFF=55°), I2C SDA/SCL=21/22.
## Calibration & Test Utilities
- `Firmware/Calibration & Test Code/Fin Calibration.txt` — Interactive serial tool to find servo center angles (A/B/C/D to select, /- to adjust)
- `Firmware/Calibration & Test Code/I2Cworks.txt` — I2C bus scanner BMP180/QMC5883L health check
- `Firmware/Calibration & Test Code/ROLLstabilization.txt` — Standalone roll stabilization (earlier version, creates its own AP, no launcher relay)
## Development Notes
- All firmware files use `.txt` extension but contain Arduino/ESP32 C code (PlatformIO or Arduino IDE)
- Dashboard requires: `tkinter`, `matplotlib`, `numpy`, `socket` (stdlib)
- Run dashboard: `python DASHBOARDpython.txt` (or rename to `.py`)
- Magnetometer calibration offsets are hardcoded in `launcher.txt` (MAG_OFFSET_X/Y/Z, MAG_SCALE_X/Y/Z)
- Servo center angles are hardcoded in `ROLLstabilization.txt` (LEFT=115, RIGHT=80, UP=80, DOWN=115) with MAX_DEFLECTION=15°
- The launcher WiFi AP IP is 192.168.4.1 (ESP32 SoftAP default), hardcoded in dashboard as `LAUNCHER_GATEWAY`
## Other Files
- `CAD Files/` — Fusion 360 designs (.f3z) for the folding rocket, launcher platform, and rocket nozzle
- `Simulation/` — OpenRocket simulation file (.ork) and stability analysis screenshots