@foxglove/velodyne-cloud
Version:
TypeScript library for converting Velodyne LIDAR packet data to point clouds
30 lines • 1.08 kB
JavaScript
"use strict";
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/
Object.defineProperty(exports, "__esModule", { value: true });
exports.RawBlock = void 0;
const VelodyneTypes_1 = require("./VelodyneTypes");
class RawBlock {
constructor(data) {
this.data = data;
this.view = new DataView(data.buffer, data.byteOffset, data.byteLength);
this.blockId = this.view.getUint16(0, true);
this.rotation = this.view.getUint16(2, true);
}
isUpperBlock() {
return this.blockId === VelodyneTypes_1.BlockId.Block_32_To_63;
}
isValid(index) {
const offset = 4 + 3 * index;
return this.data[offset] !== 0 || this.data[offset + 1] !== 0;
}
distance(index) {
return this.view.getUint16(4 + 3 * index, true);
}
intensity(index) {
return this.data[4 + 3 * index + 2];
}
}
exports.RawBlock = RawBlock;
//# sourceMappingURL=RawBlock.js.map