-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.team766.robot.mechanisms; | ||
|
||
import com.team766.framework.Mechanism; | ||
import com.team766.hal.RobotProvider; | ||
import com.team766.hal.SolenoidController; | ||
import com.team766.hal.MotorController; | ||
|
||
public class Intake extends Mechanism { | ||
private SolenoidController m_extend; | ||
private MotorController m_wheels; | ||
|
||
public Intake() { | ||
m_extend = RobotProvider.instance.getSolenoid("intakeArm"); | ||
m_wheels = RobotProvider.instance.getMotor("intakeWheels"); | ||
} | ||
|
||
public void setExtended(boolean extended) { | ||
checkContextOwnership(); | ||
|
||
m_extend.set(extended); | ||
} | ||
|
||
public void setWheelPower(double power) { | ||
checkContextOwnership(); | ||
|
||
m_wheels.set(power); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/team766/robot/procedures/CollectBalls.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.team766.robot.procedures; | ||
|
||
import com.team766.framework.Procedure; | ||
import com.team766.framework.Context; | ||
|
||
public class CollectBalls extends Procedure { | ||
|
||
public void run(Context context) { | ||
new StartIntake().run(context); | ||
|
||
new DriveStraight().run(context); | ||
|
||
new StopIntake().run(context); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/team766/robot/procedures/StartIntake.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.team766.robot.procedures; | ||
|
||
import com.team766.framework.Procedure; | ||
import com.team766.framework.Context; | ||
import com.team766.robot.Robot; | ||
|
||
public class StartIntake extends Procedure { | ||
|
||
public void run(Context context) { | ||
context.takeOwnership(Robot.intake); | ||
|
||
Robot.intake.setWheelPower(1.0); | ||
Robot.intake.setExtended(true); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/team766/robot/procedures/StopIntake.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.team766.robot.procedures; | ||
|
||
import com.team766.framework.Procedure; | ||
import com.team766.framework.Context; | ||
import com.team766.robot.Robot; | ||
|
||
public class StopIntake extends Procedure { | ||
|
||
public void run(Context context) { | ||
context.takeOwnership(Robot.intake); | ||
|
||
Robot.intake.setWheelPower(0.0); | ||
Robot.intake.setExtended(false); | ||
} | ||
|
||
} |