コード例 #1
0
  public ModifiedGoToObjectPFN(
      double stopDistance,
      boolean slowDownCloseToTarget,
      double opponentPower,
      double opponentInfluenceDistance,
      double targetPower,
      double alpha) {
    this.stopDistance = 0;
    setSlowDownCloseToTarget(slowDownCloseToTarget);

    OPPONENT_POWER = opponentPower;
    OPPONENT_INFLUENCE_DISTANCE = opponentInfluenceDistance;
    TARGET_POWER = targetPower;
    ALPHA = alpha;

    setSlowDownCloseToTarget(slowDownCloseToTarget);
    RobotConf conf = new RobotConf(ROBOT_TRACK_WIDTH, WHEEL_RADIUS);
    // plann = new PFPlanning(conf, 0, 1, 12, 0.5); // No opponent avoidance
    // Avoids opponent:
    plann = new PFPlanning(conf, OPPONENT_POWER, OPPONENT_INFLUENCE_DISTANCE, TARGET_POWER, ALPHA);

    // Add walls
    double wallPower = 10;
    double wallInfDist = -0.05;
    RectObject leftWall =
        new RectObject(new Point(0, Globals.PITCH_HEIGHT), new Point(0, 0), wallPower, wallInfDist);
    RectObject rightWall =
        new RectObject(
            new Point(Globals.PITCH_WIDTH, Globals.PITCH_HEIGHT),
            new Point(Globals.PITCH_WIDTH, 0),
            wallPower,
            wallInfDist);
    RectObject topWall =
        new RectObject(
            new Point(0, Globals.PITCH_HEIGHT),
            new Point(Globals.PITCH_WIDTH, Globals.PITCH_HEIGHT),
            wallPower,
            wallInfDist);
    RectObject bottomWall =
        new RectObject(new Point(0, 0), new Point(Globals.PITCH_WIDTH, 0), wallPower, wallInfDist);

    plann.addObject(leftWall);
    plann.addObject(rightWall);
    plann.addObject(topWall);
    plann.addObject(bottomWall);
  }