Skip to content

Commit

Permalink
Add drawing class
Browse files Browse the repository at this point in the history
  • Loading branch information
rbrott committed Feb 1, 2024
1 parent 01d55d7 commit 8e84495
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Drawing.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.firstinspires.ftc.teamcode;

import com.acmerobotics.dashboard.canvas.Canvas;
import com.acmerobotics.roadrunner.Pose2d;
import com.acmerobotics.roadrunner.Vector2d;

public final class Drawing {
private Drawing() {}


public static void drawRobot(Canvas c, Pose2d t) {
final double ROBOT_RADIUS = 9;

c.setStrokeWidth(1);
c.strokeCircle(t.position.x, t.position.y, ROBOT_RADIUS);

Vector2d halfv = t.heading.vec().times(0.5 * ROBOT_RADIUS);
Vector2d p1 = t.position.plus(halfv);
Vector2d p2 = p1.plus(halfv);
c.strokeLine(p1.x, p1.y, p2.x, p2.y);
}
}

0 comments on commit 8e84495

Please sign in to comment.