3
3
import edu .wpi .first .math .geometry .Pose2d ;
4
4
import edu .wpi .first .math .kinematics .ChassisSpeeds ;
5
5
import frc .robot .autos .trailblazer .AutoPoint ;
6
+
6
7
import java .util .List ;
7
8
9
+ import dev .doglog .DogLog ;
10
+
8
11
// TODO: Implement https://github.com/team581/2024-offseason-bot/issues/94
9
12
public class HeuristicPathTracker implements PathTracker {
10
13
private List <AutoPoint > points = List .of ();
11
14
private Pose2d currentPose = new Pose2d ();
12
15
private double proximityRadius = 0.5 ;
13
16
private int currentPointIndex = 0 ;
14
17
18
+
15
19
@ Override
16
20
public void resetAndSetPoints (List <AutoPoint > points ) {
17
21
this .points = points ;
@@ -29,14 +33,24 @@ public Pose2d getTargetPose() {
29
33
}
30
34
AutoPoint currentPoint = points .get (getCurrentPointIndex ());
31
35
Pose2d currentTargetPose = currentPoint .poseSupplier .get ();
36
+
37
+ /// DogLog.log("Autos/Trailblazer/CurrentWaypoint", currentPoint);
38
+ DogLog .log ("Autos/Trailblazer/NextPointIndex" , currentPointIndex );
39
+ DogLog .log ("Autos/Trailblazer/CurrentTargetPose" , currentTargetPose );
40
+
32
41
double distanceToTarget =
33
42
currentPose .getTranslation ().getDistance (currentTargetPose .getTranslation ());
34
43
35
44
if (distanceToTarget < proximityRadius && currentPointIndex < points .size () - 1 ) {
36
45
currentPointIndex ++;
37
46
}
38
47
39
- return points .get (currentPointIndex ).poseSupplier .get ();
48
+ var targetPose = points .get (currentPointIndex ).poseSupplier .get ();
49
+
50
+ DogLog .log ("Autos/Trailblazer/TargetPose" , targetPose );
51
+ DogLog .log ("Autos/Trailblazer/DistanceToTarget" , distanceToTarget );
52
+
53
+ return targetPose ;
40
54
}
41
55
42
56
@ Override
@@ -48,4 +62,5 @@ public int getCurrentPointIndex() {
48
62
public boolean isFinished () {
49
63
return false ;
50
64
}
65
+
51
66
}
0 commit comments