robopark 2.8.18 → 2.8.21

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robopark",
3
- "version": "2.8.18",
3
+ "version": "2.8.21",
4
4
  "description": "RoboPark fleet control CLI — set up, watch, and drive a fleet of talking robots. The operator front-end over the infinicode mesh.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -3,6 +3,7 @@ from flask_cors import CORS
3
3
  import argparse
4
4
  import cv2
5
5
  import os
6
+ import sys
6
7
  import time
7
8
  import numpy as np
8
9
  import threading
@@ -16,10 +17,22 @@ CORS(app)
16
17
  current_camera_index = 0
17
18
  camera = None
18
19
 
20
+ def _open_camera(index):
21
+ # On Windows, cv2.VideoCapture(index) with no explicit backend can
22
+ # auto-probe into an unrelated backend (e.g. Orbbec's "obsensor") that
23
+ # fails with "Camera index out of range" for a perfectly normal UVC
24
+ # webcam — isOpened() then stays False forever and callers retry in an
25
+ # infinite doomed loop. Force DirectShow, the backend that actually
26
+ # enumerates standard Windows webcams.
27
+ if sys.platform == 'win32':
28
+ return cv2.VideoCapture(index, cv2.CAP_DSHOW)
29
+ return cv2.VideoCapture(index)
30
+
31
+
19
32
  def get_camera():
20
33
  global camera, current_camera_index
21
34
  if camera is None or not camera.isOpened():
22
- camera = cv2.VideoCapture(current_camera_index)
35
+ camera = _open_camera(current_camera_index)
23
36
  camera.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
24
37
  camera.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
25
38
  print(f"Camera {current_camera_index} initialized")
@@ -223,7 +236,7 @@ def caption_mode():
223
236
  def list_cameras():
224
237
  available = []
225
238
  for i in range(4):
226
- cap = cv2.VideoCapture(i)
239
+ cap = _open_camera(i)
227
240
  if cap.isOpened():
228
241
  available.append({"index": i, "name": f"Camera {i}"})
229
242
  cap.release()
@@ -5,8 +5,12 @@
5
5
  # that's wrong off a real Pi, where plain `pip install opencv-python` is the
6
6
  # normal path. Use this file for a demo/dev machine; use
7
7
  # requirements_pi_unified.txt (+ apt) on an actual Raspberry Pi.
8
+ # numpy is intentionally unpinned on the upper end — modern opencv-python
9
+ # wheels are built against numpy 2.x, and pinning <2 forces pip to source-
10
+ # build an old numpy with no prebuilt wheel for current Python versions
11
+ # (needs a C/C++ compiler most demo machines don't have installed).
8
12
  flask==3.0.0
9
13
  flask-cors==4.0.0
10
14
  opencv-python>=4.8
11
- numpy>=1.24,<2
15
+ numpy>=1.24
12
16
  requests>=2.31