Skip to content

Commit

Permalink
anglesnap takes joystick input directly
Browse files Browse the repository at this point in the history
maybe fix maybe not - slightly different from prev. attempt
  • Loading branch information
JayK445 committed Oct 18, 2023
1 parent 2bc96dd commit c6da381
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ public void execute() {
double rotY = rotationYSupplier.getAsDouble();
boolean isRobotRelative = isRobotRelativeSupplier.getAsBoolean();

double targetAngle = Util.angleSnap(Util.vectorToAngle(-rotX, -rotY), angles);
double targetAngle = Util.vectorToAngle(-rotX, -rotY);

// if stick magnitude is greater then rotate angle mag
if (Util.vectorMagnitude(rotX, rotY) > Drive.ROTATE_VECTOR_MAGNITUDE) {
angle = isRobotRelative ? Util.normalizeDegrees(targetAngle + initialAngle) : targetAngle;
angle = targetAngle;
}

drivebaseSubsystem.driveAngle(new Pair<>(x, y), angle);
Expand Down

0 comments on commit c6da381

Please sign in to comment.