Skip to content

Commit 73016ce

Browse files
author
Marc Raniolo
committed
winch set up
1 parent 74fce3e commit 73016ce

File tree

13 files changed

+76
-79
lines changed

13 files changed

+76
-79
lines changed

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"files.exclude": {
3+
"**/.classpath": true,
4+
"**/.project": true,
5+
"**/.settings": true,
6+
"**/.factorypath": true
7+
}
8+
}
12.3 KB
Binary file not shown.
0 Bytes
Binary file not shown.
50 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
2.58 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

FRC2020/src/main/java/frc/robot/OI.java

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ public class OI {
1212
Joystick rightStick = RobotMap.rightJoystick;
1313
public XboxController xbox = RobotMap.xboxController;
1414

15-
public boolean grabberState = true;
16-
public boolean harvesterButtonPressed = false;
15+
public int winchState = 0;
1716
public double valueShooterSpeed = 0.5;
1817

1918
Button leftbutton1 = new JoystickButton(leftStick, 1), leftbutton2 = new JoystickButton(leftStick, 2);
@@ -24,22 +23,20 @@ public class OI {
2423
Button rightbutton5 = new JoystickButton(rightStick, 5), rightbutton6 = new JoystickButton(rightStick, 6);
2524

2625
/*
27-
OI Interface:
28-
Drive Train: leftjoystick.Yaxis - left motor; rightjoystick.Yaxis - right motor
29-
Shooter: xbox right trigger starts the shooter
30-
:to make shooter go faster use D-Pad up button
31-
:to make shooter go slower use D-Pad down button
32-
Harvester: to run, hold down xbox Y button (when shooter running)
33-
Loader: to run, hold down xbox B button (when shooter running)
34-
Conveyor: to run, hold down xbox A button
35-
Making motors run backwards:
36-
Harvester: Holding top left bumper, and y reverses the harvester motor
37-
Loader: holding top left bumper, and a reverses the loader motor
38-
Conveyor: holding top left bumper, and b reverses the conveyor motor
39-
*/
26+
* OI Interface: Drive Train: leftjoystick.Yaxis - left motor;
27+
* rightjoystick.Yaxis - right motor Shooter: xbox right trigger starts the
28+
* shooter :to make shooter go faster use D-Pad up button :to make shooter go
29+
* slower use D-Pad down button Harvester: to run, hold down xbox Y button (when
30+
* shooter running) Loader: to run, hold down xbox B button (when shooter
31+
* running) Conveyor: to run, hold down xbox A button Making motors run
32+
* backwards: Harvester: Holding top left bumper, and y reverses the harvester
33+
* motor Loader: holding top left bumper, and a reverses the loader motor
34+
* Conveyor: holding top left bumper, and b reverses the conveyor motor
35+
*/
4036

4137
public double getLeftSpeed() {
42-
// System.out.println("getleftspeed.getY()=" + leftStick.getY() + " Math.pow(gety),3)=" + Math.pow(leftStick.getY(), 3));
38+
// System.out.println("getleftspeed.getY()=" + leftStick.getY() + "
39+
// Math.pow(gety),3)=" + Math.pow(leftStick.getY(), 3));
4340
if (leftStick.getY() > 0.01) {
4441
return Math.pow(leftStick.getY(), 3) - 0.01;
4542
} else if (leftStick.getY() <= -0.01) {
@@ -50,7 +47,8 @@ public double getLeftSpeed() {
5047
}
5148

5249
public double getRightSpeed() {
53-
// System.out.println("getrightspeed.getY()=" + rightStick.getY() + "Math.pow(rightstickvalue)=" + Math.pow(rightStick.getY(), 3));
50+
// System.out.println("getrightspeed.getY()=" + rightStick.getY() +
51+
// "Math.pow(rightstickvalue)=" + Math.pow(rightStick.getY(), 3));
5452
if (rightStick.getY() > 0.01) {
5553
return -1.0 * Math.pow(rightStick.getY(), 3) + 0.01;
5654
} else if (rightStick.getY() < -0.01) {
@@ -60,22 +58,6 @@ public double getRightSpeed() {
6058
}
6159
}
6260

63-
public boolean winchup() {
64-
if (leftStick.getRawButtonPressed(2)) {
65-
return true;
66-
} else {
67-
return false;
68-
}
69-
}
70-
71-
public boolean winchdown() {
72-
if (rightStick.getRawButtonPressed(2)) {
73-
return true;
74-
} else {
75-
return false;
76-
}
77-
}
78-
7961
public boolean shoot() {
8062
if (xbox.getTriggerAxis(Hand.kRight) > 0.1) {
8163
return true;
@@ -94,16 +76,10 @@ public int changeShooterSpeed() {
9476
}
9577
}
9678

97-
public boolean grabberState() {
98-
if (grabberState == false) {
99-
grabberState = true;
100-
return true;
101-
} else {
102-
grabberState = false;
103-
return false;
104-
}
105-
}
106-
79+
/*
80+
* public boolean grabberState() { if (grabberState == false) { grabberState =
81+
* true; return true; } else { grabberState = false; return false; } }
82+
*/
10783
public boolean cycle() {
10884
if (xbox.getXButton() == true) {
10985
return true;
@@ -127,20 +103,30 @@ public boolean harvester() {
127103
return false;
128104
}
129105
}
130-
106+
131107
public boolean conveyor() {
132108
if (xbox.getBButton() == true) {
133109
return true;
134110
} else {
135111
return false;
136112
}
137113
}
138-
114+
139115
public boolean loader() {
140116
if (xbox.getAButton() == true) {
141117
return true;
142118
} else {
143119
return false;
144120
}
145121
}
122+
123+
public void winch() {
124+
if (xbox.getTriggerAxis(Hand.kLeft) >= 0.01) {
125+
winchState = 1;
126+
} else if (xbox.getTriggerAxis(Hand.kLeft) <= -0.01) {
127+
winchState = -1;
128+
} else {
129+
winchState = 0;
130+
}
131+
}
146132
}

0 commit comments

Comments
 (0)