(self, timeout_ms: int)
| 203 | ) |
| 204 | |
| 205 | def wait_frame(self, timeout_ms: int) -> RgbdFrame | None: |
| 206 | if self._pipeline is None or self._align_filter is None: |
| 207 | raise RuntimeError("Orbbec camera has not been started") |
| 208 | |
| 209 | frames = self._pipeline.wait_for_frames(int(timeout_ms)) |
| 210 | if frames is None: |
| 211 | return None |
| 212 | frames = self._align_filter.process(frames) |
| 213 | if frames is None: |
| 214 | return None |
| 215 | |
| 216 | color_frame = frames.get_color_frame() |
| 217 | depth_frame = frames.get_depth_frame() |
| 218 | if color_frame is None or depth_frame is None: |
| 219 | return None |
| 220 | |
| 221 | color_bgr = frame_to_bgr(color_frame) |
| 222 | depth_units = np.frombuffer(depth_frame.get_data(), dtype=np.uint16).reshape( |
| 223 | int(depth_frame.get_height()), int(depth_frame.get_width()) |
| 224 | ) |
| 225 | depth_scale_m = float(depth_frame.get_depth_scale()) * ORBBEC_DEPTH_SCALE_TO_METERS |
| 226 | depth_m = depth_units.astype(np.float32) * depth_scale_m |
| 227 | return RgbdFrame(color_bgr=color_bgr, depth_m=depth_m) |
| 228 | |
| 229 | def stop(self) -> None: |
| 230 | if self._pipeline is not None: |
nothing calls this directly
no test coverage detected