MCPcopy Create free account
hub / github.com/ecto/muni / decodeCameraInfo

Function decodeCameraInfo

depot/console/src/lib/protocol.ts:448–475  ·  view source on GitHub ↗
(data: ArrayBuffer)

Source from the content-addressed store, hash-verified

446 * [fov_h:f32] [fov_v:f32]
447 */
448export 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)

Callers 1

useRoverConnectionRtcFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected