Class MARSCowl

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

public class MARSCowl extends edu.wpi.first.wpilibj2.command.SubsystemBase implements SystemTestable
High-level subsystem representing the shooter cowl rotating joint.

Handles physics simulation, angular position tracking, and dynamic load shedding to prevent battery brownouts using MARSPowerManager data.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the current measured cowl angle.
    edu.wpi.first.wpilibj2.command.Command
    Generates an autonomous, state-machine style verification routine for this subsystem.
    edu.wpi.first.wpilibj2.command.Command
    Homes the cowl using a standard default threshold (-2.0V, 15.0A).
    edu.wpi.first.wpilibj2.command.Command
    homeWithCurrent(double homingVoltage, double currentThresholdAmps)
    Homes the cowl by driving at a constant voltage and checking the stator current.
    boolean
     
    void
     
    void
    setTargetPosition(double positionRads)
    Commands the cowl to a target angular position using Motion Magic with dynamic feedforward.
    edu.wpi.first.wpilibj2.command.Command
    sysIdDynamic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction direction)
    Generates a SysId Dynamic characterization command.
    edu.wpi.first.wpilibj2.command.Command
    sysIdQuasistatic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction direction)
    Generates a SysId Quasistatic characterization command.

    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, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
  • Constructor Details

  • Method Details

    • periodic

      public void periodic()
      Specified by:
      periodic in interface edu.wpi.first.wpilibj2.command.Subsystem
    • setTargetPosition

      public void setTargetPosition(double positionRads)
      Commands the cowl to a target angular position using Motion Magic with dynamic feedforward.

      The feedforward voltage is computed using the current cowl angle (for gravity compensation) and the instantaneous Motion Magic profile velocity (for kV contribution).

      Parameters:
      positionRads - Target cowl angle in radians.
    • isAtTolerance

      public boolean isAtTolerance()
    • getPositionRads

      public double getPositionRads()
      Returns the current measured cowl angle.
      Returns:
      Current cowl position in radians.
    • sysIdQuasistatic

      public edu.wpi.first.wpilibj2.command.Command sysIdQuasistatic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction direction)
      Generates a SysId Quasistatic characterization command.
      Parameters:
      direction - The direction of the quasistatic routine (Forward/Reverse).
      Returns:
      The SysId Command to execute.
    • sysIdDynamic

      public edu.wpi.first.wpilibj2.command.Command sysIdDynamic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction direction)
      Generates a SysId Dynamic characterization command.
      Parameters:
      direction - The direction of the dynamic routine (Forward/Reverse).
      Returns:
      The SysId Command to execute.
    • homeWithCurrent

      public edu.wpi.first.wpilibj2.command.Command homeWithCurrent(double homingVoltage, double currentThresholdAmps)
      Homes the cowl by driving at a constant voltage and checking the stator current. It resets the encoder to 0.0 radians upon reaching the hard stop.
      Parameters:
      homingVoltage - Voltage to drive the motor (negative for downwards).
      currentThresholdAmps - Stator current threshold (i.e. 30.0).
      Returns:
      The home command.
    • home

      public edu.wpi.first.wpilibj2.command.Command home()
      Homes the cowl using a standard default threshold (-2.0V, 15.0A).
      Returns:
      The home command.
    • getSystemCheckCommand

      public edu.wpi.first.wpilibj2.command.Command getSystemCheckCommand()
      Description copied from interface: SystemTestable
      Generates an autonomous, state-machine style verification routine for this subsystem.
      Specified by:
      getSystemCheckCommand in interface SystemTestable
      Returns:
      A command that runs through diagnostic checks and logs results.