How to use the rosbag.TimeUtil.isGreaterThan 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 / panels / ThreeDimensionalViz / SceneBuilder / MessageCollector.js View on Github external
isExpired(currentTime: Time) {
    // cannot tell if a marker is expired if we don't have a clock yet
    if (!currentTime) {
      return false;
    }
    const lifetime = this.getLifetime();

    // we use the receive time (clock) instead of the header stamp
    // to match the behavior of rviz
    const expiresAt = TimeUtil.add(this.receiveTime, lifetime);

    return TimeUtil.isGreaterThan(currentTime, expiresAt);
  }
github cruise-automation / webviz / packages / webviz-core / src / components / SeekController.js View on Github external
const { activeData, playerId } = context.playerState;
      if (!playerId || !activeData) {
        return;
      }
      if (seekApplied.current) {
        return;
      }
      seekApplied.current = true;
      const params = new URLSearchParams(search);
      const seekTo = parseInt(params.get("seek-to"), 10);
      if (!seekTo) {
        return;
      }
      const { startTime, endTime } = activeData;
      const seekToTime = fromMillis(seekTo);
      if (TimeUtil.isGreaterThan(seekToTime, startTime) && TimeUtil.isLessThan(seekToTime, endTime)) {
        context.seekPlayback(seekToTime);
      }
    },
    [shouldRunEffect, search] // eslint-disable-line react-hooks/exhaustive-deps
github cruise-automation / webviz / packages / webviz-core / src / dataProviders / MemoryDataProvider.js View on Github external
async getMessages(start: Time, end: Time, topics: string[]) {
    const result = [];
    for (const message of this.messages) {
      if (TimeUtil.isGreaterThan(message.receiveTime, end)) {
        break;
      }
      if (TimeUtil.isLessThan(message.receiveTime, start)) {
        continue;
      }
      if (!topics.includes(message.topic)) {
        continue;
      }
      result.push(message);
    }
    return result;
  }
}
github cruise-automation / webviz / packages / webviz-core / src / dataProviders / ReadAheadDataProvider.js View on Github external
TimeUtil.isLessThan(start, this._current.start)
    ) {
      this._topics = topics;
      this._current = undefined;
      this._next = undefined;
    }
    let messages = [];
    const currentMatches = this._current && this._current.overlaps(start, end);
    const nextMatches = this._next && this._next.overlaps(start, end);
    if (/*:: this._current && */ currentMatches) {
      messages = messages.concat(await this._current.getMessages(start, end));
    }
    if (/*:: this._next && */ nextMatches) {
      messages = messages.concat(await this._next.getMessages(start, end));
    }
    if ((!currentMatches && !nextMatches) || (this._next && TimeUtil.isGreaterThan(end, this._next.end))) {
      let startTime = start;
      if (/*:: this._next && */ nextMatches) {
        startTime = TimeUtil.add(this._next.end, oneNanoSecond);
        log.info("readahead cache overrun - consider expanding readAheadRange");
      }
      this._current = this._makeReadResult(startTime, end, topics);
      await this._current.getMessages(startTime, end);
      const nextStart = TimeUtil.add(end, oneNanoSecond);
      this._next = this._makeReadResult(nextStart, TimeUtil.add(nextStart, this._readAheadRange), topics);
      messages = messages.concat(await this._getMessages(startTime, end, topics));
    } else if (/*:: this._next && */ nextMatches) {
      this._current = this._next;
      const nextStart = TimeUtil.add(this._current.end, oneNanoSecond);
      const nextEnd = TimeUtil.add(nextStart, this._readAheadRange);
      this._next = this._makeReadResult(nextStart, nextEnd, topics);
    }
github cruise-automation / webviz / packages / webviz-core / src / panels / ThreeDimensionalViz / SceneBuilder / MessageCollector.js View on Github external
setClock(clock: Time) {
    if (!clock) {
      return;
    }

    const clockMovedBackwards = TimeUtil.isGreaterThan(this.clock, clock);

    if (clockMovedBackwards) {
      this.markers.forEach((marker, key) => {
        const markerReceivedAfterClock = TimeUtil.isGreaterThan(marker.receiveTime, clock);
        if (markerReceivedAfterClock) {
          this.markers.delete(key);
        }
      });
    }
    this.clock = clock;
  }
github cruise-automation / webviz / packages / webviz-core / src / dataProviders / CombinedDataProvider.js View on Github external
const merge = (messages1: DataProviderMessage[], messages2: DataProviderMessage[]) => {
  const messages = [];
  let index1 = 0;
  let index2 = 0;
  while (index1 < messages1.length && index2 < messages2.length) {
    if (TimeUtil.isGreaterThan(messages1[index1].receiveTime, messages2[index2].receiveTime)) {
      messages.push(messages2[index2++]);
    } else {
      messages.push(messages1[index1++]);
    }
  }
  while (index1 < messages1.length) {
    messages.push(messages1[index1++]);
  }
  while (index2 < messages2.length) {
    messages.push(messages2[index2++]);
  }
  return messages;
};
github cruise-automation / webviz / packages / webviz-core / src / panels / ThreeDimensionalViz / SceneBuilder / MessageCollector.js View on Github external
this.markers.forEach((marker, key) => {
        const markerReceivedAfterClock = TimeUtil.isGreaterThan(marker.receiveTime, clock);
        if (markerReceivedAfterClock) {
          this.markers.delete(key);
        }
      });
    }

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