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
94 changes: 18 additions & 76 deletions src/main/java/com/team766/robot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,12 @@ public class OI extends Procedure {
private JoystickReader joystick1;
private JoystickReader joystick2;


enum generalControl{
CONE_HIGH_NODE,
CUBE_HIGH_NODE,
CONE_MID_NODE,
CUBE_MID_NODE,
OFF,
READY,
HUMANPLAYER_PICKUP,
MANUAL,
HYBRID_NODE
};



public generalControl generalState = generalControl.OFF;





public OI() {
loggerCategory = Category.OPERATOR_INTERFACE;

joystick0 = RobotProvider.instance.getJoystick(0);
joystick1 = RobotProvider.instance.getJoystick(1);
joystick2 = RobotProvider.instance.getJoystick(2);


}

public void run(Context context) {
Expand All @@ -69,84 +46,49 @@ public void run(Context context) {
if(joystick0.getButton(1)){
Robot.arms.resetEncoders();
}

if(joystick0.getButton(2)){
Robot.arms.antiGravBothJoints();
}

if(joystick0.getButton(3)){
//HIGH NODE SCORING
Robot.arms.pidForArmOne(-38.34);
Robot.arms.pidForArmTwo(-90.665);
Robot.arms.checkJointTwo(-90.665);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this call should've been in the pidForArmX

}
if(joystick0.getButtonPressed(4)){
//MID NODE SCORING
Robot.arms.pidForArmOne(null);
Robot.arms.pidForArmTwo(null);
Robot.arms.pidForArmTwo(-90);
Robot.arms.checkJointTwo(-90);
}

if(joystick0.getButton(5)){
//TAKING FROM HUMAN PLAYER
Robot.arms.pidForArmOne(null);
Robot.arms.pidForArmTwo(null);
Robot.arms.pidForArmOne(0);
Robot.arms.pidForArmTwo(0);
Robot.arms.checkJointTwo(0);
}

if(joystick0.getButton(6)){
//STOWED
Robot.arms.pidForArmOne(null);
Robot.arms.pidForArmTwo(null);
Robot.arms.pidForArmOne(0);
Robot.arms.pidForArmTwo(0);
Robot.arms.checkJointTwo(0);
}
if(joystick0.getButton(7)){
//READY
Robot.arms.pidForArmOne(null);
Robot.arms.pidForArmTwo(null);
Robot.arms.pidForArmOne(0);
Robot.arms.pidForArmTwo(0);
Robot.arms.checkJointTwo(0);
}
if(joystick0.getButton(8)){
//PREP
Robot.arms.pidForArmOne(null);
Robot.arms.pidForArmTwo(null);
Robot.arms.pidForArmOne(0);
Robot.arms.pidForArmTwo(0);
Robot.arms.checkJointTwo(0);
}

Robot.arms.run();

//TODO: can we stil use a switch?
/*
switch(generalState){
case OFF:
log("generalControl is off");
break;
case CONE_HIGH_NODE:
Robot.arms.pidForArmOne(0);
Robot.arms.pidForArmTwo(0);
break;
case CUBE_HIGH_NODE:
Robot.arms.pidForArmOne(0);
Robot.arms.pidForArmTwo(0);
break;
case CONE_MID_NODE:
Robot.arms.pidForArmOne(0);
Robot.arms.pidForArmTwo(0);
break;
case CUBE_MID_NODE:
Robot.arms.pidForArmOne(0);
Robot.arms.pidForArmTwo(0);
break;
case MANUAL:
Robot.arms.manuallySetArmOnePower(joystick0.getAxis(0));
Robot.arms.manuallySetArmTwoPower(joystick0.getAxis(1));
break;
case READY:
Robot.arms.pidForArmOne(0);
Robot.arms.pidForArmTwo(0);
break;
case HUMANPLAYER_PICKUP:
Robot.arms.pidForArmOne(0);
Robot.arms.pidForArmTwo(0);
break;
case HYBRID_NODE:
Robot.arms.pidForArmOne(0);
Robot.arms.pidForArmTwo(0);
break;
}
*/

}
}
}
Loading