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

Added shooter commands and constants #4

Merged
merged 4 commits into from
Jan 22, 2025
Merged
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
25 changes: 0 additions & 25 deletions src/main/java/com/stuypulse/robot/commands/DoNothingCommand.java
Original file line number Diff line number Diff line change
@@ -1,25 +0,0 @@
/************************ PROJECT PHIL ************************/
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved.*/
/* This work is licensed under the terms of the MIT license. */
/**************************************************************/

package com.stuypulse.robot.commands;

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

/*-
* This command does a whole load of nothing...
*
* @author Ivan Chen
*/
public class DoNothingCommand extends InstantCommand {

public DoNothingCommand() {
// Do loads of nothing
}

@Override
public void initialize() {
// Do loads of nothing
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.stuypulse.robot.commands.shooter;

import com.stuypulse.robot.subsystems.shooter.Shooter;


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

public class ShooterShoot extends InstantCommand {
private final Shooter shooter;

public ShooterShoot() {
shooter = Shooter.getInstance();
addRequirements(shooter);
}

@Override
public void initialize() {
shooter.shoot();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.stuypulse.robot.commands.shooter;

import com.stuypulse.robot.subsystems.shooter.Shooter;

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

public class ShooterStop extends InstantCommand {
private final Shooter shooter;

public ShooterStop() {
shooter = Shooter.getInstance();
addRequirements(shooter);
}

@Override
public void initialize() {
shooter.stop();
}
}
7 changes: 6 additions & 1 deletion src/main/java/com/stuypulse/robot/constants/Ports.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public interface Gamepad {
int DEBUGGER = 2;
}

public interface Shooter {
int SHOOTER_MOTOR = 0;
}

public interface Elevator {
int LEFT = 0;
int RIGHT = 1;
Expand All @@ -23,4 +27,5 @@ public interface Algae {
int ROLLER_ID = 0; // update ports later -- def won't be 0
int PIVOT_ID = 1; // update ports later
}
}
}

1 change: 0 additions & 1 deletion src/main/java/com/stuypulse/robot/constants/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public interface FF {
SmartNumber kG = new SmartNumber("kG", 0.37);
}
}
}

public interface Algae {
double RAISED_ANGLE = 0.0; // CHANGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

public class AlgaeImpl extends Algae {

// variable declaration


// variable declaration
private SparkMax pivotMotor;
private SparkMax rollerMotor;

Expand Down
36 changes: 36 additions & 0 deletions src/main/java/com/stuypulse/robot/subsystems/shooter/Shooter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.stuypulse.robot.subsystems.shooter;
import com.revrobotics.spark.SparkMax;
import com.revrobotics.spark.SparkLowLevel.MotorType;
import com.stuypulse.robot.constants.Ports;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

public class Shooter extends SubsystemBase {
private static final Shooter instance;

static {
instance = new Shooter();
}

public static Shooter getInstance() {
return instance;
}

private final SparkMax shooterMotor;

public Shooter(){
super();
shooterMotor = new SparkMax(Ports.Shooter.SHOOTER_MOTOR, MotorType.kBrushless);
}

public void shoot() {
shooterMotor.set(1);
}

public void stop(){
shooterMotor.set(0);
}

@Override
public void periodic() {
}
}
Loading