@Test public void getState() { Optional<BotState> botState = updateState(Vector3.fromXY(1, 0), 1); assertThat(botState).isNotPresent(); botState = updateState(Vector3.fromXY(3, 0), 3); assertThat(botState).isPresent(); assertThat(botState.get().getPos()).isEqualTo(Vector2.fromXY(2, 0)); }
public Optional<BotState> getState(final RobotInfo robotInfo) { Optional<BotState> trajState = botToState(robotInfo); if (trajState.isPresent()) { DataSync<BotState> stateBuffer = getStateBuffer(robotInfo.getBotId()); stateBuffer.add(robotInfo.getTimestamp(), trajState.get()); long timestamp = robotInfo.getTimestamp() - (long) (robotInfo.getBotParams().getFeedbackDelay() * 1e9); return stateBuffer.get(timestamp).map(p -> interpolate(p, timestamp)); } return Optional.empty(); }
BotStateFromTrajectoryCalculator { public Optional<BotState> getState(final RobotInfo robotInfo) { Optional<BotState> trajState = botToState(robotInfo); if (trajState.isPresent()) { DataSync<BotState> stateBuffer = getStateBuffer(robotInfo.getBotId()); stateBuffer.add(robotInfo.getTimestamp(), trajState.get()); long timestamp = robotInfo.getTimestamp() - (long) (robotInfo.getBotParams().getFeedbackDelay() * 1e9); return stateBuffer.get(timestamp).map(p -> interpolate(p, timestamp)); } return Optional.empty(); } }
BotStateFromTrajectoryCalculator { public Optional<BotState> getState(final RobotInfo robotInfo) { Optional<BotState> trajState = botToState(robotInfo); if (trajState.isPresent()) { DataSync<BotState> stateBuffer = getStateBuffer(robotInfo.getBotId()); stateBuffer.add(robotInfo.getTimestamp(), trajState.get()); long timestamp = robotInfo.getTimestamp() - (long) (robotInfo.getBotParams().getFeedbackDelay() * 1e9); return stateBuffer.get(timestamp).map(p -> interpolate(p, timestamp)); } return Optional.empty(); }  }
BotStateFromTrajectoryCalculator { public Optional<BotState> getState(final RobotInfo robotInfo) { Optional<BotState> trajState = botToState(robotInfo); if (trajState.isPresent()) { DataSync<BotState> stateBuffer = getStateBuffer(robotInfo.getBotId()); stateBuffer.add(robotInfo.getTimestamp(), trajState.get()); long timestamp = robotInfo.getTimestamp() - (long) (robotInfo.getBotParams().getFeedbackDelay() * 1e9); return stateBuffer.get(timestamp).map(p -> interpolate(p, timestamp)); } return Optional.empty(); }  Optional<BotState> getState(final RobotInfo robotInfo); void reset(BotID botID); Optional<BotState> getLatestState(BotID botID); }
BotStateFromTrajectoryCalculator { public Optional<BotState> getState(final RobotInfo robotInfo) { Optional<BotState> trajState = botToState(robotInfo); if (trajState.isPresent()) { DataSync<BotState> stateBuffer = getStateBuffer(robotInfo.getBotId()); stateBuffer.add(robotInfo.getTimestamp(), trajState.get()); long timestamp = robotInfo.getTimestamp() - (long) (robotInfo.getBotParams().getFeedbackDelay() * 1e9); return stateBuffer.get(timestamp).map(p -> interpolate(p, timestamp)); } return Optional.empty(); }  Optional<BotState> getState(final RobotInfo robotInfo); void reset(BotID botID); Optional<BotState> getLatestState(BotID botID);  }