-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uploading the code for the first time
- Loading branch information
WilliamKluge
committed
Oct 27, 2015
0 parents
commit 3f40c62
Showing
4 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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,4 @@ | ||
# Project specific information | ||
package=org.usfirst.frc.team3926.robot | ||
robot.class=${package}.Robot | ||
simulation.world.file=/usr/share/frcsim/worlds/GearsBotDemo.world |
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,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<project name="FRC Deployment" default="deploy"> | ||
|
||
<!-- | ||
The following properties can be defined to override system level | ||
settings. These should not be touched unless you know what you're | ||
doing. The primary use is to override the wpilib version when | ||
working with older robots that can't compile with the latest | ||
libraries. | ||
--> | ||
|
||
<!-- By default the system version of WPI is used --> | ||
<!-- <property name="version" value=""/> --> | ||
|
||
<!-- By default the system team number is used --> | ||
<!-- <property name="team-number" value=""/> --> | ||
|
||
<!-- By default the target is set to 10.TE.AM.2 --> | ||
<!-- <property name="target" value=""/> --> | ||
|
||
<!-- Any other property in build.properties can also be overridden. --> | ||
|
||
<property file="${user.home}/wpilib/wpilib.properties"/> | ||
<property file="build.properties"/> | ||
<property file="${user.home}/wpilib/java/${version}/ant/build.properties"/> | ||
|
||
<import file="${wpilib.ant.dir}/build.xml"/> | ||
|
||
</project> |
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,79 @@ | ||
|
||
package org.usfirst.frc.team3926.robot; | ||
|
||
import edu.wpi.first.wpilibj.CANTalon; | ||
import edu.wpi.first.wpilibj.DoubleSolenoid; | ||
import edu.wpi.first.wpilibj.DoubleSolenoid.Value; | ||
import edu.wpi.first.wpilibj.IterativeRobot; | ||
import edu.wpi.first.wpilibj.Joystick; | ||
import edu.wpi.first.wpilibj.RobotDrive; | ||
import edu.wpi.first.wpilibj.Talon; | ||
|
||
public class Robot extends IterativeRobot { | ||
CANTalon talonSRX_FR; //Front Right | ||
CANTalon talonSRX_FL; //Front Left | ||
CANTalon talonSRX_BR; //Back Right | ||
CANTalon talonSRX_BL; //Back Left | ||
RobotDrive driveSystem; | ||
Joystick leftStick; | ||
Joystick rightStick; | ||
Joystick XBox; | ||
Talon talonLift; | ||
DoubleSolenoid armSolenoid; | ||
|
||
double lift = 0; | ||
double leftInput; | ||
double rightInput; | ||
|
||
boolean aClicked = false; | ||
boolean bClicked = false; | ||
|
||
public void robotInit() { | ||
talonSRX_FR = new CANTalon(1); | ||
talonSRX_FL = new CANTalon(2); | ||
talonSRX_BR = new CANTalon(3); | ||
talonSRX_BL = new CANTalon(4); | ||
|
||
driveSystem = new RobotDrive(talonSRX_FL, talonSRX_BL, talonSRX_FR, talonSRX_BR); | ||
|
||
leftStick = new Joystick(0); //USB 0 | ||
rightStick = new Joystick(1); //USB 1 | ||
XBox = new Joystick(2); //USB 2 | ||
|
||
talonLift = new Talon(0); | ||
|
||
armSolenoid = new DoubleSolenoid(5, 7, 6); | ||
} //End robotInit() | ||
|
||
public void autonomousPeriodic() { | ||
|
||
} //End autonomousPeriodic() | ||
|
||
public void teleopPeriodic() { | ||
leftInput = leftStick.getY(); //leftInput = left Y | ||
rightInput = rightStick.getY(); //rightInput = right Y | ||
lift = XBox.getY(); //lift = XBox's main (left) Y axis | ||
|
||
if (XBox.getRawButton(1) && !aClicked) aClicked = true; //If the a button is pressed and it hasn't already been | ||
if (XBox.getRawButton(2) && !bClicked) bClicked = true; //If the b button is pressed and it hasn't already been | ||
if (XBox.getRawButton(4) || (bClicked && aClicked)) { //If the y button is pressed or aClicked and bClicked are true (That's optional) stop cylander | ||
aClicked = false; | ||
bClicked = false; | ||
} | ||
|
||
if (leftStick.getRawButton(1)) { //Saftey mode | ||
leftInput /= 2; | ||
rightInput /= 2; | ||
} | ||
if (rightStick.getRawButton(1)) leftInput = rightInput; //Forward mode | ||
|
||
driveSystem.tankDrive(leftInput, rightInput); | ||
|
||
if (lift != 0) talonLift.set(lift); //Left XBox Y | ||
else talonLift.set(0); | ||
|
||
if (aClicked) armSolenoid.set(DoubleSolenoid.Value.kForward); //A button open | ||
else if (bClicked) armSolenoid.set(DoubleSolenoid.Value.kReverse); //B button close | ||
else armSolenoid.set(DoubleSolenoid.Value.kOff); | ||
} //End teleopPeriodic() | ||
} //End Robot |