Skip to content

Commit

Permalink
Only shoots when frisbee is loaded and has fine control toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
keco185 committed Oct 23, 2013
1 parent 39187a5 commit ba249f4
Show file tree
Hide file tree
Showing 11 changed files with 330 additions and 304 deletions.
Binary file modified build/app.jar
Binary file not shown.
Binary file modified build/suite/image.suite
Binary file not shown.
Binary file modified build/suite/image.suite.metadata
Binary file not shown.
601 changes: 302 additions & 299 deletions build/suite/image.sym

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/org/team484/frisbeebot/OI.java
Expand Up @@ -21,12 +21,16 @@ public class OI {
Button j1b2 = new JoystickButton(stick2, 2);
Button j1b3 = new JoystickButton(stick2, 3);
Button j1b8 = new JoystickButton(stick1, 8);
Button j0b1 = new JoystickButton(stick1, 1);
public double getStick1X() {
return stick1.getX();
}
public double getStick1Y() {
return stick1.getY();
}
public boolean fineControl() {
return j0b1.get();
}
//// CREATING BUTTONS
// One type of button is a joystick button which is any button on a joystick.
// You create one by telling it which joystick it's on and which button
Expand Down
3 changes: 2 additions & 1 deletion src/org/team484/frisbeebot/commands/CommandBase.java
Expand Up @@ -19,9 +19,10 @@ public abstract class CommandBase extends Command {
public static OI oi;
// Create a single static instance of all of your subsystems
public static Drive drive = new Drive();
public static SolenoidSub solenoidsub = new SolenoidSub();
public static Shooter shooter = new Shooter();
public static Feeder feeder = new Feeder();
public static SolenoidSub solenoidsub = new SolenoidSub(feeder);

public static void init() {
// This MUST be here. If the OI creates Commands (which it very likely
// will), constructing it during the construction of CommandBase (from
Expand Down
Expand Up @@ -22,7 +22,7 @@ protected void initialize() {

// Called repeatedly when this Command is scheduled to run
protected void execute() {
drive.driveWithJoysticks(oi.getStick1X(), oi.getStick1Y());
drive.driveWithJoysticks(oi.getStick1X(), oi.getStick1Y(), oi.fineControl());
}

// Make this return true when this Command no longer needs to run execute()
Expand Down
7 changes: 6 additions & 1 deletion src/org/team484/frisbeebot/subsystems/Drive.java
Expand Up @@ -16,6 +16,7 @@ public class Drive extends Subsystem {
// Put methods for controlling this subsystem
// here. Call these from Commands.
RobotDrive robotDrive = new RobotDrive(1, 3, 2, 4);
double stick = 0;
public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
Expand All @@ -27,7 +28,11 @@ public void driveForward() {
public void driveDoNothing() {
robotDrive.drive(0, 0);
}
public void driveWithJoysticks(double x, double y) {
public void driveWithJoysticks(double x, double y, boolean fineControl) {
if (fineControl) {
y = (y / 10);
}
robotDrive.arcadeDrive(y, x);

}
}
3 changes: 3 additions & 0 deletions src/org/team484/frisbeebot/subsystems/Feeder.java
Expand Up @@ -39,4 +39,7 @@ public boolean checkFeeder() {
public void fixFeeder() {
talon.set(0);
}
public boolean getIR() {
return ir.get();
}
}
3 changes: 3 additions & 0 deletions src/org/team484/frisbeebot/subsystems/Shooter.java
Expand Up @@ -22,10 +22,13 @@ public Shooter()
try {
jaguar1 = new CANJaguar(1);
jaguar2 = new CANJaguar(2);
//jaguar1.setVoltageRampRate(0.1);
//jaguar2.setVoltageRampRate(0.1);
} catch(Exception e) {
System.out.println(e.getMessage());
}
}

public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
Expand Down
11 changes: 9 additions & 2 deletions src/org/team484/frisbeebot/subsystems/SolenoidSub.java
Expand Up @@ -4,6 +4,7 @@
*/
package org.team484.frisbeebot.subsystems;

import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.command.Subsystem;
import org.team484.frisbeebot.commands.SolenoidOff;
Expand All @@ -17,6 +18,10 @@ public class SolenoidSub extends Subsystem {
// here. Call these from Commands.
Solenoid solenoid1 = new Solenoid(1);
Solenoid solenoid2 = new Solenoid(2);
Feeder feeder;
public SolenoidSub(Feeder feeder) {
this.feeder = feeder;
}
public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
Expand All @@ -27,8 +32,10 @@ public void solenoidOut() {
solenoid2.set(true);
}
public void solenoidIn() {
solenoid1.set(true);
solenoid2.set(false);
if (!solenoid1.get() && feeder.getIR()) {
solenoid1.set(true);
solenoid2.set(false);
}
}
public void solenoidOff() {
solenoid1.set(false);
Expand Down

0 comments on commit ba249f4

Please sign in to comment.