Package frc.robot.subsystems
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 -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the current measured cowl angle.edu.wpi.first.wpilibj2.command.CommandGenerates an autonomous, state-machine style verification routine for this subsystem.edu.wpi.first.wpilibj2.command.Commandhome()Homes the cowl using a standard default threshold (-2.0V, 15.0A).edu.wpi.first.wpilibj2.command.CommandhomeWithCurrent(double homingVoltage, double currentThresholdAmps) Homes the cowl by driving at a constant voltage and checking the stator current.booleanvoidperiodic()voidsetTargetPosition(double positionRads) Commands the cowl to a target angular position using Motion Magic with dynamic feedforward.edu.wpi.first.wpilibj2.command.CommandsysIdDynamic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction direction) Generates a SysId Dynamic characterization command.edu.wpi.first.wpilibj2.command.CommandsysIdQuasistatic(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, setSubsystemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Constructor Details
-
MARSCowl
-
-
Method Details
-
periodic
public void periodic()- Specified by:
periodicin interfaceedu.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:SystemTestableGenerates an autonomous, state-machine style verification routine for this subsystem.- Specified by:
getSystemCheckCommandin interfaceSystemTestable- Returns:
- A command that runs through diagnostic checks and logs results.
-