Steam Controller 自动充电 – 通过计算机视觉实现磁吸充电座自动对位
Steam Controller Auto-Charge – pilot to magnetic charging puck using CV

原始链接: https://github.com/FossPrime/Steam-Controller-Auto-Charge

Steam Controller Auto-Charge 是一款开源 Web 应用程序,可自动将 Steam 控制器导航至其磁吸充电底座上。该系统利用头顶摄像头,结合用于 Lucas-Kanade 光流跟踪的 OpenCV.js 以及基于浏览器内 Rust/WASM 的 CNN(卷积神经网络)进行目标检测。 该应用通过 WebHID API 与控制器通信,利用其内部的线性谐振执行器(LRA)产生 70Hz 的触觉脉冲,从而将设备“震动”至底座。为确保平稳的对接过程,系统采用了“近距离缓行”模式,当控制器处于目标 150 像素范围内时,会降低触觉强度。此外,该应用还会拦截特定的控制器报告,以实时监控电池状态和电压。 该项目使用 Vue 3 构建,具有跨平台特性,仅需 Nix 包管理器和基于 Chromium 的浏览器即可运行。它提供了一种无缝的自动化体验,并可在需要时进行手动跟踪覆盖。本项目灵感源自 Very Lazy Pixel,为家庭自动化领域中计算机视觉和硬件遥测技术的应用提供了一个复杂的实现方案。

Hacker News 最新 | 往日 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Steam Controller 自动充电 – 使用计算机视觉(CV)将原型机改装为磁吸充电底座 (github.com/fossprime) 15 分分,由 zdw 发布于 49 分钟前 | 隐藏 | 往日 | 收藏 | 讨论 | 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Steam Controller Auto-Charge is an open-source web application designed to automatically pilot a Steam Controller into its magnetic charging puck using optical flow computer vision and WebHID telemetry.

  • Optical Flow Tracking: Utilizes OpenCV.js to track user-selected points on the controller and the charging puck via an overhead camera.
  • WebHID Telemetry & Haptic Navigation: Connects to the Triton Controller natively via WebHID, streaming input and telemetry (Report 67). Navigates the controller towards the puck by firing 70Hz asymmetric haptic pulses through the internal dual Linear Resonant Actuators (LRAs).
  • Proximity Creep Mode: Automatically cuts haptic pulse frequency by 50% when the controller is within 150 pixels of the puck to ensure a gentle magnetic dock.
  • Battery Status Polling: Intercepts Report ID 121 (0x79) to confirm successful magnetic charging, and parses Report ID 67 (0x43) to display live battery percentage and battery cell voltage (mV).
  • Nix Package Manager: The only build dependency you need. It works seamlessly on Windows, Mac, and Linux.
    • A Chromium-based browser supporting the WebHID API.
    • An overhead webcam pointing down at your desk.
  1. Mount a webcam directly overhead pointing at the desk.
  2. Start the project with a single command (this will automatically fetch dependencies and build the WASM module):
nix-shell --run "npm install && npm run dev"
  1. Mount a webcam directly overhead pointing at the desk.
  2. Place the Steam Controller Auto-Charge puck on the desk.
  3. Place your Steam Controller on the desk, upright.
  4. Open the web interface and click Connect Steam Controller to pair it via WebHID.
  5. Click ✨ Auto-Track to engage automatic tracking. The button will highlight to indicate it's active and will automatically resume tracking on page reload. Click it again to disengage.
  6. The controller will now autonomously navigate to the puck using a Lucas-Kanade optical flow loop combined with object avoidance powered by an in-browser Rust/WASM CNN!

(Note: Manual tracking is still available if you prefer. Just click the puck, then the top of the controller, then the bottom of the controller).

  • App.vue: Vue 3 application logic handling camera streams, UI reactivity, PID tracking loop, and OpenCV.js Lucas-Kanade optical flow (calcOpticalFlowPyrLK).
  • steamController.ts: WebHID abstraction class mapping standard API calls to the Steam Controller's specific byte payloads for LRA pulses and battery status polling.
  • objectDetector.ts & objectWorker.ts: Offloads object detection to a Web Worker to ensure the main tracking loop remains fluid.
  • wasm-object-detect/: Rust implementation compiled to WebAssembly for high-performance visual processing.

Huge thanks to Very Lazy Pixel for inspiring this project! Check out their video here: https://www.youtube.com/watch?v=g-8S8zk4dn8

This project is licensed under the MIT License - see the LICENSE file for details.

联系我们 contact @ memedata.com