Skip to content

Loading…

Wrote code for bridge balancing piston #8

Merged
merged 3 commits into from

1 participant

@kevinwang
Team 694 — StuyPulse member

No description provided.

@kevinwang
Team 694 — StuyPulse member

Commands should be added to extend and retract the piston.

SE Room Row ... added some commits
@kevinwang kevinwang merged commit 8bc3fa9 into develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 20, 2012
  1. Wrote code for bridge balancing piston

    SE Room Row 6 Computer 1 committed
  2. Add bridge piston subsystem to CommandBase.

    SE Room Row 6 Computer 1 committed
  3. wrote commands for extending/retracting the bridge piston

    SE Room Row 6 Computer 1 committed
View
2 src/edu/stuy/RobotMap.java
@@ -54,6 +54,8 @@
public static final int GEAR_SHIFT_HIGH = 4;
public static final int TUSKS_SOLENOID_RETRACT = 5;
public static final int TUSKS_SOLENOID_EXTEND = 6;
+ public static final int BRIDGE_BALANCING_EXTEND = 7;
+ public static final int BRIDGE_BALANCING_RETRACT = 8;
/* VIRSYSJ */
public static final int[] VIRSYS_OUTPUT_MAP = new int[15];
View
32 src/edu/stuy/commands/BridgePistonExtend.java
@@ -0,0 +1,32 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package edu.stuy.commands;
+
+/**
+ *
+ * @author admin
+ */
+public class BridgePistonExtend extends CommandBase {
+ public BridgePistonExtend() {
+ requires(bridgePiston);
+ }
+
+ protected void initialize() {
+ }
+
+ protected void execute() {
+ bridgePiston.extend();
+ }
+
+ protected boolean isFinished() {
+ return bridgePiston.isExtended();
+ }
+
+ protected void end() {
+ }
+
+ protected void interrupted() {
+ }
+}
View
33 src/edu/stuy/commands/BridgePistonRetract.java
@@ -0,0 +1,33 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package edu.stuy.commands;
+
+/**
+ *
+ * @author admin
+ */
+public class BridgePistonRetract extends CommandBase {
+ public BridgePistonRetract() {
+ requires(bridgePiston);
+ }
+
+ protected void initialize() {
+ }
+
+ protected void execute() {
+ bridgePiston.retract();
+ }
+
+ protected boolean isFinished() {
+ return !bridgePiston.isExtended();
+ }
+
+ protected void end() {
+ }
+
+ protected void interrupted() {
+ }
+
+}
View
3 src/edu/stuy/commands/CommandBase.java
@@ -25,6 +25,7 @@
public static Acquirer acquirer;
public static Conveyor conveyor;
public static Camera camera;
+ public static BridgePiston bridgePiston;
static {
drivetrain = new Drivetrain();
@@ -35,6 +36,7 @@
if (!Devmode.DEV_MODE) {
tusks = new Tusks();
}
+ bridgePiston = new BridgePiston();
}
public static void init() {
@@ -53,6 +55,7 @@ public static void init() {
SmartDashboard.putData(acquirer);
SmartDashboard.putData(conveyor);
SmartDashboard.putData(camera);
+ SmartDashboard.putData(bridgePiston);
}
}
View
41 src/edu/stuy/subsystems/BridgePiston.java
@@ -0,0 +1,41 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package edu.stuy.subsystems;
+
+import edu.stuy.RobotMap;
+import edu.wpi.first.wpilibj.Solenoid;
+import edu.wpi.first.wpilibj.command.Subsystem;
+
+/**
+ *
+ * @author admin
+ */
+public class BridgePiston extends Subsystem {
+ Solenoid PistonExtend;
+ Solenoid PistonRetract;
+
+ public BridgePiston() {
+ PistonExtend = new Solenoid(2, RobotMap.BRIDGE_BALANCING_EXTEND);
+ PistonRetract = new Solenoid(2, RobotMap.BRIDGE_BALANCING_RETRACT);
+ }
+
+ public void initDefaultCommand() {
+
+ }
+
+ public void extend() {
+ PistonExtend.set(true);
+ PistonRetract.set(false);
+ }
+
+ public void retract() {
+ PistonExtend.set(false);
+ PistonRetract.set(true);
+ }
+
+ public boolean isExtended() {
+ return PistonExtend.get();
+ }
+}
Something went wrong with that request. Please try again.