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
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
}
},
"extensions.ignoreRecommendations": true
"extensions.ignoreRecommendations": true
}
5 changes: 5 additions & 0 deletions PathWeaver/Paths/1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
X,Y,Tangent X,Tangent Y,Fixed Theta,Name
3.2232858272832465,-2.400719053109834,-2.312694921266794,-0.03434695427623957,true,
6.074083032211126,-0.7406162630915906,1.3967761405670727,0.08014289331122548,true,
7.9860634869217915,-0.9123510344727883,-1.534163957672031,-1.0647555825634245,true,
3.131693949213274,-3.3738827576032864,-2.8507972049278787,0.744184009318523,true,
5 changes: 5 additions & 0 deletions PathWeaver/Paths/2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
X,Y,Tangent X,Tangent Y,Fixed Theta,Name
3.1774898882482607,-2.549555854973538,0.6640411160072963,-0.22897969517493033,true,
5.776409428483716,-3.9005360565056257,0.24042867993367611,-0.6182451769723114,true,
5.6161236418612654,-4.198209660233033,-0.7899799483535093,0.12593883234621028,true,
3.1087959796957816,-3.6028624527782167,-2.4615317231304985,0.858673856905988,true,
5 changes: 5 additions & 0 deletions PathWeaver/Paths/3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
X,Y,Tangent X,Tangent Y,Fixed Theta,Name
3.246183796800739,-2.41216803786858,-2.427184768854258,-0.011448984758746672,true,
5.776409428483716,-3.7631482394006674,0.2862246189686637,-0.652592131248551,true,
5.696266535172491,-4.4729852944429505,-1.6257558357420034,0.3434695427623957,true,
3.131693949213274,-3.728801285124428,-2.713409387822921,1.213592384427129,true,
5 changes: 5 additions & 0 deletions PathWeaver/Paths/4
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
X,Y,Tangent X,Tangent Y,Fixed Theta,Name
3.0973469949370354,-2.4808619464210593,-2.3470418755430336,0.03434695427623957,true,
3.2232858272832465,-1.8397187999312548,1.4654700491195523,-0.011448984758746672,true,
6.3259606969035485,-2.0114535713124524,3.446144412382699,-0.3091225884861557,true,
13.733453835812538,-2.67549468731975,1.8661845156756787,0.0686939085524787,true,
1 change: 1 addition & 0 deletions PathWeaver/output/1.wpilib.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions PathWeaver/output/2.wpilib.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions PathWeaver/output/3.wpilib.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions PathWeaver/output/4.wpilib.json

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions PathWeaver/pathweaver.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"lengthUnit": "Meter",
"exportUnit": "Always Meters",
"maxVelocity": 0.5,
"maxAcceleration": 0.5,
"wheelBase": 0.5,
"gameName": "Infinite Recharge",
"outputDir": ""
}
22 changes: 13 additions & 9 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

public class Constants
{
public final static int LF_MOTOR_ID = 1;
public final static int LB_MOTOR_ID = 2;
public final static int RF_MOTOR_ID = 3;
public final static int RB_MOTOR_ID = 4;

public final static int FEEDER_MOTOR_ID = 5;
public final static int CONTROL_MOTOR_ID = 6;
public final static int INTAKE_MOTOR_ID = 7;
public final static int LIFT_MOTOR_ID = 8;
public final static int SHOOTER_MOTOR_ID = 9;
public static final int LF_MOTOR_ID = 0;
public static final int INTAKE_MOTOR_ID = 3;
public static final int LM_MOTOR_ID = 4;
public static final int LB_MOTOR_ID = 5;
public static final int RF_MOTOR_ID = 6;
public static final int RM_MOTOR_ID = 7;
public static final int RB_MOTOR_ID = 8;
public static final int RIGHT_LIFT_MOTOR_ID = 9;
public static final int LEFT_LIFT_MOTOR_ID = 10;
public static final int SHOOTER_LIFT_MOTOR_ID = 11;
public static final int LEFT_SHOOTER_MOTOR_ID = 12;
public static final int RIGHT_SHOOTER_MOTOR_ID = 13;
public static final int RAMP_MOTOR_ID = 14;
}
105 changes: 70 additions & 35 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,81 @@
/* the project. */
/*----------------------------------------------------------------------------*/

// Names:
/*
Jacob Lewis
Zane Badgett
Joshua P
Arrio Gonsalves
Zayaan Rahman
Neeka Lin
Gabriel Rivera
Fernando Tovar
Matthew Metta
*/


package frc.robot;

import edu.wpi.first.wpilibj.*;

import edu.wpi.first.wpilibj.SpeedControllerGroup;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;

import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.GenericHID.Hand;
import static edu.wpi.first.wpilibj.GenericHID.Hand.*;
import frc.robot.subsystems.*;

public class Robot extends TimedRobot
{
XboxController operatorController = new XboxController(1);
XboxController driverController = new XboxController(0);

Intake intaker = new Intake();
Limelight ll = new Limelight();
Drivetrain dt = new Drivetrain(ll);
Lift lift = new Lift();
Ramp r = new Ramp();
Shooter shooter = new Shooter();

@Override
public void teleopPeriodic()
{
//Manages intake components
if (operatorController.getAButton())
intaker.IntakeStart();
else
intaker.IntakeStop();

//Slows down if holding trigger
if(driverController.getBumper(kLeft))
dt.driveSlow(driverController.getY(kLeft), -driverController.getX(kRight));
else
dt.drive(driverController.getX(kLeft), -driverController.getX(kRight));

if(operatorController.getPOV() == 0)
lift.raiseLift();
else if(operatorController.getPOV() == 180)
lift.lowerLift();
else
lift.stopLift();

if(driverController.getBumper(kRight))
r.pushTime(0.5, 2.0);

if(operatorController.get/**button */)
shooter.liftShooter();
else
shooter.lowerShooter();
//cuz i feel lik one button should both lift n shoot u know? //ok lets go back to Shooter.java or not idk
//le ts do ii m yea, we need some method to like determine when to lift then shoot, all in one button though
//this is fancy timer stuff right.imma rewatch the vidwait
//same ok
//what is the difference between lift motor and shoot motor:: lift brings it at the angle
//ok how about we find when the lift stops lifting, and gets to the desired angle, then shoot
//we could do psuedo code for the time and bs it
//so doesnt limelight determine the angle to lift to

/** PSEUDO CODE:
we need to figure out how to use limelight with the lift
angle = getTy() <-- this is the angle the lift motor will lift to
does the angle it needs to lift to not vary
it does, that's why we need the limelight
oh



public class Robot extends TimedRobot {
private static PWMVictorSPX lf = new PWMVictorSPX(Constants.LF_MOTOR_ID);
private static PWMVictorSPX lb = new PWMVictorSPX(Constants.LB_MOTOR_ID);
private static PWMVictorSPX rf = new PWMVictorSPX(Constants.RF_MOTOR_ID);
private static PWMVictorSPX rb = new PWMVictorSPX(Constants.RB_MOTOR_ID);

private static SpeedControllerGroup leftSide = new SpeedControllerGroup(lf, lb);
private static SpeedControllerGroup rightSide = new SpeedControllerGroup(rf, rb);
yea MOVE TO SHOOOTER CLASS EVERYONE

DifferentialDrive dt = new DifferentialDrive(leftSide, rightSide);
XboxController driverController = new XboxController(0);

*/
if(operatorController.getBButton())
shooter.shoot();

else
shooter.stop();

@Override
public void teleopPeriodic()
{
dt.arcadeDrive(driverController.getY(Hand.kLeft), driverController.getX(Hand.kRight));
}
}
}
5 changes: 0 additions & 5 deletions src/main/java/frc/robot/subsystems/ControlPanel.java

This file was deleted.

49 changes: 49 additions & 0 deletions src/main/java/frc/robot/subsystems/Drivetrain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package frc.robot.subsystems;

import static com.revrobotics.CANSparkMaxLowLevel.MotorType.*;

import com.revrobotics.CANEncoder;
import com.revrobotics.CANPIDController;
import com.revrobotics.CANSparkMax;
import edu.wpi.first.wpilibj.geometry.Pose2d;
import edu.wpi.first.wpilibj.SpeedControllerGroup;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import edu.wpi.first.wpilibj.geometry.Rotation2d;
import edu.wpi.first.wpilibj.kinematics.*;
import edu.wpi.first.wpilibj.interfaces.Gyro;
import edu.wpi.first.wpilibj.ADXRS450_Gyro;
import edu.wpi.first.wpilibj.trajectory.Trajectory;
import edu.wpi.first.wpilibj.trajectory.TrajectoryUtil;



import frc.robot.Constants;

public class Drivetrain
{
private static CANSparkMax lf = new CANSparkMax(Constants.LF_MOTOR_ID, kBrushless);
private static CANSparkMax lm = new CANSparkMax(Constants.LM_MOTOR_ID, kBrushless);
private static CANSparkMax lb = new CANSparkMax(Constants.LB_MOTOR_ID, kBrushless);
private static CANSparkMax rf = new CANSparkMax(Constants.RF_MOTOR_ID, kBrushless);
private static CANSparkMax rm = new CANSparkMax(Constants.RM_MOTOR_ID, kBrushless);
private static CANSparkMax rb = new CANSparkMax(Constants.RB_MOTOR_ID, kBrushless);

private static SpeedControllerGroup leftSide = new SpeedControllerGroup(lb, lm, lf);
private static SpeedControllerGroup rightSide = new SpeedControllerGroup(rb, rm, rf);

DifferentialDrive dt = new DifferentialDrive(leftSide, rightSide);
Limelight limelight;

public Drivetrain(Limelight limelight) {
this.limelight = limelight;
dt.setMaxOutput(0.5);
}

public void drive(double xSpeed, double zRotation) {
dt.arcadeDrive(xSpeed, zRotation);
}

public void driveSlow(double xSpeed, double zRotation){
drive(0.5 * xSpeed, zRotation);
}
}
5 changes: 0 additions & 5 deletions src/main/java/frc/robot/subsystems/Feeder.java

This file was deleted.

26 changes: 25 additions & 1 deletion src/main/java/frc/robot/subsystems/Intake.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
package frc.robot.subsystems;

public class Intake {
import static com.revrobotics.CANSparkMaxLowLevel.MotorType.*;

import com.revrobotics.CANSparkMax;
import frc.robot.Constants;


public class Intake
{
//TODO: use talonsrx (@josh add vendordep talonsrx)
CANSparkMax intakeMotor;

//constructor
public Intake()
{
intakeMotor = new CANSparkMax(Constants.INTAKE_MOTOR_ID, kBrushless);
}

public void IntakeStart()
{
intakeMotor.set(0.5);
}

public void IntakeStop()
{
intakeMotor.set(0);
}
}
25 changes: 24 additions & 1 deletion src/main/java/frc/robot/subsystems/Lift.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
package frc.robot.subsystems;

public class Lift {
import static com.revrobotics.CANSparkMaxLowLevel.MotorType.*;

import com.revrobotics.CANSparkMax;
import frc.robot.Constants;

public class Lift
{
CANSparkMax motorLeft = new CANSparkMax(Constants.LEFT_LIFT_MOTOR_ID, kBrushless);
CANSparkMax motorRight = new CANSparkMax(Constants.RIGHT_LIFT_MOTOR_ID,kBrushless);

public void raiseLift()
{
motorLeft.set(0.5);
motorRight.set(0.5);
}
public void lowerLift()
{
motorLeft.set(-0.5);
motorRight.set(-0.5);
}
public void stopLift()
{
motorLeft.set(0);
motorRight.set(0);
}
}
78 changes: 78 additions & 0 deletions src/main/java/frc/robot/subsystems/Limelight.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package frc.robot.subsystems;

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableInstance;

public class Limelight {

// PUBLIC METHODS:
NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight");
NetworkTableEntry tx = table.getEntry("tx");
NetworkTableEntry ty = table.getEntry("ty");
NetworkTableEntry ta = table.getEntry("ta");
NetworkTableEntry tv = table.getEntry("tv");

double x = tx.getDouble(0.0);
double y = ty.getDouble(0.0);
double area = ta.getDouble(0.0);
boolean v = tv.getBoolean(false);

// getTv()
public boolean getTv(){
return v;
}

// getTx()
public double getTx(){
return x;
}

// getTy()
public double getTy() {
return y;
}

// getTa()
public double getTa(){
return area;
}

public void Update() {
x = tx.getDouble(0.0);
y = ty.getDouble(0.0);
area = ta.getDouble(0.0);
v = tv.getBoolean(false);
}

public void shuffleboardUpdate() {
SmartDashboard.putNumber("LimelightX", x);
SmartDashboard.putNumber("LimelightY", y);
SmartDashboard.putNumber("LimelightArea", area);
SmartDashboard.putBoolean("LimelightV",v);

}

public void toggleLimelightLED() {
if(table.getEntry("ledMode").getDouble(1) == 1 ) //Light is off
{
table.getEntry("ledMode").setNumber(3); //Turn it on
}
else
{
table.getEntry("ledMode").setNumber(1); //Turn it off
}
}

public void toggleLimelightBlinkLED(){
if(table.getEntry("ledMode").getDouble(2) == 2 ) //Light is off
{
table.getEntry("ledMode").setNumber(1); //Turn it off
}
else
{
table.getEntry("ledMode").setNumber(2); //Turn it on
}
}
}
Loading