This repository was archived by the owner on Jan 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +27
-16
lines changed
src/main/java/com/team766/robot/rookie_bot Expand file tree Collapse file tree 3 files changed +27
-16
lines changed Original file line number Diff line number Diff line change @@ -36,19 +36,23 @@ public void run(final Context context) {
36
36
37
37
Robot .drive .setArcadeDrivePower (joystick0 .getAxis (1 ), joystick0 .getAxis (0 ));
38
38
39
- if (joystick0 .getButtonPressed (1 )) {
39
+ if (joystick0 .getButton (1 )) {
40
40
Robot .elevator .move (0.3 );
41
- } else if (joystick0 .getButtonPressed (2 )) {
41
+ } else if (joystick0 .getButton (2 )) {
42
42
Robot .elevator .move (-0.3 );
43
- } else if (joystick0 .getButtonReleased (1 ) || joystick0 .getButtonReleased (1 )) {
43
+ }
44
+
45
+ if (joystick0 .getButtonReleased (1 ) || joystick0 .getButtonReleased (2 )) {
44
46
Robot .elevator .move (0 );
45
47
}
46
48
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 )) {
52
56
Robot .intake .setPowerBoth (0 );
53
57
}
54
58
Original file line number Diff line number Diff line change 10
10
public class Elevator extends Mechanism {
11
11
private MotorController m_elevator ;
12
12
private EncoderReader m_elevatorEncoder ;
13
- private final double TOP_LIMIT = 400 ;
13
+ private final double TOP_LIMIT = - 130 ;
14
14
private final double BOTTOM_LIMIT = 0 ;
15
15
16
16
@@ -22,21 +22,24 @@ public Elevator() {
22
22
}
23
23
24
24
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 );
27
27
} else {
28
28
m_elevator .set (0 );
29
29
}
30
30
31
31
}
32
32
33
33
public double getElevatorDistance (){
34
- return m_elevatorEncoder . getDistance ();
34
+ return m_elevator . getSensorPosition ();
35
35
}
36
36
37
37
public void resetEncoder (){
38
- m_elevatorEncoder . reset ( );
38
+ m_elevator . setSensorPosition ( 0 );
39
39
}
40
40
41
+ public void run () {
42
+ log ("elevator: " + getElevatorDistance ());
43
+ }
41
44
}
42
45
Original file line number Diff line number Diff line change 14
14
public class Intake extends Mechanism {
15
15
private MotorController intakeChainLeft ;
16
16
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 ;
19
19
20
20
public Intake () {
21
21
intakeChainLeft = RobotProvider .instance .getMotor ("intake.ChainLeft" );
@@ -45,6 +45,10 @@ public void setIntake(double leftPower, double rightPower) {
45
45
public void setPowerBoth (double powerBoth ) {
46
46
setIntake (powerBoth , powerBoth );
47
47
}
48
-
48
+ public void run (){
49
+ log ("left: " + intakeChainLeft .getSensorPosition ());
50
+ log ("right: " + intakeChainRight .getSensorPosition ());
51
+
52
+ }
49
53
}
50
54
You can’t perform that action at this time.
0 commit comments