feat: UWB tag firmware (Issue #545) #568
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "sl-perception/issue-546-uwb-ros2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
esp32/uwb_tag/uwb_tag.ino: SS-TWR initiator firmware for Makerfabs ESP32 UWB Pro (DW3000)esp32/uwb_tag/config.h: user-editable config — anchor addresses, PAN ID, tag address, poll rate, pins, antenna delaysProtocol: Single-Sided TWR with tag as initiator
T_spon TX done)T_rpandT_srin payloadT_rr), computesToF = (Round − Reply) / 2, outputs JSONSerial output (115200 8N1) — one JSON line per event:
Key features:
anchor_lostevent after 2 s of silenceDeps:
Makerfabs-ESP32-UWB(dw3000.h),ArduinoJson≥ v6Test plan
{"event":"ready",...}anchor_lostevent firesrange_magainst tape measure at known 1 m / 3 m / 5 m distances🤖 Generated with Claude Code
Add saltybot_uwb_position — ROS2 Python package that reads JSON range measurements from an ESP32 DW3000 UWB tag over USB serial, trilaterates the robot's absolute position from 3+ fixed infrastructure anchors, and publishes position + TF2 to the rest of the stack. Serial protocol (one JSON line per frame): Full frame: {"ts":…, "ranges": [{"id":0,"d_mm":1500,"rssi":-65}, …]} Per-anchor: {"id":0, "d_mm":1500, "rssi":-65.0} Accepts both "d_mm" and "range_mm" field names. Trilateration (trilateration.py, numpy, no ROS deps): Linear least-squares: linearise sphere equations around anchor 0, solve (N-1)x2 (2D) or (N-1)x3 (3D) system via np.linalg.lstsq. 2D mode (default): robot_z fixed, needs >=3 anchors. 3D mode (solve_z=true): full 3D, needs >=4 anchors. Outlier rejection: After initial solve, compute per-anchor residual |r_meas - r_pred|. Reject anchors with residual > outlier_threshold_m (0.4 m default). Re-solve with inliers if >= min_anchors remain. Track consecutive outlier strikes; flag in /status after N strikes. Kalman filter (KalmanFilter3D, constant-velocity, 6-state, numpy): Predict-only coasting when anchors drop below minimum. Q=0.05, R=0.10 (tunable). Topics: /saltybot/uwb/pose PoseStamped 10 Hz Kalman-filtered position /saltybot/uwb/range/<id> UwbRange on arrival, raw per-anchor ranges /saltybot/uwb/status String/JSON 10 Hz state+residuals+flags TF2: uwb_link -> map (identity rotation) Anchor config: flat float arrays in YAML. Default layout: 4-anchor 5x5m room at 2m height. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>