Пример #1
0
  /** Set the path to be followed. */
  @Override
  public void setPath(Path path) {
    forward.clear();
    this.path.clear();
    nav.clearPath();
    for (int i = 0; i < path.size(); i++) {
      forward.add(new Waypoint(path.get(i)));
      this.path.add(new Waypoint(path.get(i)));
    }
    for (int i = path.size() - 2; i > -1; i--) {
      this.path.add(new Waypoint(path.get(i)));
    }

    this.path.add(new Waypoint(0, 0));

    for (Waypoint wp : this.path) {
      nav.addWaypoint(wp);
    }
  }