Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 12 additions & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,16 @@ public final class Constants {
public static final double TURN_FACTOR = 0.2;


public static final int BALL_VALUE = 2300;

public static final int BALL_VALUE = 2050;

//Panel Mech
public static final double PANEL_MECH_CREEP = 0.1;
public static final double PANEL_MECH_FAST = 0.5;
public static int PanelNum=2;
public static int SpinNum=0;

//cameras
public static int camnum=0;

}
80 changes: 50 additions & 30 deletions src/main/java/frc/robot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.JoystickButton;

import frc.robot.Autons.ShooterGroupLong;
import frc.robot.Autons.ShooterGroupWall;
import frc.robot.Autons.Stop;
Expand All @@ -14,7 +15,16 @@
import frc.robot.commands.Shooter.CloseHopperPiston;
import frc.robot.commands.Shooter.LongShotHood;


import frc.robot.commands.Shooter.OpenHopperPiston;
import frc.robot.commands.Shooter.RetractHood;
import frc.robot.commands.Shooter.ExtendHood;
import frc.robot.commands.Shooter.MoveShooterWall;
import frc.robot.commands.Shooter.MoveShooterLong;
import frc.robot.commands.setCameraOne;
import frc.robot.commands.setCameraTwo;
import frc.robot.commands.setCameraThree;
import frc.robot.commands.Shooter.CheckHoodWall;
// import frc.robot.commands.auto.SetLimit;
import frc.robot.controller.AnalogButton;
import frc.robot.controller.DPadButton;
Expand All @@ -30,29 +40,29 @@
// import frc.robot.commands.CargoManipulator.ScoreInRocketCalculated;
// import frc.robot.commands.CargoManipulator.ScoreInRocketDropper;
// import frc.robot.commands.auto.AutoSetLifterPots;
// _____
// | |
// | | | |
// |_____|
// ____ ___|_|___ ____
// ()___) ()___)
// // /| |\ \\
// // / | | \ \\
// (___) |___________| (___)
// (___) (_______) (___)
// (___) (___) (___)
// (___) |_| (___)
// (___) ___/___\___ | |
// | | | | | |
// | | |___________| /___\
// /___\ ||| ||| // \\
// // \\ ||| ||| \\ //
// \\ // ||| ||| \\ //
// \\ // ()__) (__()
// /// \\\
// /// \\\
// _///___ ___\\\_
// |_______| |_______|
// _____
// | |
// | | | |
// |_____|
// ____ ___|_|___ ____
// ()___) ()___)
// // /| |\ \\
// // / | | \ \\
// (___) |___________| (___)
// (___) (_______) (___)
// (___) (___) (___)
// (___) |_| (___)
// (___) ___/___\___ | |
// | | | | | |
// | | |___________| /___\
// /___\ ||| ||| // \\
// // \\ ||| ||| \\ //
// \\ // ||| ||| \\ //
// \\ // ()__) (__()
// /// \\\
// /// \\\
// _///___ ___\\\_
// |_______| |_______|

public class OI {
public static Joystick driverStick;
Expand All @@ -70,19 +80,22 @@ public class OI {
private Button driverRX;
protected Button operatorLeftJoystickUsed, operatorRightJoystickUsed, operatorDPadDown, operatorDPadLeft, operatorDPadRight;
private Button operatorA, operatorB, operatorX, operatorY;

public OI() {
driverStick = new Joystick(0);
operatorStick = new Joystick(1);
initButtons();
initUsed();

driveButton.whileHeld(new DriveWithJoystick(driverStick, 0.1)); // TODO CHANGE DEADZONE VALUE IT MIGHT NOT BE THE SAME

//LEAVE OUT driverStart.whileHeld(new ExtendBothLifters(.8,false,driverStick));
driveButton.whileHeld(new DriveWithJoystick(driverStick, 0.1)); // TODO CHANGE DEADZONE VALUE IT MIGHT NOT BE
// THE SAME

// LEAVE OUT driverStart.whileHeld(new ExtendBothLifters(.8,false,driverStick));

//THESE TWO LINES ARE FOR TESTING
//LEAVE OUT driverA.whenPressed(new AutoSetLifterPots());
//LEAVE OUT driverB.whenPressed(new ExtendBothLifters(.8,false,driverStick,false));
// THESE TWO LINES ARE FOR TESTING
// LEAVE OUT driverA.whenPressed(new AutoSetLifterPots());
// LEAVE OUT driverB.whenPressed(new
// ExtendBothLifters(.8,false,driverStick,false));

// driverA.whenPressed(new MoveShooter());
// driverA.whenReleased(new StopShooter());
Expand All @@ -100,12 +113,18 @@ public OI() {

driverB.whenPressed(new OpenHopperPiston());
driverB.whenReleased(new CloseHopperPiston());


driverX.whileHeld(new ExtendPanelMech());
driverY.whileHeld(new SetPanelMech());


// driverRB.whenPressed(new ShooterGroupWall());
// driverRB.whenReleased(new StopShooterGroupWall());


// driverLB.whenReleased(new StopShooterGroupLong());
// driverLB.whenPressed(new runHopperElevator());

operatorDPadLeft.whenPressed(new ShooterGroupLong());
operatorDPadLeft.whenReleased(new Stop());

Expand Down Expand Up @@ -133,6 +152,7 @@ public OI() {




// driverLB.whenReleased(new stopHopperElevator());
// driverLS.whenPressed(new runElevatorShooter());
// driverLS.whenReleased(new stopElevatorShooter());
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ public class Robot extends TimedRobot {
// public static PanelMech panelMech;
public static CameraServer Cam;
public static CameraSwitch Cam_switch;
public static PanelMech panelMech;

@Override
public void robotInit() {
hopper = new Hopper();
shooter = new Shooter();
drivetrain = new Drivetrain();
manipulator = new Manipulator();
// controlPan = new ControlPan();
panelMech = new PanelMech();
pdp = new PowerDistributionPanel(RobotMap.kPDP);
oi = new OI();
robotmap = new RobotMap();
Expand Down Expand Up @@ -81,6 +82,7 @@ public void teleopInit() {
// autoCommand.cancel();
compressor.start();
System.out.println("This is init");



}
Expand All @@ -98,6 +100,7 @@ public void teleopPeriodic() {
// Robot.drivetrain.setLeftTalon(.7);
// Robot.drivetrain.setRightNeo(1);
// 0.5 power is the sweet spot for wall, 0.8 for current at angle of 39 degrees
//Cam_switch.select(CameraSwitch.kcamera1);
Scheduler.getInstance().run();
}
@Override
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/frc/robot/RobotMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,7 @@ public class RobotMap {
public static final int MANIPULATOR_SOLENOID = 6;
public static final int MANIPULATOR_NEO = 40;
public static final int MECHNECK = 50;

//PanelMech
public static final int PANEL_NEO=50;
public static final int PANEL_SOLENOID=2;
}
43 changes: 43 additions & 0 deletions src/main/java/frc/robot/commands/DefaultPanelMech.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package frc.robot.commands;
import frc.robot.Robot;
import edu.wpi.first.wpilibj.command.Command;


public class DefaultPanelMech extends Command {
public DefaultPanelMech() {
super("DefaultPanelMech");

requires(Robot.panelMech);
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
}

// Called just before this Command runs the first time
@Override
protected void initialize() {
}

// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
Robot.panelMech.extendPanelMech(false);

}

// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return false;
}

// Called once after isFinished returns true
@Override
protected void end() {
}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
}
}
55 changes: 55 additions & 0 deletions src/main/java/frc/robot/commands/ExtendPanelMech.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package frc.robot.commands;
import frc.robot.Robot;
import edu.wpi.first.wpilibj.command.Command;
import frc.robot.Constants;



public class ExtendPanelMech extends Command {
public ExtendPanelMech() {
super("ExtendPanelMech");

requires(Robot.panelMech);
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
}

// Called just before this Command runs the first time
@Override
protected void initialize() {
Constants.SpinNum++;
if(Constants.SpinNum==2){
Constants.SpinNum=0;
}
}

// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
if(Constants.SpinNum==0){
Robot.panelMech.extendPanelMech(true);

}
else{
Robot.panelMech.extendPanelMech(false);
}
}

// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return false;
}

// Called once after isFinished returns true
@Override
protected void end() {
Robot.panelMech.extendPanelMech(false);
}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
}
}
46 changes: 46 additions & 0 deletions src/main/java/frc/robot/commands/IntakeOff.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/

package frc.robot.commands;
import frc.robot.Constants;
import edu.wpi.first.wpilibj.command.Command;
import frc.robot.Robot;

public class IntakeOff extends Command {
public IntakeOff() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
}

// Called just before this Command runs the first time
@Override
protected void initialize() {
}

// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
Robot.manipulator.setManipulator(0);
}

// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return false;
}

// Called once after isFinished returns true
@Override
protected void end() {
}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
}
}
44 changes: 44 additions & 0 deletions src/main/java/frc/robot/commands/IntakeOn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/

package frc.robot.commands;

import edu.wpi.first.wpilibj.command.Command;

public class IntakeOn extends Command {
public IntakeOn() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
}

// Called just before this Command runs the first time
@Override
protected void initialize() {
}

// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
}

// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return false;
}

// Called once after isFinished returns true
@Override
protected void end() {
}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
}
}
Loading