open-index/open-npm huggingface dataset:
npm package: @lichtblick/rosmsg-msgs-common
Description: Common ROS message definitions using @lichtblick/rosmsg
Author: Lichtblick
Latest version: 1.0.1

# rosmsg-msgs-common

[![npm version](https://img.shields.io/npm/v/@lichtblick/rosmsg-msgs-common.svg?style=flat)](https://www.npmjs.com/package/@lichtblick/rosmsg-msgs-common)

This library exports a map of ROS 1 and ROS 2 datatype string keys to [@lichtblick/message-definition](https://github.com/lichtblick/message-definition) `MessageDefinition` values for most common ROS 1 and ROS 2 message definitions. The ROS 1 message definitions were extracted from the `ros:noetic-robot-focal` Docker container using the `gendeps --cat` command. ROS 2 message definitions were extracted from [rcl_interfaces](https://github.com/ros2/rcl_interfaces), [common_interfaces](https://github.com/ros2/common_interfaces), and [unique_identifier_msgs](https://github.com/ros2/unique_identifier_msgs) repository branches using the [gendeps2](https://github.com/lichtblick/rosmsg/blob/main/src/gendeps2.ts) utility.

## License

@lichtblick/rosmsg-msgs-common is licensed under the [MIT License](https://opensource.org/licenses/MIT).

## Releasing

1. Run `yarn version --[major|minor|patch]` to bump version
2. Run `git push && git push --tags` to push new tag
3. GitHub Actions will take care of the rest
npm package: @lichtblick/rosmsg-serialization
Description: ROS1 (Robot Operating System) message serialization, for reading and writing bags and network messages
Author: Lichtblick
Latest version: 1.0.0

# @lichtblick/rosmsg-serialization

> _ROS1 (Robot Operating System) message serialization, for reading and writing bags and network messages_

[![npm version](https://img.shields.io/npm/v/@lichtblick/rosmsg-serialization.svg?style=flat)](https://www.npmjs.com/package/@lichtblick/rosmsg-serialization)

## MessageReader

Message reader deserializes ROS messages into plain objects. The messages are fully deserialized.

```typescript
import { MessageReader } from "@lichtblick/rosmsg-serialization";

// message definition comes from `parse()` in @lichtblick/rosmsg
const reader = new MessageReader(messageDefinition);

// deserialize a buffer into an object
const message = reader.readMessage([0x00, 0x00, ...]);

// access message fields
message.header.stamp;
```

## LazyMessage

Lazy messages provide on-demand access and deserialization to fields of a serialized ROS message. Creating
a lazy message from a buffer performs no de-serialization during creation. Only accessed fields are
deserialized; the deserialization occurs at access time.

```Typescript
import { LazyMessageReader } from "@lichtblick/rosmsg-serialization";

// message definition comes from `parse()` in @lichtblick/rosmsg
const reader = new LazyMessageReader(messageDefinition);

// build a new lazy message instance for our serialized message from the Uint8Array
// Note: since deserialization is lazy - avoid-reusing the array you provide for other messages
const message = reader.readMessage([0x00, 0x00, ...]);

// access message fields
message.header.stamp;
```

## MessageWriter

Convert an object, array, or primitive value into binary data using ROS message serialization.

```Typescript
import { MessageWriter } from "@lichtblick/rosmsg-serialization";

// message definition comes from `parse()` in @lichtblick/rosmsg
const writer = new MessageWriter(pointStampedMessageDefinition);

// serialize the passed in object to a Uint8Array as a geometry_msgs/PointStamped message
const uint8Array = writer.writeMessage({
  header: {
    seq: 0,
    stamp: { sec: 0, nsec: 0 },
    frame_id: ""
  },
  x: 1,
  y: 0,
  z: 0
});
```

### Test

`yarn test`

## License

@lichtblick/rosmsg-serialization is licensed under the [MIT License](https://opensource.org/licenses/MIT).

## Releasing

1. Run `yarn version --[major|minor|patch]` to bump version
2. Run `git push && git push --tags` to push new tag
3. GitHub Actions will take care of the rest

## Benchmarks

The `bench` folder contains benchmarks. Run with:

```plain
yarn bench
yarn bench:benny
```

To run benchmarks in web:

```plain
yarn bench:web
```
npm package: @lichtblick/rosmsg2-serialization
Description: ROS 2 (Robot Operating System) message serialization, for reading and writing bags and network messages
Author: Lichtblick
Latest version: 1.0.0

# @lichtblick/rosmsg2-serialization

> _ROS 2 (Robot Operating System) message serialization, for reading and writing bags and network messages_

[![npm version](https://img.shields.io/npm/v/@lichtblick/rosmsg2-serialization.svg?style=flat)](https://www.npmjs.com/package/@lichtblick/rosmsg2-serialization)

## MessageReader

Message reader deserializes ROS 2 CDR messages into plain objects. The messages are fully deserialized.

```typescript
import { MessageReader } from "@lichtblick/rosmsg2-serialization";

// message definition comes from `parse()` in @lichtblick/rosmsg
const reader = new MessageReader(messageDefinition);

// deserialize a buffer into an object
const message = reader.readMessage([0x00, 0x01, ...]);

// access message fields
message.header.stamp;
```

## MessageWriter

Convert an object, array, or primitive value into binary data using ROS 2 CDR message serialization.

```Typescript
import { MessageWriter } from "@lichtblick/rosmsg2-serialization";

// message definition comes from `parse()` in @lichtblick/rosmsg
const writer = new MessageWriter(pointStampedMessageDefinition);

// serialize the passed in object to a Uint8Array as a geometry_msgs/PointStamped message
const uint8Array = writer.writeMessage({
  header: {
    stamp: { sec: 0, nanosec: 0 },
    frame_id: ""
  },
  x: 1,
  y: 0,
  z: 0
});
```

### Test

`yarn test`

## License

@lichtblick/rosmsg2-serialization is licensed under the [MIT License](https://opensource.org/licenses/MIT).

## Releasing

1. Run `yarn version --[major|minor|patch]` to bump version
2. Run `git push && git push --tags` to push new tag
3. GitHub Actions will take care of the rest
npm package: @lichtblick/rostime
Description: ROS (Robot Operating System) Time and Duration primitives and helper methods
Author: Lichtblick
Latest version: 1.0.0

# @lichtblick/rostime

> _ROS (Robot Operating System) Time and Duration primitives and helper methods_

[![npm version](https://img.shields.io/npm/v/@lichtblick/rostime.svg?style=flat)](https://www.npmjs.com/package/@lichtblick/rostime)

## Introduction

[ROS](https://www.ros.org/) (Robot Operating System) defines two primitive types for dealing with time, `ros::Time` and `ros::Duration` (see http://wiki.ros.org/roscpp/Overview/Time). These are both represented by the same data type, `{ sec: number; nsec: number }` and serialized as a pair of 32-bit integers (seconds, then nanoseconds). This package provides a TypeScript type definition for these types and helper methods for working with ROS time and duration values.

## Usage

```Typescript
import * as rostime from "@lichtblick/rostime";

const a = { sec: 1, nsec: 0 };
const b = rostime.fixTime({ sec: 0, nsec: 1e9 });
console.log(`${rostime.toString(a)} == ${rostime.toString(b)} (${rostime.areEqual(a, b)})`);
```

## License

@lichtblick/rostime is licensed under the [MIT License](https://opensource.org/licenses/MIT).

## Releasing

1. Run `yarn version --[major|minor|patch]` to bump version
2. Run `git push && git push --tags` to push new tag
3. GitHub Actions will take care of the rest
npm package: @lichtblick/three-text
Description: Render text in 3D using Signed Distance Fields
Author: Lichtblick
Latest version: 1.0.0

# @lichtblick/three-text

Render text in 3D using Signed Distance Fields

[![npm version](https://img.shields.io/npm/v/@lichtblick/three-text.svg)](https://www.npmjs.com/package/@lichtblick/three-text)

![demo of three-text](https://user-images.githubusercontent.com/14237/185552879-3301a9d0-d749-4b48-8fcd-ddfd8d0871f3.gif)

## Usage examples

View live example [in Storybook](https://main--62ff21ad11a55228f80a9365.chromatic.com/?path=/story/labelpool--basic). View example usage at [LabelPool.stories.tsx](./src/LabelPool.stories.tsx).

To run Storybook locally, run `yarn storybook`.
npm package: @lichtblick/tsconfig
Description: Base TypeScript configuration for Lichtblick projects
Author: Lichtblick
Latest version: 1.0.2

# @lichtblick/tsconfig

[![npm version](https://img.shields.io/npm/v/@lichtblick/tsconfig.svg?style=flat)](https://www.npmjs.com/package/@lichtblick/tsconfig)

Base tsconfig for lichtblick projects.

To use, run `npm i --save-dev @lichtblick/tsconfig`, then extend your `tsconfig.json` like so:

```json
{
  "extends": "@lichtblick/tsconfig/base",
  "include": ["./src/**/*"],
  "compilerOptions": {
    "rootDir": "./src",
    "outDir": "./dist"
  }
}
```

## License

[MIT License](/LICENSE.md)

## Releasing

```sh
tag=$(npm version minor) && echo "$tag"
git push && git push origin "$tag"
```
npm package: @lichtblick/ulog
Description: PX4 ULog file reader
Author: Lichtblick
Latest version: 1.0.0

# @lichtblick/ulog

> _PX4 ULog file reader_

A web and node.js TypeScript library for reading [PX4 ULog](https://docs.px4.io/master/en/dev_log/ulog_file_format.html) files, from the PX4 Autopilot system for drones and other autonomous vehicles.

## Usage

```typescript
import { MessageType, ULog } from "@lichtblick/ulog";
import { FileReader } from "@lichtblick/ulog/node";

async function main() {
  const ulog = new ULog(new FileReader("../path/to/file.ulg"));
  await ulog.open(); // required before any other operations
  console.log(ulog.messageCount()); // ex: 64599
  console.log(ulog.timeRange()); // ex: [ 0n, 181493506n ]

  // build a map of subscription ids to message counts
  // NOTE: readMessages() iterates over DATA section messages in timestamp order
  const msgIdCounts = new Map<number, number>();
  for await (const msg of ulog.readMessages()) {
    if (msg.type === MessageType.Data) {
      // NOTE: `msg.value` holds the deserialized message
      msgIdCounts.set(msg.msgId, (msgIdCounts.get(msg.msgId) ?? 0) + 1);
    }
  }

  // convert the subscription ids to message names
  const msgCounts = Array.from(msgIdCounts.entries()).map(([id, count]) => [
    ulog.subscriptions.get(id)?.name ?? `unknown msg_id ${id}`,
    count,
  ]);
  console.log(msgCounts);
  // ex: [ [ 'vehicle_attitude', 6461 ], [ 'actuator_outputs', 1311 ], ... ]
}

void main();
```

## License

@lichtblick/ulog is licensed under the [MIT License](https://opensource.org/licenses/MIT).

## Releasing

1. Run `yarn version --[major|minor|patch]` to bump version
2. Run `git push && git push --tags` to push new tag
3. GitHub Actions will take care of the rest
npm package: @lichtblick/velodyne-cloud
Description: TypeScript library for converting Velodyne LIDAR packet data to point clouds
Author: Lichtblick
Latest version: 1.0.0

# @lichtblick/velodyne-cloud

> _TypeScript library for converting Velodyne LIDAR packet data to point clouds_

[![npm version](https://img.shields.io/npm/v/@lichtblick/velodyne-cloud.svg?style=flat)](https://www.npmjs.com/package/@lichtblick/velodyne-cloud)

## Introduction

[Velodyne](https://velodynelidar.com/) LIDAR hardware broadcasts a steady stream of UDP packets representing laser scan data. These raw packets need to be converted to point clouds using calibration data specific to each hardware model. This TypeScript library provides best-effort detection of Velodyne hardware model from analyzing packets and includes calibration data to automatically convert raw data into a 3D point cloud representation.

This library is used by [lichtblick](https://github.com/lichtblick-suite) to convert [velodyne_msgs/VelodyneScan](http://docs.ros.org/en/indigo/api/velodyne_msgs/html/msg/VelodyneScan.html) ROS messages to [sensor_msgs/PointCloud2](http://docs.ros.org/en/melodic/api/sensor_msgs/html/msg/PointCloud2.html) messages.

## Usage

```Typescript
import {
  Calibration,
  PointCloud,
  PointFieldDataType,
  RawPacket,
  Transformer
} from "@lichtblick/velodyne-cloud";

type VelodynePacket = {
  stamp: { sec: number, nsec: number };
  data: Uint8Array;
};

// NOTE: Use the packetRate() function to determine how many packets are needed
// to create a full 360 degree scan

function createPointCloud(packets: VelodynePacket[]) {
  if (packets.length === 0) return undefined;

  const firstPacket = new RawPacket(packets[0].data);
  const model = firstPacket.inferModel();
  if (model == undefined) return undefined;

  const stamp = firstPacket.timestamp();
  const maxPoints = RawPacket.MAX_POINTS_PER_PACKET * packets.length;
  const cloud = new PointCloud({ stamp, maxPoints });
  const transformer = new Transformer(new Calibration(model));

  for (const packet of packets) {
    transformer.unpack(new RawPacket(packet.data), stamp, undefined, cloud);
  }

  cloud.trim();

  console.log(
    `Created ${cloud.width}x${cloud.height} dense little endian point cloud data. ` +
    `${cloud.data.byteLength} bytes total with ${cloud.point_step} byte point step, ` +
    `${cloud.row_step} byte row step, and the following fields:`
  );
  for (const field of cloud.fields) {
    console.log(
      `  [${field.name}] offset=${field.offset}, ` +
      `datatype=${PointFieldDataType[field.datatype]}, ` +
      `count=${field.count}`
    );
  }
}
```

## License

@lichtblick/velodyne-cloud is licensed under the [MIT License](https://opensource.org/licenses/MIT).

## Releasing

1. Run `yarn version --[major|minor|patch]` to bump version
2. Run `git push && git push --tags` to push new tag
3. GitHub Actions will take care of the rest
npm package: @lichtblick/wasm-bz2
Description: Bzip2 decompression compiled to WebAssembly
Author: Lichtblick
Latest version: 1.0.0

# @lichtblick/wasm-bz2

[![npm version](https://img.shields.io/npm/v/@lichtblick/wasm-bz2)](https://www.npmjs.com/package/@lichtblick/wasm-bz2)

Bzip2 decompression compiled to WebAssembly

## Introduction

This package provides a WebAssembly build of https://gitlab.com/bzip2/bzip2, the official Bzip2 library. Currently only a decompression function is provided.

## Usage

```ts
import Bzip2 from "@lichtblick/wasm-bz2";

const bzip2 = await Bzip2.init();

try {
  const buffer = new Uint8Array([...]);
  const maxSize = 100;
  const decompressedBuffer = Bzip2.decompress(buffer, maxSize, { small: false });
} catch (error) {
  console.error(error);
}
```
npm package: @lichtblick/wasm-lz4
Description: https://github.com/lz4/lz4 compiled to WebAssembly. For now only decompression is supported. PRs welcome!
Latest version: 1.0.0

# @lichtblick/wasm-lz4

https://github.com/lz4/lz4 compiled to WebAssembly. For now only decompression is supported. PRs welcome!

## API

`wasm-lz4` exports a single function:

```js
export default (buffer: Buffer, destinationByteSize: number) => Buffer;
```

Here is an example of using the module:

```js
import fs from "fs";
import decompress from "wasm-lz4";

const compressedBytes = fs.readFileSync("compressed.lz4");

// currently you need to know the exact expected size of the output buffer
// so the wasm runtime can allocate enough bytes to decompress into
// TODO: this should not be necessary...it's exposed in the lz4 C code
const outputBytes = compressedBytes * 10;
const decompressedBytes = decompress(compressedBytes, outputBytes);
```

## Using the module in a browser

Emscripten compiled WebAssembly modules are built in 2 parts: a `.js` side and a `.wasm` side. In the browser the `.js` side needs to download the `.wasm` side from the server so it can compile it. There is [more information available in the emscripten documentation](https://kripken.github.io/emscripten-site/docs/compiling/Deploying-Pages.html).

### Usage with Webpack

We require the `wasm-lz4.wasm` module in our `locateFile` definition, so that module bundling with dynamic paths is possible. So if you are using Webpack, you can add the following entry:

```
...
rules : [
  ...
  {
    test: /\.wasm$/,
    type: "javascript/auto",
    use: {
      loader: "file-loader",
      options: {
        name: "[name]-[hash].[ext]",
      },
    },
  },
  ...
]
...
```

The `javascript/auto` type setting tells Webpack to bypass its default importing logic, and just import the file as-is. Hopefully this hack will go away with improved WebAssembly support in webpack.

## Asynchronous loading & compiling

After the `.wasm` binary is loaded (via `fetch` in the browser or `require` in node) it must be compiled by the WebAssembly runtime. If you call `decompress` before it is finished compiling it will throw an error indicating it isn't ready yet. To wait for the module to be loaded you can do something like the following:

```
import decompress from 'wasm-lz4'

async function doWork() {
  await decompress.isLoaded;
  decompress(buffer, outputByteLength);
}
```

## Developing locally

1. Run `npm install` to install dependencies.
2. Run `npm run build` to invoke emcc inside a Docker container and compile the code in `wasm-lz4.c` as well as the required lz4 source files. The output will be in `dist/` on the host machine.
3. Run `npm test` to run the tests.

## License

@lichtblick/wasm-lz4 is licensed under [MIT License](https://opensource.org/licenses/MIT).

## Releasing

1. Run `yarn version --[major|minor|patch]` to bump version
2. Run `git push && git push --tags` to push new tag
3. GitHub Actions will take care of the rest
npm package: @lichtblick/wasm-zstd
Description: https://github.com/facebook/zstd compiled to WebAssembly and exposed as a high-level TypeScript/JavaScript API . PRs welcome!
Latest version: 1.0.0

# @lichtblick/wasm-zstd

https://github.com/facebook/zstd compiled to WebAssembly and exposed as a high-level TypeScript/JavaScript API . PRs welcome!

## API

`@lichtblick/wasm-zstd` exports:

```typescript
export const isLoaded: Promise<boolean>;
export function compressBound(size: number): number;
export function compress(buffer: Uint8Array, compressionLevel?: number): Buffer;
export function decompress(buffer: Uint8Array, size: number): Buffer;
```

Here is an example of compressing then decompressing with this library:

```js
import fs from "fs/promises";
import zstd from "@lichtblick/wasm-zstd";

async function main() {
  const inputData = await fs.readFile("input.txt");

  // Wait for the wasm module to load
  await zstd.isLoaded;

  // Compress and save to a file with zstd compression level 3
  const compressedBytes = zstd.compress(inputData, 3);
  await fs.writeFile("compressed.zst", compressedBytes);

  // Currently you need to know the size of the output buffer so the wasm runtime
  // can allocate enough bytes to decompress into
  const outputSize = inputData.byteLength;

  // Decompress
  const decompressedBytes = zstd.decompress(compressedBytes, inputData.byteLength);
  assert(decompressedBytes.byteLength === inputData.byteLength);
}
```

## Using the module in a browser

Emscripten compiled WebAssembly modules are built in 2 parts: a `.js` side and a `.wasm` side. In the browser the `.js` side needs to download the `.wasm` side from the server so it can compile it. There is [more information available in the emscripten documentation](https://kripken.github.io/emscripten-site/docs/compiling/Deploying-Pages.html).

## Developing locally

1. Run `yarn install` to install dependencies.
2. Run `yarn build` to invoke emcc inside a Docker container and compile the code in `wasm-zstd.c` as well as the required zstd source files. The output will be in `dist/` on the host machine.
3. Run `yarn test` to run the tests.

## License

@lichtblick/wasm-zstd is licensed under the [MIT License](https://opensource.org/licenses/MIT).

## Releasing

1. Run `yarn version --[major|minor|patch]` to bump version
2. Run `git push && git push --tags` to push new tag
3. GitHub Actions will take care of the rest

## Stay in touch

Join our [Slack channel](https://foxglove.dev/slack) to ask questions, share feedback, and stay up to date on what our team is working on.
npm package: @lichtblick/xmlrpc
Description: TypeScript library implementing an XMLRPC client and server with pluggable server backend
Author: Lichtblick
Latest version: 1.0.0

# @lichtblick/xmlrpc

TypeScript library implementing an XMLRPC client and server with pluggable server backend.

[![npm version](https://img.shields.io/npm/v/@lichtblick/xmlrpc.svg?style=flat)](https://www.npmjs.com/package/@lichtblick/xmlrpc)

## Usage

See the `examples` directory for a simple client and server example.

## License

@lichtblick/xmlrpc is licensed under the [MIT License](https://opensource.org/licenses/MIT).

## Releasing

1. Run `yarn version --[major|minor|patch]` to bump version
2. Run `git push && git push --tags` to push new tag
3. GitHub Actions will take care of the rest
npm package: @lichthagel/eslint-config
Description: Licht's ESLint config
Author: Lichthagel
Latest version: 1.0.33

# @lichthagel/eslint-config

Collection of eslint configs I use for my projects.

## Installation

`npm|yarn|pnpm|bun install -D eslint @lichthagel/eslint-config`

`npx|yarn dlx|pnpm dlx|bunx jsr add @licht/eslint-config` or `deno add jsr:@licht/eslint-config`

## Configuration

Using `eslint.config.js`:

```js
// @ts-check

import lichthagel from "@lichthagel/eslint-config";

/** @type {import("@lichthagel/eslint-config").FlatConfigItem[]} */
export default [
  ...await lichthagel({
    ...options
  }),
  ...otherConfigs
];
```

Or using `eslint.config.ts` (see <https://eslint.org/docs/latest/use/configure/configuration-files#typescript-configuration-files>):

```ts
import lichthagel, { FlatConfigItem } from "./dist/index.js";

export default [
  ...(await lichthagel({
    ...options
  })),
  ...otherConfigs
] satisfies FlatConfigItem[];
```