Package Exports
- @foxglove/ulog
- @foxglove/ulog/dist/index.js
- @foxglove/ulog/web
- @foxglove/ulog/web.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@foxglove/ulog) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@foxglove/ulog
PX4 ULog file reader
A web and node.js TypeScript library for reading PX4 ULog files, from the PX4 Autopilot system for drones and other autonomous vehicles.
Usage
import { MessageType, ULog } from "@foxglove/ulog";
import { FileReader } from "@foxglove/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
@foxglove/ulog is licensed under the MIT License.
Releasing
- Run
yarn version --[major|minor|patch]to bump version - Run
git push && git push --tagsto push new tag - GitHub Actions will take care of the rest
Stay in touch
Join our Discord to ask questions, share feedback, and stay up to date on what our team is working on.