Skip to content

Commit

Permalink
lights
Browse files Browse the repository at this point in the history
  • Loading branch information
abirarun committed Jan 12, 2025
1 parent 24dc68c commit 7bfb9c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

public class Hardware extends HardwareMapper implements TriOdoProvider {
public static final double spinTickPerRev = 751.8;
public static final double RIGHT_SLIDE_OUT = 0.72;
public static final double RIGHT_SLIDE_OUT = 0.64;
@Deprecated public static final double LEFT_SLIDE_OUT = 1 - RIGHT_SLIDE_OUT;
public static final double RIGHT_SLIDE_IN = 0.45;
@Deprecated public static final double LEFT_SLIDE_IN = 1 - RIGHT_SLIDE_IN;
Expand All @@ -43,6 +43,7 @@ public class Hardware extends HardwareMapper implements TriOdoProvider {
public static final double LAMP_ORANGE = 0.333;
public static final double LAMP_YELLOW = 0.36;
public static final double LAMP_PURPLE = 0.700;
public static final double LAMP_WHITE = 1.0;

public static int deg2arm(double degrees) {
return (int) (degrees / 360.0 * spinTickPerRev);
Expand Down Expand Up @@ -150,6 +151,9 @@ public static class Locks {
@HardwareName("lightRight")
public Servo lightRight;

@HardwareName("limelightlight")
public Servo limelightlight;

@HardwareName("clawColor")
public ColorSensor clawColor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import static java.lang.Math.abs;

import android.annotation.SuppressLint;
import android.database.AbstractCursor;
import android.icu.util.IslamicCalendar;

import com.qualcomm.hardware.kauailabs.NavxMicroNavigationSensor;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.util.ElapsedTime;

import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
Expand Down Expand Up @@ -125,7 +128,7 @@ private void hardwareInit() {

hardware.lightLeft.setPosition(Hardware.LAMP_PURPLE);
hardware.lightRight.setPosition(Hardware.LAMP_PURPLE);

hardware.limelightlight.setPosition(Hardware.LAMP_WHITE);
navxMicro = hardware.gyro;
}

Expand Down Expand Up @@ -237,6 +240,7 @@ public void runOpMode() {
stepper();
lift();
arm();
LimelightHeadlight();

boolean shouldScoreHigh = gamepad2.left_trigger > 0.5;
boolean shouldScoreHigh2 = gamepad2.right_trigger > 0.5;
Expand Down Expand Up @@ -656,4 +660,9 @@ public void transfer() {
transferInternal();
}

public void LimelightHeadlight(){
if(hardware.horizontalSlide.getPosition() == Hardware.RIGHT_SLIDE_OUT){
hardware.limelightlight.setPosition(Hardware.LAMP_WHITE);
}
}
}

0 comments on commit 7bfb9c2

Please sign in to comment.