Skip to content

Commit

Permalink
shooter shooting (tested)
Browse files Browse the repository at this point in the history
  • Loading branch information
LTeixeira4909 committed Feb 3, 2024
1 parent 601ce36 commit 9d40c52
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 38 deletions.
64 changes: 30 additions & 34 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,47 +131,51 @@ public Robot() {
.leftTrigger()
.whileTrue(new ParallelRaceGroup(m_intake.intake(), m_shooter.Intake()).repeatedly());

// this is here to make the value be editable on the dashboard

SmartDashboard.putNumber("Intake/CurrentStopInput", 10);
m_driverController
.leftTrigger()
.whileTrue(new ParallelRaceGroup(
m_intake.intake(),
m_shooter.Intake()).repeatedly()
.until(() -> {
return m_shooter.getCurrent() > 10;
}));

.whileTrue(
new ParallelRaceGroup(m_intake.intake(), m_shooter.Intake())
.repeatedly()
.until(
() -> {
double defaultIntakeStopCurrent = 10;
return m_shooter.getCurrent()
> SmartDashboard.getNumber(
"Intake/CurrentStopInput", defaultIntakeStopCurrent);
}));
}

public Command SensorIntake() {
final double defaultStopDistance = 35;
SmartDashboard.putNumber(
"StopDistance", defaultStopDistance); // this is here to make the value be editable on
// the dashboard

// this is here to make the value be editable on the dashboard
SmartDashboard.putNumber("StopDistance", defaultStopDistance);
return new ParallelRaceGroup(
new RepeatCommand(m_intake.intake()),
new RepeatCommand(m_shooter.Intake())
.until(
() -> {
return mytimeofflight.getRange() <= SmartDashboard.getNumber("StopDistance", defaultStopDistance);
return mytimeofflight.getRange()
<= SmartDashboard.getNumber("StopDistance", defaultStopDistance);
}));
}

/**
* This function is called every robot packet, no matter the mode. Use this for
* items like
* diagnostics that you want ran during disabled, autonomous, teleoperated and
* test.
* This function is called every robot packet, no matter the mode. Use this for items like
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
*
* <p>
* This runs after the mode specific periodic functions, but before LiveWindow
* and
* <p>This runs after the mode specific periodic functions, but before LiveWindow and
* SmartDashboard integrated updating.
*/
@Override
public void robotPeriodic() {
CommandScheduler.getInstance().run();
m_vision.periodic();
SmartDashboard.putNumber("Distance", mytimeofflight.getRange());
SmartDashboard.putNumber("Intake/Current", m_shooter.getCurrent());
}

@Override
Expand All @@ -183,36 +187,28 @@ public void autonomousInit() {
}

@Override
public void autonomousPeriodic() {
}
public void autonomousPeriodic() {}

@Override
public void teleopInit() {
}
public void teleopInit() {}

@Override
public void teleopPeriodic() {
}
public void teleopPeriodic() {}

@Override
public void disabledInit() {
}
public void disabledInit() {}

@Override
public void disabledPeriodic() {
}
public void disabledPeriodic() {}

@Override
public void testInit() {
}
public void testInit() {}

@Override
public void testPeriodic() {
}
public void testPeriodic() {}

@Override
public void simulationInit() {
}
public void simulationInit() {}

@Override
public void simulationPeriodic() {
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/frc/robot/shooter/Shooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public class Shooter extends SubsystemBase {

private final double InSpeed = -.4;
private final double InSpeed = -1;
private final double OutSpeed = .4;
private final double StopSpeed = 0;
private double defaultDelay = .3;
Expand Down Expand Up @@ -84,7 +84,7 @@ public Command ShooterDelay() {
new RepeatCommand(
new InstantCommand(
() -> {
feeder.set(OutSpeed);
feeder.set(InSpeed);
})));
}

Expand All @@ -97,8 +97,7 @@ public Command Feeder() {
.repeatedly();
}

public double getCurrent(){
public double getCurrent() {
return feeder.getTorqueCurrent().getValue();

}
}

0 comments on commit 9d40c52

Please sign in to comment.