Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/com/team766/robot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ public void run(Context context) {
intakeState = IntakeState.IDLE;
}
}
//grabber OI
if(controlPanel.getButtonPressed(InputConstants.GRAB_IN)){
Robot.grabber.grabberPickUp();
} else if(controlPanel.getButtonPressed(InputConstants.GRAB_OUT)){
Robot.grabber.grabberLetGo();
} else {
Robot.grabber.grabberStop();
}


// Sets the wheels to the cross position if the cross button is pressed
if (rightJoystick.getButtonPressed(InputConstants.CROSS_WHEELS)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public final class InputConstants {

// Joystick buttons
public static final int CROSS_WHEELS = 1;
public static final int GRABBER_RELEASE = 1;
//public static final int GRABBER_RELEASE = 1;
public static final int FINE_DRIVING = 1;

// Control Panel Buttons
Expand All @@ -36,6 +36,10 @@ public final class InputConstants {
public static final int RESET_GYRO = 11;
public static final int RESET_POS = 12;

public static final int GRAB_IN = 13;
public static final int GRAB_OUT = 14;
public static final int GRAB_STOP = 15;

public static final int ANTI_GRAV = 16;


Expand Down
26 changes: 15 additions & 11 deletions src/main/java/com/team766/robot/mechanisms/Grabber.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,27 @@
import com.team766.framework.Mechanism;
import com.team766.hal.MotorController;
import com.team766.hal.RobotProvider;
import com.team766.hal.SolenoidController;

public class Grabber extends Mechanism{

private MotorController wrist;
private SolenoidController grabber;
public class Grabber extends Mechanism {
private MotorController grabby;

public Grabber(){
wrist = RobotProvider.instance.getMotor("wrist");
grabber = RobotProvider.instance.getSolenoid("grabber");
grabby = RobotProvider.instance.getMotor("arms.grabber");
}

public void grabIn(){
grabber.set(true);
public void grabberPickUp(){
checkContextOwnership();
grabby.set(1.0);

}

public void grabberLetGo(){
checkContextOwnership();
grabby.set(-1.0);
}

public void grabOut(){
grabber.set(false);
public void grabberStop(){
checkContextOwnership();
grabby.set(0.0);
}
}
12 changes: 12 additions & 0 deletions src/main/java/com/team766/robot/procedures/GrabberIn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.team766.robot.procedures;

import com.team766.framework.Context;
import com.team766.framework.Procedure;
import com.team766.robot.Robot;

public class GrabberIn extends Procedure{
public void run(Context context){
context.takeOwnership(Robot.grabber);
Robot.grabber.grabberPickUp();
}
}
12 changes: 12 additions & 0 deletions src/main/java/com/team766/robot/procedures/GrabberOut.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.team766.robot.procedures;

import com.team766.framework.Context;
import com.team766.framework.Procedure;
import com.team766.robot.Robot;

public class GrabberOut extends Procedure{
public void run(Context context){
context.takeOwnership(Robot.grabber);
Robot.grabber.grabberLetGo();
}
}
12 changes: 12 additions & 0 deletions src/main/java/com/team766/robot/procedures/GrabberStop.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.team766.robot.procedures;

import com.team766.framework.Context;
import com.team766.framework.Procedure;
import com.team766.robot.Robot;

public class GrabberStop extends Procedure{
public void run(Context context){
context.takeOwnership(Robot.grabber);
Robot.grabber.grabberStop();
}
}