robopark 2.8.15 → 2.8.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/vision/README.md +5 -2
- package/vision/app_pi_clean.py +21 -2
- package/vision/requirements-demo.txt +12 -0
package/package.json
CHANGED
package/vision/README.md
CHANGED
|
@@ -21,11 +21,14 @@ presence-triggered session (`POST /api/devices/{id}/request-session`),
|
|
|
21
21
|
publishing camera + mic into the resulting LiveKit room. Point RoboVision at
|
|
22
22
|
it:
|
|
23
23
|
|
|
24
|
+
Both of these calls go to RoboVision's own server (port 5000 by default —
|
|
25
|
+
NOT the scheduler on 8080):
|
|
26
|
+
|
|
24
27
|
```
|
|
25
|
-
curl -X POST http://localhost:
|
|
28
|
+
curl -X POST http://localhost:5000/api/motion/webhook \
|
|
26
29
|
-H "Content-Type: application/json" \
|
|
27
30
|
-d '{"url": "http://localhost:5057/"}'
|
|
28
|
-
curl -X POST http://localhost:
|
|
31
|
+
curl -X POST http://localhost:5000/api/motion/toggle \
|
|
29
32
|
-H "Content-Type: application/json" -d '{"active": true}'
|
|
30
33
|
```
|
|
31
34
|
|
package/vision/app_pi_clean.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from flask import Flask, Response, jsonify, request
|
|
2
2
|
from flask_cors import CORS
|
|
3
|
+
import argparse
|
|
3
4
|
import cv2
|
|
5
|
+
import os
|
|
4
6
|
import time
|
|
5
7
|
import numpy as np
|
|
6
8
|
import threading
|
|
@@ -299,9 +301,26 @@ def motion_webhook():
|
|
|
299
301
|
})
|
|
300
302
|
|
|
301
303
|
if __name__ == '__main__':
|
|
304
|
+
parser = argparse.ArgumentParser(description="RoboVision — camera/motion detection server")
|
|
305
|
+
parser.add_argument("--port", type=int, default=int(os.getenv("VISION_PORT", "5000")))
|
|
306
|
+
parser.add_argument("--motion-webhook-url", default=os.getenv("MOTION_WEBHOOK_URL", ""),
|
|
307
|
+
help="where to POST a snapshot when motion is detected, e.g. http://localhost:5057/")
|
|
308
|
+
parser.add_argument("--motion-active", action="store_true",
|
|
309
|
+
default=os.getenv("MOTION_ACTIVE", "").lower() in ("1", "true", "yes"),
|
|
310
|
+
help="arm motion detection immediately on startup (no manual /api/motion/toggle call needed)")
|
|
311
|
+
args = parser.parse_args()
|
|
312
|
+
|
|
313
|
+
if args.motion_webhook_url:
|
|
314
|
+
webhook_url = args.motion_webhook_url
|
|
315
|
+
if args.motion_active:
|
|
316
|
+
motion_detection_active = True
|
|
317
|
+
|
|
302
318
|
print("=" * 60)
|
|
303
319
|
print("RoboVision - Raspberry Pi Vision Server (Minimal)")
|
|
304
320
|
print("=" * 60)
|
|
305
|
-
print("Starting Flask server on http://0.0.0.0:
|
|
321
|
+
print(f"Starting Flask server on http://0.0.0.0:{args.port}")
|
|
322
|
+
if webhook_url:
|
|
323
|
+
print(f"Motion webhook: {webhook_url}")
|
|
324
|
+
print(f"Motion detection: {'ARMED' if motion_detection_active else 'off (POST /api/motion/toggle to arm)'}")
|
|
306
325
|
print("=" * 60)
|
|
307
|
-
app.run(host='0.0.0.0', port=
|
|
326
|
+
app.run(host='0.0.0.0', port=args.port, debug=False, threaded=True)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Non-Pi (Windows/macOS/Linux dev laptop) requirements for app_pi_clean.py.
|
|
2
|
+
#
|
|
3
|
+
# requirements_pi_unified.txt deliberately excludes opencv-python (Pi installs
|
|
4
|
+
# it via `apt install python3-opencv` for the ARM-optimized system build) —
|
|
5
|
+
# that's wrong off a real Pi, where plain `pip install opencv-python` is the
|
|
6
|
+
# normal path. Use this file for a demo/dev machine; use
|
|
7
|
+
# requirements_pi_unified.txt (+ apt) on an actual Raspberry Pi.
|
|
8
|
+
flask==3.0.0
|
|
9
|
+
flask-cors==4.0.0
|
|
10
|
+
opencv-python>=4.8
|
|
11
|
+
numpy>=1.24,<2
|
|
12
|
+
requests>=2.31
|