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

Commit

Permalink
Merge branch 'mayhem-the-factory' of https://github.com/Team766/2024
Browse files Browse the repository at this point in the history
…into mayhem-the-factory
  • Loading branch information
1yd1a committed Nov 23, 2024
2 parents 9cf0266 + c04bb7f commit 316a6cf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
20 changes: 12 additions & 8 deletions src/main/java/com/team766/robot/rookie_bot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,23 @@ public void run(final Context context) {

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

if (joystick0.getButtonPressed(1)) {
if (joystick0.getButton(1)) {
Robot.elevator.move(0.3);
} else if (joystick0.getButtonPressed(2)) {
} else if (joystick0.getButton(2)) {
Robot.elevator.move(-0.3);
} else if (joystick0.getButtonReleased(1) || joystick0.getButtonReleased(1)) {
}

if (joystick0.getButtonReleased(1) || joystick0.getButtonReleased(2)) {
Robot.elevator.move(0);
}

if (joystick0.getButtonPressed(3)) {
Robot.intake.setPowerBoth(0.3);
} else if (joystick0.getButtonPressed(4)) {
Robot.intake.setPowerBoth(-0.3);
} else if (joystick0.getButtonReleased(3) || joystick0.getButtonReleased(4)) {
if (joystick0.getButton(3)) {
Robot.intake.setPowerBoth(0.5);
} else if (joystick0.getButton(4)) {
Robot.intake.setPowerBoth(-0.5);
}

if (joystick0.getButtonReleased(3) || joystick0.getButtonReleased(4)) {
Robot.intake.setPowerBoth(0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class Elevator extends Mechanism{
private MotorController m_elevator;
private EncoderReader m_elevatorEncoder;
private final double TOP_LIMIT = 400;
private final double TOP_LIMIT = -130;
private final double BOTTOM_LIMIT = 0;


Expand All @@ -22,21 +22,24 @@ public Elevator() {
}

public void move(double power) {
if (!((power > 0 && getElevatorDistance() > TOP_LIMIT) || (power < 0 && getElevatorDistance() < BOTTOM_LIMIT))) {
m_elevator.set(power);
if (!((power < 0 && (getElevatorDistance() < TOP_LIMIT)) || (power > 0 && (getElevatorDistance() > BOTTOM_LIMIT)))) {
m_elevator.set(-power);
} else {
m_elevator.set(0);
}

}

public double getElevatorDistance(){
return m_elevatorEncoder.getDistance();
return m_elevator.getSensorPosition();
}

public void resetEncoder(){
m_elevatorEncoder.reset();
m_elevator.setSensorPosition(0);
}

public void run() {
log("elevator: " + getElevatorDistance());
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
public class Intake extends Mechanism {
private MotorController intakeChainLeft;
private MotorController intakeChainRight;
private final double INNER_LIMIT = 20;
private final double OUTER_LIMIT = -400;
private final double INNER_LIMIT = 2;
private final double OUTER_LIMIT = -6;

public Intake() {
intakeChainLeft = RobotProvider.instance.getMotor("intake.ChainLeft");
Expand Down Expand Up @@ -45,6 +45,10 @@ public void setIntake(double leftPower, double rightPower) {
public void setPowerBoth(double powerBoth) {
setIntake(powerBoth, powerBoth);
}

public void run(){
log("left: " + intakeChainLeft.getSensorPosition());
log("right: " + intakeChainRight.getSensorPosition());

}
}

0 comments on commit 316a6cf

Please sign in to comment.