Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit c04bb7f

Browse files
committed
everything working!
1 parent def8313 commit c04bb7f

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

src/main/java/com/team766/robot/rookie_bot/OI.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,23 @@ public void run(final Context context) {
3636

3737
Robot.drive.setArcadeDrivePower(joystick0.getAxis(1), joystick0.getAxis(0));
3838

39-
if (joystick0.getButtonPressed(1)) {
39+
if (joystick0.getButton(1)) {
4040
Robot.elevator.move(0.3);
41-
} else if (joystick0.getButtonPressed(2)) {
41+
} else if (joystick0.getButton(2)) {
4242
Robot.elevator.move(-0.3);
43-
} else if (joystick0.getButtonReleased(1) || joystick0.getButtonReleased(1)) {
43+
}
44+
45+
if (joystick0.getButtonReleased(1) || joystick0.getButtonReleased(2)) {
4446
Robot.elevator.move(0);
4547
}
4648

47-
if (joystick0.getButtonPressed(3)) {
48-
Robot.intake.setPowerBoth(0.3);
49-
} else if (joystick0.getButtonPressed(4)) {
50-
Robot.intake.setPowerBoth(-0.3);
51-
} else if (joystick0.getButtonReleased(3) || joystick0.getButtonReleased(4)) {
49+
if (joystick0.getButton(3)) {
50+
Robot.intake.setPowerBoth(0.5);
51+
} else if (joystick0.getButton(4)) {
52+
Robot.intake.setPowerBoth(-0.5);
53+
}
54+
55+
if (joystick0.getButtonReleased(3) || joystick0.getButtonReleased(4)) {
5256
Robot.intake.setPowerBoth(0);
5357
}
5458

src/main/java/com/team766/robot/rookie_bot/mechanisms/Elevator.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public class Elevator extends Mechanism{
1111
private MotorController m_elevator;
1212
private EncoderReader m_elevatorEncoder;
13-
private final double TOP_LIMIT = 400;
13+
private final double TOP_LIMIT = -130;
1414
private final double BOTTOM_LIMIT = 0;
1515

1616

@@ -22,21 +22,24 @@ public Elevator() {
2222
}
2323

2424
public void move(double power) {
25-
if (!((power > 0 && getElevatorDistance() > TOP_LIMIT) || (power < 0 && getElevatorDistance() < BOTTOM_LIMIT))) {
26-
m_elevator.set(power);
25+
if (!((power < 0 && (getElevatorDistance() < TOP_LIMIT)) || (power > 0 && (getElevatorDistance() > BOTTOM_LIMIT)))) {
26+
m_elevator.set(-power);
2727
} else {
2828
m_elevator.set(0);
2929
}
3030

3131
}
3232

3333
public double getElevatorDistance(){
34-
return m_elevatorEncoder.getDistance();
34+
return m_elevator.getSensorPosition();
3535
}
3636

3737
public void resetEncoder(){
38-
m_elevatorEncoder.reset();
38+
m_elevator.setSensorPosition(0);
3939
}
4040

41+
public void run() {
42+
log("elevator: " + getElevatorDistance());
43+
}
4144
}
4245

src/main/java/com/team766/robot/rookie_bot/mechanisms/Intake.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
public class Intake extends Mechanism {
1515
private MotorController intakeChainLeft;
1616
private MotorController intakeChainRight;
17-
private final double INNER_LIMIT = 20;
18-
private final double OUTER_LIMIT = -400;
17+
private final double INNER_LIMIT = 2;
18+
private final double OUTER_LIMIT = -6;
1919

2020
public Intake() {
2121
intakeChainLeft = RobotProvider.instance.getMotor("intake.ChainLeft");
@@ -45,6 +45,10 @@ public void setIntake(double leftPower, double rightPower) {
4545
public void setPowerBoth(double powerBoth) {
4646
setIntake(powerBoth, powerBoth);
4747
}
48-
48+
public void run(){
49+
log("left: " + intakeChainLeft.getSensorPosition());
50+
log("right: " + intakeChainRight.getSensorPosition());
51+
52+
}
4953
}
5054

0 commit comments

Comments
 (0)