public class Shooter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Shooter.FlywheelMode |
static class |
Shooter.IndexerMode |
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_SHOOTING_SPEED |
static double |
DEFAULT_SHOOTING_SPEED_TOLERANCE |
com.qualcomm.robotcore.hardware.DcMotorEx |
flywheel |
Shooter.FlywheelMode |
flywheelMode |
com.qualcomm.robotcore.hardware.Servo |
indexer |
Shooter.IndexerMode |
indexerMode |
static int |
MAX_RPM |
static int |
MAX_TICKS_PER_SEC |
static int |
TICKS_PER_REVOLUTION |
Constructor and Description |
---|
Shooter(DeviceManager deviceManager)
Constructs a
Shooter object
given the robot's device manager |
Modifier and Type | Method and Description |
---|---|
static double |
getShootingSpeed(double percent)
Returns the shooting speed in ticks per second given
a desired percentage of the motor's max speed as a decimal
|
boolean |
isAtTargetVelocity()
Returns
true if the flywheel motor
is at default target velocity (within the default shooting
speed tolerance). |
boolean |
isAtTargetVelocity(double targetVelocityPercent)
Returns
true if the flywheel motor
is at a given target velocity (within the default shooting speed tolerance). |
boolean |
isAtTargetVelocity(double targetVelocityPercent,
double tolerance)
Returns
true if the flywheel motor
is at a given target velocity (within a given shooting
speed tolerance). |
void |
pushRing()
Puts the indexer in SHOOT mode, pushing a ring toward the flywheel
|
void |
readyIndexer()
Puts the indexer in READY mode
|
void |
speedUpFlywheel()
Speeds up the flywheel to the default shooting speed
of 80% of max speed
|
void |
speedUpFlywheel(double percent)
Speeds up the flywheel to a percentage of the
max speed
|
void |
stopFlywheel()
Stops running the flywheel motor
|
public com.qualcomm.robotcore.hardware.DcMotorEx flywheel
public com.qualcomm.robotcore.hardware.Servo indexer
public static final int TICKS_PER_REVOLUTION
public static final int MAX_RPM
public static final int MAX_TICKS_PER_SEC
public Shooter.FlywheelMode flywheelMode
public Shooter.IndexerMode indexerMode
public static final double DEFAULT_SHOOTING_SPEED
public static final double DEFAULT_SHOOTING_SPEED_TOLERANCE
public Shooter(DeviceManager deviceManager)
Shooter
object
given the robot's device managerdeviceManager
- the robot's device managerpublic static double getShootingSpeed(double percent)
percent
- percent of the motor's max speed as a decimalpublic void speedUpFlywheel()
public void speedUpFlywheel(double percent)
percent
- percentage of the max speed as a decimalpublic void stopFlywheel()
public boolean isAtTargetVelocity()
true
if the flywheel motor
is at default target velocity (within the default shooting
speed tolerance).true
if the flywheel motor is at target velocitypublic boolean isAtTargetVelocity(double targetVelocityPercent)
true
if the flywheel motor
is at a given target velocity (within the default shooting speed tolerance).targetVelocityPercent
- target velocity of the flywheel motor, as a percent (decimal) of the max motor speedtrue
if the flywheel motor is at target velocitypublic boolean isAtTargetVelocity(double targetVelocityPercent, double tolerance)
true
if the flywheel motor
is at a given target velocity (within a given shooting
speed tolerance).targetVelocityPercent
- target velocity of the flywheel motor, as a percent (decimal) of the max motor speedtolerance
- target velocity tolerance, as a percent (decimal) of the calculated target velocitytrue
if the flywheel motor is at target velocitypublic void pushRing()
public void readyIndexer()