Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arms_Deployable #3

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/org/wildstang/year2023/robot/CANConstants.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.wildstang.year2023.robot;

import edu.wpi.first.wpilibj.PneumaticsModuleType;

/**
* CAN Constants are stored here.
* We primarily use CAN to communicate with Talon motor controllers.
Expand Down Expand Up @@ -30,6 +32,8 @@ public final class CANConstants {
public static final int ANGLE3 = 16;
public static final int DRIVE4 = 17;
public static final int ANGLE4 = 18;
public static final int INTAKE1 = 0;



}
2 changes: 1 addition & 1 deletion src/main/java/org/wildstang/year2023/robot/WSInputs.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public enum WSInputs implements Inputs {
// ---------------------------------
// Manipulator DPAD Buttons
// ---------------------------------
MANIPULATOR_DPAD_DOWN ("Manipulator dpad down", new WsDPadButtonInputConfig(1, JoystickConstants.DPAD_Y_DOWN)),
MANIPULATOR_DPAD_DOWN ("Toggle deploy and rev intake", new WsDPadButtonInputConfig(1, JoystickConstants.DPAD_Y_DOWN)),
MANIPULATOR_DPAD_LEFT ("Manipulator dpad left", new WsDPadButtonInputConfig(1, JoystickConstants.DPAD_X_LEFT)),
MANIPULATOR_DPAD_RIGHT ("Manipulator dpad right", new WsDPadButtonInputConfig(1, JoystickConstants.DPAD_X_RIGHT)),
MANIPULATOR_DPAD_UP ("Manipulator dpad up", new WsDPadButtonInputConfig(1, JoystickConstants.DPAD_Y_UP)),
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/wildstang/year2023/robot/WSOutputs.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public enum WSOutputs implements Outputs {
ANGLE3("Module 3 Angle Motor", new WsSparkMaxConfig(CANConstants.ANGLE3, true)),
DRIVE4("Module 4 Drive Motor", new WsSparkMaxConfig(CANConstants.DRIVE4, true)),
ANGLE4("Module 4 Angle Motor", new WsSparkMaxConfig(CANConstants.ANGLE4, true)),

INTAKE1("Intake 1 Motor", new WsSparkMaxConfig(CANConstants.INTAKE1, true)),

// ---------------------------------
// Servos
Expand All @@ -57,6 +57,9 @@ public enum WSOutputs implements Outputs {
// Solenoids
// ********************************
TEST_SOLENOID("Test Solenoid", new WsSolenoidConfig(PneumaticsModuleType.REVPH, 0, false)),

DEPLOYABLE1("Deployable 1 Solenoid", new WsSolenoidConfig(PneumaticsModuleType.REVPH, 0, false)),
DEPLOYABLE2("Deployable 2 Solenoid", new WsSolenoidConfig(PneumaticsModuleType.REVPH, 0, false)),

// ********************************
// Relays
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package org.wildstang.year2023.subsystems.Intake;

import org.wildstang.framework.io.inputs.Input;
import org.wildstang.framework.subsystems.Subsystem;
import org.wildstang.hardware.roborio.inputs.WsJoystickButton;
import org.wildstang.hardware.roborio.outputs.WsSolenoid;
import org.wildstang.hardware.roborio.outputs.WsSparkMax;
import org.wildstang.year2023.robot.WSInputs;
import org.wildstang.year2023.robot.WSOutputs;

public class Deployable implements Subsystem {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets call this Intake to be more clear


private WsSparkMax intake1;
private WsJoystickButton deployRevIntake;
private WsSolenoid deployable1;
private WsSolenoid deployable2;

//All variables used
private boolean intakeCall;



@Override
public void inputUpdate(Input source) {
// TODO Auto-generated method stub

if (source == deployRevIntake){
intakeCall = !(intakeCall);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is functionally the same but it could just be !intakeCall

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also have the ability to spin the intake backwards


}
}

@Override
public void init() {
// TODO Auto-generated method stub
intake1 = (WsSparkMax) WSOutputs.INTAKE1.get();

deployRevIntake = (WsJoystickButton) WSInputs.MANIPULATOR_DPAD_DOWN.get();
deployRevIntake.addInputListener(this);

deployable1 = (WsSolenoid) WSOutputs.DEPLOYABLE1.get();
deployable2 = (WsSolenoid) WSOutputs.DEPLOYABLE2.get();

intakeCall = false;

}

@Override
public void selfTest() {
// TODO Auto-generated method stub

}

@Override
public void update() {
// TODO Auto-generated method stub
if (intakeCall){
intake1.setValue(1);
deployable1.setValue(true);
deployable2.setValue(true);
} else {
intake1.setValue(0);
deployable1.setValue(false);
deployable2.setValue(false);
}
}

@Override
public void resetState() {
// TODO Auto-generated method stub
intakeCall = false;

}

@Override
public String getName() {
// TODO Auto-generated method stub
return "Deployable";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this to match the class name and add the class to WSSubsystems

}



}
59 changes: 59 additions & 0 deletions src/main/java/org/wildstang/year2023/subsystems/tankDrive.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package org.wildstang.year2023.subsystems;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you had already committed this, I'll remove it


import org.wildstang.framework.io.inputs.Input;
import org.wildstang.framework.subsystems.Subsystem;
import org.wildstang.hardware.roborio.inputs.WsJoystickAxis;
//import org.wildstang.hardware.roborio.outputs.WsPhoenix;
import org.wildstang.year2023.robot.WSInputs;
import org.wildstang.year2023.robot.WSOutputs;

/**
* Sample Subsystem that controls a motor with a joystick.
* @author Liam
*/
public class tankDrive implements Subsystem {
// inputs
WsJoystickAxis joystick;

// outputs
//WsPhoenix motor;

// states
double speed;


@Override
public void init() {
joystick = (WsJoystickAxis) WSInputs.DRIVER_LEFT_JOYSTICK_Y.get();

//motor = (WsPhoenix) WSOutputs.TEST_MOTOR.get();

speed = 0;
}

@Override
public void resetState() {
speed = 0;
}

@Override
public void update() {
//motor.setValue(speed);
}

@Override
public void inputUpdate(Input source) {
if (source == joystick) {
speed = joystick.getValue();
}
}

@Override
public String getName() {
return "Sample";
}

@Override
public void selfTest() {
}
}