How to use the rosbag.BagReader function in rosbag

To help you get started, we’ve selected a few rosbag examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cruise-automation / webviz / packages / webviz-core / src / dataProviders / BagDataProvider.js View on Github external
},
        rangesCallback: (ranges: Range[]) => {
          if (approximateSize) {
            extensionPoint.progressCallback({
              fullyLoadedFractionRanges: ranges.map(({ start, end }) => ({
                start: Math.max(0, start / approximateSize),
                end: Math.min(1, end / approximateSize),
              })),
            });
          }
        },
      });
      await remoteReader.open(); // Important that we call this first, because it might throw an error if the file can't be read.
      approximateSize = remoteReader.size() * 0.99; // Chop off the last percentage or so for the indexes.

      this._bag = new Bag(new BagReader(remoteReader));
      await this._bag.open();
    } else {
      this._bag = await open(bagPath.file);
      extensionPoint.progressCallback({ fullyLoadedFractionRanges: [{ start: 0, end: 1 }] });
    }

    const { startTime, endTime } = this._bag;
    const connections = ((Object.values(this._bag.connections): any): Connection[]);
    if (!startTime || !endTime || !connections.length) {
      // This will abort video generation:
      reportError("Invalid bag", "Bag is empty or corrupt.", "user");
      return new Promise(() => {}); // Just never finish initializing.
    }

    this._connectionsByTopic = keyBy(connections, "topic");
    return {

rosbag

`rosbag` is a node.js & browser compatible module for reading [rosbag](http://wiki.ros.org/rosbag) binary data files.

Apache-2.0
Latest version published 1 year ago

Package Health Score

63 / 100
Full package analysis

Similar packages