Class Cannon

java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.robot.subsystems.Cannon
All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable, edu.wpi.first.wpilibj2.command.Subsystem

public class Cannon extends edu.wpi.first.wpilibj2.command.SubsystemBase
The Subsystem class representing the cannon.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    com.revrobotics.CANSparkMax
     
    edu.wpi.first.wpilibj.Solenoid
     
    edu.wpi.first.wpilibj.Solenoid
     
    edu.wpi.first.wpilibj.Solenoid
     
    boolean
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Cannon
     
    double
    Returns the vertical angle of the cannon.
    void
    moveAngle(double amount)
    Changes the vertical angle of the cannons based on a double.
    void
    Runs constantly, checks if the cannon related pressed down and runs the relevant functions; Checks cannon angle.
    void
    resetEncoder(double setpoint)
    Sets the vertical angle of the cannons based on a double parameter.
    double
    Runs when the robot starts to set setpoint to the current angle; This prevents the robot from attempting to return to the angle it was set to before it was turned off.
    void
    setValves(boolean v1, boolean v2, boolean v3)
    Actuate valves based on boolean input
    void
    shoot(boolean v1, boolean v2, boolean v3)
    Shoots the cannons based on the boolean parameters.
    void
    shoot(int num)
    Manual Override: Shoots one cannon or all, based on an integer; Shoots all on -1.

    Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase

    addChild, getName, getSubsystem, initSendable, setName, setSubsystem

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem

    defer, getCurrentCommand, getDefaultCommand, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd
  • Field Details

    • m_pM

      public com.revrobotics.CANSparkMax m_pM
    • m_v1

      public edu.wpi.first.wpilibj.Solenoid m_v1
    • m_v2

      public edu.wpi.first.wpilibj.Solenoid m_v2
    • m_v3

      public edu.wpi.first.wpilibj.Solenoid m_v3
    • override

      public boolean override
  • Method Details

    • getInstance

      public static Cannon getInstance()
    • setValves

      public void setValves(boolean v1, boolean v2, boolean v3)
      Actuate valves based on boolean input
      Parameters:
      v1 - State of valve 1
      v2 - State of valve 2
      v3 - State of valve 3
    • shoot

      public void shoot(boolean v1, boolean v2, boolean v3)
      Shoots the cannons based on the boolean parameters.
      Parameters:
      v1 -
      v2 -
      v3 -
    • shoot

      public void shoot(int num)
      Manual Override: Shoots one cannon or all, based on an integer; Shoots all on -1.
      Parameters:
      num -
    • moveAngle

      public void moveAngle(double amount)
      Changes the vertical angle of the cannons based on a double.
      Parameters:
      amount -
    • setPitch

      public double setPitch()
      Runs when the robot starts to set setpoint to the current angle; This prevents the robot from attempting to return to the angle it was set to before it was turned off.
      Returns:
    • resetEncoder

      public void resetEncoder(double setpoint)
      Sets the vertical angle of the cannons based on a double parameter.
      Parameters:
      setpoint -
    • getPitch

      public double getPitch()
      Returns the vertical angle of the cannon.
      Returns:
    • periodic

      public void periodic()
      Runs constantly, checks if the cannon related pressed down and runs the relevant functions; Checks cannon angle.