Skip to content

Commit

Permalink
autoaim slowly getting there, but the function isn't right yet
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Burnett1612 committed Oct 25, 2024
1 parent af67d66 commit 8750fce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public void setStartingPose() {
startPositionIndex.get() == 0
? AllianceFlipUtil.apply(startPosition0)
: AllianceFlipUtil.apply(startPosition1));
arm.setTargetPos(40);
}
}

Expand Down Expand Up @@ -351,7 +352,7 @@ private void configureButtonBindings() {
new InstantCommand(() -> indexer.index(), indexer))),
new InstantCommand(() -> shooter.setShoot(), shooter)));

driveController.leftBumper().whileTrue(arm.runGoToPosCommand(60.0));
driveController.leftBumper().whileTrue(arm.runGoToPosCommand(50.0));
driveController.leftBumper().whileFalse(arm.runGoToPosCommand(40.0));
// driveController.rightTrigger(0.9).whileTrue(intake.runPoopCommand());
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/frc/robot/commands/DriveCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ public static Command joystickDriveFacingPoint(
Pose2d robotPose = drive.getPose();
double desiredAngle =
Math.atan2(
facingPose.getY() - robotPose.getY(),
AllianceFlipUtil.apply(facingPose.getX()) - robotPose.getX())
+ Math.PI;
facingPose.getY() - robotPose.getY(),
AllianceFlipUtil.apply(facingPose.getX()) - robotPose.getX());

// Square values
linearMagnitude = linearMagnitude * linearMagnitude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public void execute() {
AllianceFlipUtil.apply(FieldConstants.Speaker.centerSpeakerOpening.getX()),
FieldConstants.Speaker.centerSpeakerOpening.getY()),
new Rotation2d()));
arm.setTargetPos((-0.24 * Math.log(distance - 1.05) + 0.76) * 180 / Math.PI);
arm.setTargetPos((-0.33 * Math.log(119.0 * (distance - 0.67)) + 2) * 180 / Math.PI);
}
}

0 comments on commit 8750fce

Please sign in to comment.