Skip to content

Shooter Mechanism

The Shooter class provided an abstraction layer upon the motor controls for the shooter. In general is is advised to avoid directly controlling motors and use the abstraction layer that Shooter.java provides.

Property Value
Package Path org.firstinspires.ftc.teamcode.systemsControls.Shooter
Type Utility / Subsystem
Argument Type Description
rightShootDrive DcMotorEx Reference to the rightShootDrive motor
leftShootDrive DcMotorEx Reference to the rightShootDrive motor
hoodServo Servo Reference to the servo which controls the angle of the hood
public void update()

Internally updates state as well as confirming RPM readings. Should be called once per loop.

Type Description
void Handles internal updates
public ShooterState getShooterState()

Returns the current state of the shooter.

Type Description
ShooterState Current state of the shooter (IDLE, SPINNING_UP, READY, or FIRED).

public void spinUp(float RPM)

Begins spinning the flywheel toward the requested RPM.

Name Type Description
RPM float Target flywheel RPM.
Type Description
void Starts accelerating the shooter.

public void spinUpByDistance(float distance)

Calculates the required RPM based on the supplied target distance and begins spinning the shooter.

Name Type Description
distance float Distance to the target.
Type Description
void Calculates and applies a target RPM.

public void spinUp(AprilTags tag)

Calculates the distance from the robot to an AprilTag and automatically spins the shooter to the appropriate RPM.

Name Type Description
tag AprilTags Target AprilTag.
Type Description
void Calculates the distance and begins spinning the shooter.

public void spinDown()

Stops both shooter motors and returns the shooter to the idle state.

Type Description
void Stops the shooter.

public void fire()

Marks the shooter as having fired. This is primarily used for shooter state tracking while the firing mechanism is implemented.

Type Description
void Updates the shooter state.

public void setMotorSpeed(float targetRPM)

Sets the shooter motor speed while automatically compensating for battery voltage.

Name Type Description
targetRPM float Desired flywheel RPM.
Type Description
void Applies the requested motor speed.

public void setHoodPosition(float position)

Moves the hood servo to the specified servo position.

Name Type Description
position float Servo position between the configured minimum and maximum limits.
Type Description
void Updates the hood position.

public void setLaunchAngle(float angle)

Sets the desired launch angle of the shooter. Internally converts the launch angle into the corresponding hood servo position.

Name Type Description
angle float Desired launch angle.
Type Description
void Updates the hood angle.

public void setTargetRPM(double targetRPM)

Updates the shooter’s target RPM if the shooter is currently active.

Name Type Description
targetRPM double Desired shooter RPM.
Type Description
void Updates the RPM when applicable.

public void setTargetRPM(double targetRPM, boolean force)

Updates the shooter RPM regardless of its current operating state.

Name Type Description
targetRPM double Desired shooter RPM.
force boolean Included for API compatibility. Forces the RPM update.
Type Description
void Applies the requested RPM.

public void startAuotmaticTargeting()

Enables automatic shooter targeting. While enabled, the shooter continuously recalculates its target RPM based on the detected target distance.

Type Description
void Enables automatic targeting mode.

Note: The method name contains a typo (Auotmatic) and should be called exactly as shown.


public void endAutomaticTargeting()

Disables automatic targeting and returns the shooter to manual mode.

Type Description
void Enables manual targeting mode.

public float getHoodAngle()

Returns the current hood servo position.

Type Description
float Current hood position.

public float getLaunchAngle()

Returns the current calculated launch angle.

Type Description
float Current launch angle.

public targetingMode getShooterMode()

Returns the current targeting mode.

Type Description
targetingMode Current targeting mode (AUTO or MANUEL).

public double getRPM()

Returns the average RPM of the left and right shooter motors.

Type Description
double Average measured shooter RPM.

public double getTargetRPM()

Returns the currently requested shooter RPM.

Type Description
double Current target RPM.

public static float getBareMotorDPS(float targetRPM)

Converts a desired bare motor RPM into the degrees-per-second value expected by the FTC SDK’s setVelocity() method.

This method exists because the gearbox has been removed from the motor, causing its actual encoder resolution to differ from what the SDK expects.

Name Type Description
targetRPM float Desired bare motor RPM.
Type Description
float Equivalent velocity in degrees per second.

Value Description
IDLE Shooter is stopped.
SPINNING_UP Flywheel is accelerating toward the target RPM.
READY Flywheel has reached the target RPM and is ready to fire.
FIRED The shooter has recently fired and is recovering.
Value Description
AUTO Target RPM is automatically calculated from the detected target distance.
MANUEL Target RPM is controlled manually by user code.