(data: ArrayBuffer)
| 446 | * [fov_h:f32] [fov_v:f32] |
| 447 | */ |
| 448 | export function decodeCameraInfo(data: ArrayBuffer): DecodedCameraInfo | null { |
| 449 | if (data.byteLength < 38) { |
| 450 | return null; |
| 451 | } |
| 452 | |
| 453 | const view = new DataView(data); |
| 454 | if (view.getUint8(0) !== MSG_CAMERA_INFO) { |
| 455 | return null; |
| 456 | } |
| 457 | |
| 458 | return { |
| 459 | cameraId: view.getUint8(1), |
| 460 | width: view.getUint16(2, true), |
| 461 | height: view.getUint16(4, true), |
| 462 | position: [ |
| 463 | view.getFloat32(6, true), |
| 464 | view.getFloat32(10, true), |
| 465 | view.getFloat32(14, true), |
| 466 | ], |
| 467 | rotation: [ |
| 468 | view.getFloat32(18, true), |
| 469 | view.getFloat32(22, true), |
| 470 | view.getFloat32(26, true), |
| 471 | ], |
| 472 | fovH: view.getFloat32(30, true), |
| 473 | fovV: view.getFloat32(34, true), |
| 474 | }; |
| 475 | } |
| 476 | |
| 477 | // ============================================================================ |
| 478 | // Point Cloud Protocol (Rover -> Operator) |
no outgoing calls
no test coverage detected