Class WeaverRoute

java.lang.Object
org.hivevisionftc.vision.weaver.WeaverRoute

public final class WeaverRoute extends Object
Plans a Marrow Weaver route through a list of detections.

 List<Detection> detections = vision.fetchDetections(pose);

 PathResult path = WeaverRoute.from(pose)
         .avoid(new CircleZone(new Point(72, 72), 18))
         .maxTargets(4)
         .plan(detections);

 if (path != null) follower.follow(PedroPathingConverter.toPath(path));
 

Detections must already be in field coordinates, which is what HiveVision.fetchDetections returns.

  • Method Details

    • from

      public static WeaverRoute from(Pose start)
      Starts a route at start (field inches, heading in radians).
    • avoid

      public WeaverRoute avoid(com.skeletonarmy.marrow.zones.Zone... zones)
      Adds zones, in field inches, that the route must bend around.
    • avoid

      public WeaverRoute avoid(Collection<? extends com.skeletonarmy.marrow.zones.Zone> zones)
      Adds zones, in field inches, that the route must bend around.
    • maxTargets

      public WeaverRoute maxTargets(int n)
      Visits at most n detections, keeping the best ones. Zero or less means no limit.
    • ordered

      public WeaverRoute ordered()
      Visits detections in the order given instead of letting Weaver pick the cheapest order.
    • end

      public WeaverRoute end(Pose end)
      Ends the route at end instead of at the last detection.
    • plan

      public com.skeletonarmy.marrow.weaver.PathResult plan(List<Detection> detections)
      Plans the route.
      Parameters:
      detections - detections in field coordinates
      Returns:
      the planned route, or null if there are no detections
      Throws:
      RuntimeException - whatever Weaver throws for degenerate geometry; catch it to fall back