Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
why isnt anything working graaah
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGamer1002 committed Apr 18, 2023
1 parent c48214c commit 9f72f04
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 196 deletions.
1 change: 1 addition & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ public static final class VisionConstants {
}

public static final String OperatorConstast = null;
public boolean isDriveCommandFinished = false;
}
4 changes: 4 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import frc.robot.commands.*;
import frc.robot.subsystems.*;
Expand Down Expand Up @@ -282,4 +283,7 @@ public void robotPeriodic() {
Logger.updateEntries();
timeWidget.setDouble(DriverStation.getMatchTime());
}



}
10 changes: 9 additions & 1 deletion src/main/java/frc/robot/commands/DriveCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package frc.robot.commands;

import java.security.Guard;

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.Constants;
Expand All @@ -14,6 +16,9 @@ public class DriveCommand extends CommandBase {
@SuppressWarnings({ "PMD.UnusedPrivateField", "PMD.SingularField" })
private final Tank m_drivebase;




public DriveCommand(Tank subsystem) {
m_drivebase = subsystem;
addRequirements(m_drivebase);
Expand All @@ -27,6 +32,7 @@ public void initialize() {
@Override
public void execute() {
// double check getMaxSpeed(), might be wrong

Tank.arcadeDrive(
/* rotation */RobotContainer.getAdjustedTurningStickInput() * Constants.CanConstants.maxSpeed,
/* speed */RobotContainer.getAdjustedForwardStickInput() * 0.7);
Expand All @@ -41,7 +47,9 @@ public void end(boolean interrupted) {

@Override
public boolean isFinished() {
return false;
// we need to return the value in Constants.isDriveCommandFinished but in a static way while keeping the value non-static in Constants
private static final boolean x = Constants.isDriveCommandFinished;
return x;
}

@Override
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/frc/robot/commands/Tracking.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.ParallelDeadlineGroup;

// NOTE: Consider using this command inline, rather than writing a subclass. For more
// information, see:
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
public class Tracking extends ParallelDeadlineGroup {
/** Creates a new Tracking. */
public Tracking() {
// Add the deadline command in the super() call. Add other commands using
// addCommands().
super(new InstantCommand());
// addCommands(new FooCommand(), new BarCommand());
}
}
45 changes: 45 additions & 0 deletions src/main/java/frc/robot/commands/XTracking.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.CommandBase;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import frc.robot.subsystems.Tank;
import frc.robot.subsystems.Tracking.Target;
import frc.robot.RobotContainer;
import frc.robot.commands.*;

public class XTracking extends CommandBase {

private double tx;
/** Creates a new XTracking. */
public XTracking(Tank tank, Target target) {
// Use addRequirements() here to declare subsystem dependencies.
addRequirements(tank, target);
}

// Called when the command is initially scheduled.
@Override
public void initialize() {
// stop the DriveCommand

}

// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
tx = Target.getTX();
}

// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {}

// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}
31 changes: 0 additions & 31 deletions src/main/java/frc/robot/commands/tests/FullTestCommand.java

This file was deleted.

30 changes: 0 additions & 30 deletions src/main/java/frc/robot/commands/tests/TestArmCommand.java

This file was deleted.

27 changes: 0 additions & 27 deletions src/main/java/frc/robot/commands/tests/TestClawCommand.java

This file was deleted.

44 changes: 0 additions & 44 deletions src/main/java/frc/robot/commands/tests/TestDrivebaseCommand.java

This file was deleted.

36 changes: 0 additions & 36 deletions src/main/java/frc/robot/commands/tests/TestTurretCommand.java

This file was deleted.

11 changes: 9 additions & 2 deletions src/main/java/frc/robot/subsystems/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

public class Arm extends SubsystemBase {

public double armToFrontAngle = 3;
public double armToBackAngle = -3;

public CANSparkMax armMotor;
public DigitalInput allTheWayDownRear = new DigitalInput(1);
public double desiredArmAngle;
Expand Down Expand Up @@ -96,11 +99,15 @@ public void moveArm(double value) {
armMotor.set(motorDrive);
}

public void moveArmToZeroDeg() {
}


@Override
public void simulationPeriodic() {
// This method will be called once per scheduler run during simulation
}

public void setArmAngle(double angle) {
desiredArmAngle = angle;
armPID.setReference(angle, CANSparkMax.ControlType.kPosition);
}
}
21 changes: 0 additions & 21 deletions src/main/java/frc/robot/subsystems/Tracking/Arm.java

This file was deleted.

22 changes: 18 additions & 4 deletions src/main/java/frc/robot/subsystems/Tracking/Target.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import frc.robot.LimelightHelpers;

public class Target extends SubsystemBase {
private String name = "limelight";
private static String name = "limelight";
private double tx;
private double ty;
private double ta;
Expand All @@ -36,6 +36,7 @@ public class Target extends SubsystemBase {
private GenericEntry taEntry;
private GenericEntry tclassEntry;
private GenericEntry targetedEntry;
private static LimelightHelpers limelightHelpers = new LimelightHelpers();

/** Creates a new Target. */
public Target() {
Expand Down Expand Up @@ -65,14 +66,27 @@ public Target() {
@Override
public void periodic() {
// This method will be called once per scheduler run
tx = LimelightHelpers.getTX(name);
ty = LimelightHelpers.getTY(name);
ta = LimelightHelpers.getTA(name);
tx = limelightHelpers.getTX(name);
ty = limelightHelpers.getTY(name);
ta = limelightHelpers.getTA(name);
tclass = NetworkTableInstance.getDefault().getTable(name).getEntry("tclass").getDouble(0);

txEntry.setDouble(tx);
tyEntry.setDouble(ty);
taEntry.setDouble(ta);
tclassEntry.setDouble(tclass);
}

public static double getTX() {
return NetworkTableInstance.getDefault().getTable(name).getEntry("tx").getDouble(0);
}
public double getTY() {
return NetworkTableInstance.getDefault().getTable(name).getEntry("ty").getDouble(0);
}
public double getTA() {
return NetworkTableInstance.getDefault().getTable(name).getEntry("ta").getDouble(0);
}
public double getTClass() {
return NetworkTableInstance.getDefault().getTable(name).getEntry("tclass").getDouble(0);
}
}

0 comments on commit 9f72f04

Please sign in to comment.