Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shooter commands #8

Open
wants to merge 102 commits into
base: testing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 94 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
c16f84b
add branch plans summary in Shoot.java
Exr0n Jan 20, 2020
81d7450
indexer notes and plan for this class.
Exr0n Jan 20, 2020
64d77ea
add summary for intake class.
Exr0n Jan 20, 2020
8ba0ee3
preliminary Indexer class complete.
Exr0n Jan 20, 2020
92f22cb
preliminary Intake.java
Exr0n Jan 20, 2020
d0a3fa7
rename methods; move default numbers to variables
Exr0n Jan 20, 2020
564d95e
Remove funnel and lift motors from the Intake class
Exr0n Jan 20, 2020
dee813c
responding to pr comments
Exr0n Jan 20, 2020
4466882
delete redundant start() method
Exr0n Jan 20, 2020
106a003
Merge pull request #3 from RoboticsTeam4904/intake
NikhilSuresh24 Jan 20, 2020
54c8acb
change static var naming convention to all caps
Exr0n Jan 20, 2020
6b5a38a
delete indexrenotes
Exr0n Jan 20, 2020
b3ff845
responding to pr comments
Exr0n Jan 20, 2020
d7c2cda
Merge pull request #4 from RoboticsTeam4904/indexer
NikhilSuresh24 Jan 20, 2020
8185448
remove limit switch from Indexer; WIP indexONe
Exr0n Jan 21, 2020
3a82edb
wip extendFlippers; deprecate indexer.java
Exr0n Jan 21, 2020
318cd2e
Added onto Albert's original code with some more piston stuff.
Darrow8 Jan 23, 2020
1b61489
Partial Flywheel implementation
BenCantCode Jan 23, 2020
f2f24ba
Albert's shooter code copied and pasted
Darrow8 Jan 24, 2020
fd35775
update `standard` submodule ref; replace flywheel
Exr0n Jan 24, 2020
b098fdf
remove uneeded docstrings; remove indexer deprecation
Exr0n Jan 24, 2020
2e68936
revert intake to original merged code
Exr0n Jan 24, 2020
9727dca
convert indexer.java to new OOP system
Exr0n Jan 24, 2020
f750125
update Intake.java for new OOP model
Exr0n Jan 24, 2020
5fbf836
Update Shooter.java
Pixlskull Jan 24, 2020
36f80d8
Nick and Darrow worked on retract and extend intake commands
Darrow8 Jan 24, 2020
5d4a445
Merge branch 'shooter-commands' of https://github.com/RoboticsTeam490…
Darrow8 Jan 24, 2020
65f1d1f
remove unecessary semicolon in Shooter.java
Exr0n Jan 24, 2020
b2c3342
update Flywheel.java for standard integration
Exr0n Jan 25, 2020
8a306f5
add ExtendIntake.java boilerplate
Exr0n Jan 25, 2020
895f2c3
add boilerplate for intake solenoid commands
Exr0n Jan 25, 2020
b7ac2bc
create FlywheelSpinUp; update method names
Exr0n Jan 25, 2020
eafdff7
update Flywheel.java; create FlywheelSpinDown command
Exr0n Jan 25, 2020
04a80f1
Add AimHigh, AimLow, Shooter change to public
Jan 25, 2020
f39b159
Add intake commands
BenCantCode Jan 25, 2020
0d5bedd
Merge branch 'shooter-commands' of https://github.com/RoboticsTeam490…
BenCantCode Jan 25, 2020
b956594
update subsystems
Exr0n Jan 25, 2020
767e994
Merge outtake speed constants; make constants public
Exr0n Jan 25, 2020
034fabb
Aim High and Aim Low and changed shooter visibility
Jan 25, 2020
5dc651d
Fix requirements for runintake and outtake
BenCantCode Jan 25, 2020
8e223de
Merge branch 'shooter-commands' of https://github.com/RoboticsTeam490…
BenCantCode Jan 25, 2020
85e69d0
add flipper commands, IndexOne is incomplete
Pixlskull Jan 25, 2020
66c8cc9
notworking
Numdoc Jan 25, 2020
6dadfb2
Merge branch 'shooter-commands' of https://github.com/RoboticsTeam490…
Numdoc Jan 25, 2020
d4458bc
Check flywheel speeds to start indexer
Jan 25, 2020
17df07d
fixed merge conflicts
Jan 25, 2020
d4a2bf9
renaming and fixing errors
NikhilSuresh24 Jan 28, 2020
d26112e
minor commands overhaul
Exr0n Jan 30, 2020
ec6fa20
remove uneeded addRequirements from IndexOne
Exr0n Jan 30, 2020
b09f3dd
add logic for shoot command, still in progress
isaanca Jan 30, 2020
76515c2
merge something?
isaanca Jan 30, 2020
9ca9c14
write Shoot.java
Exr0n Jan 31, 2020
f1399b4
final checks before pr
Exr0n Jan 31, 2020
57a0820
write BoxShot.java
Exr0n Jan 31, 2020
dd60f57
create nice constructors for Flywheel.java
Exr0n Jan 31, 2020
a3a9b4b
bad code, ignore that red line overthere (robotmap)
Exr0n Jan 31, 2020
71f93ee
respond to pr comments
Exr0n Jan 31, 2020
8d55876
Merge branch 'testing' into shooter-commands
NikhilSuresh24 Jan 31, 2020
020561a
Rewrite commands to use standard properly
Exr0n Jan 31, 2020
42d1161
changed a port value from 0 to -1 in robotmap
Krakavius Feb 2, 2020
7dd93c7
Move limit switch to indexer
BenCantCode Feb 4, 2020
82a00dd
Remove shooter references from IndexOne
BenCantCode Feb 4, 2020
765431d
Almost fix RobotMap
BenCantCode Feb 4, 2020
8334927
Temp fix RobotMap
BenCantCode Feb 4, 2020
93b6615
Remove old imports
BenCantCode Feb 4, 2020
eef31be
respond to pr comments
Exr0n Feb 6, 2020
7afe928
fix IndexerOne constructor call
Exr0n Feb 6, 2020
d51fca0
started working on hood code
Pixlskull Feb 7, 2020
0f89bc4
more hood improvements
Pixlskull Feb 8, 2020
1e2d750
change hood to use motor, add hood to robotmap
Pixlskull Feb 11, 2020
f272320
Update standard to newer 2020
BenCantCode Feb 13, 2020
f451114
Added Hood to Shooter
BenCantCode Feb 13, 2020
8855352
removed excess commands, updated hood for proper zeroing and CANEncod…
Feb 17, 2020
85e7705
added set hood angle command
Feb 17, 2020
636a8e5
fixed constructor error
Feb 17, 2020
7b083bf
addressed most of the PR comments
Feb 17, 2020
d306139
Constructors must be public so that we can instantiate commands
CaseyManning Feb 17, 2020
6ac756f
make constructors public
CaseyManning Feb 17, 2020
740df35
move lift belts into intake subsystem
isaanca Feb 17, 2020
badd0e6
update standard
Daniel-E-B Feb 18, 2020
1c18c16
shoot passes intake to indexone
Daniel-E-B Feb 18, 2020
37b0ff5
minor fixes
Daniel-E-B Feb 18, 2020
d069e3d
ready for testing
NikhilSuresh24 Feb 19, 2020
9c3fcac
moved some things to robotmap
Feb 19, 2020
04b8966
Merge branch 'shooter-commands' of https://github.com/RoboticsTeam490…
Feb 19, 2020
3db1887
fixed hood for single limit switch
Feb 19, 2020
8292487
fixed zeroing
Feb 19, 2020
de56b9c
hood commands reference robotmap
NikhilSuresh24 Feb 19, 2020
0b07aa9
merge conflicts
NikhilSuresh24 Feb 19, 2020
bb2da69
changed number of teeth in servo rotation
Feb 19, 2020
ce9f776
fix hood motor and encoder to use falcons
isaanca Feb 27, 2020
35c75cd
created new FlywheelSpinUp and made old one FlywheelMaintainSpeed
KarenKGuo Feb 27, 2020
3d03fe8
Merge branch 'shooter-commands' of https://github.com/RoboticsTeam490…
KarenKGuo Feb 27, 2020
4691673
removed the servo from the Hood and removed servo-related constants f…
Krakavius Feb 28, 2020
f6d6c5f
fixed hood zeroing
Mar 1, 2020
069a10b
testing
NikhilSuresh24 Mar 1, 2020
0aaaa87
flywheel spinup and maintain speed works
NikhilSuresh24 Mar 3, 2020
547d628
reorganize
NikhilSuresh24 Mar 3, 2020
a8e585f
merge conflicts
NikhilSuresh24 Mar 3, 2020
bfaedda
added basic drive code for the timebeing
NikhilSuresh24 Mar 3, 2020
b40ec57
flywheel should still work but we need to test chassis encoders
NikhilSuresh24 Mar 3, 2020
7a80366
from march 3rd testing
Mar 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 152 additions & 8 deletions src/main/java/org/usfirst/frc4904/robot/RobotMap.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
package org.usfirst.frc4904.robot;

import org.usfirst.frc4904.robot.subsystems.Flywheel;
import org.usfirst.frc4904.robot.subsystems.Indexer;
import org.usfirst.frc4904.robot.subsystems.Intake;
import org.usfirst.frc4904.robot.subsystems.Shooter;
import org.usfirst.frc4904.standard.custom.PCMPort;
import org.usfirst.frc4904.standard.custom.controllers.CustomJoystick;
import org.usfirst.frc4904.standard.custom.controllers.CustomXbox;
import org.usfirst.frc4904.standard.custom.motioncontrollers.CANTalonFX;
import org.usfirst.frc4904.standard.custom.motioncontrollers.CANTalonSRX;
import org.usfirst.frc4904.standard.custom.motioncontrollers.CustomPIDController;
import org.usfirst.frc4904.standard.custom.sensors.CANTalonEncoder;
import org.usfirst.frc4904.standard.custom.sensors.CustomDigitalLimitSwitch;
import org.usfirst.frc4904.standard.subsystems.SolenoidSubsystem;
import org.usfirst.frc4904.standard.subsystems.motor.Motor;
import org.usfirst.frc4904.robot.subsystems.Hood;

import edu.wpi.first.wpilibj.kinematics.DifferentialDriveKinematics;

Expand All @@ -13,36 +26,107 @@ public static class HumanInput {
}

public static class CANMotor {
// Intake
public static final int INTAKE_ROLLER_MOTOR = 10;
public static final int INTAKE_FUNNEL_MOTOR = 5;
// Indexer
public static final int LIFT_BELT_MOTOR = 6;
// Flywheel
public static final int FLYWHEEL_MOTOR_A = 2;
public static final int FLYWHEEL_MOTOR_B = 1;
// Shooter
public static final int RUN_UP_BELT_MOTOR = 8;
}

public static class PWM {
public static class PWM { // TODO: CHANGE CONSTS
}

public static class CAN {
public static class CAN { // TODO: CHANGE CONSTS
public static final int HOOD_MOTOR = -1;
public static final int HOOD_ENCODER = -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No hood encoder—we'll use the encoder that's built into the falcon that's driving the hood.

}

public static class Pneumatics {
public static class Pneumatics { // TODO: CHANGE CONSTS
public static final PCMPort INTAKE_SOLENOID = new PCMPort(0, -1, -1);
public static final PCMPort FLIPPER_SOLENOID = new PCMPort(0, -1, -1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably aren't using a flipper.

public static final PCMPort SHOOTER_AIM_SOLENOID = new PCMPort(0, -1, -1);
}

public static class Digital {
public static class Digital { // TODO: CHANGE CONSTS
public static final int INDEXER_LIMIT_SWITCH = -1;
public static final int HOOD_LOWER_LIMIT_SWITCH = -1;
public static final int HOOD_UPPER_LIMIT_SWITCH = -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's currently one limit switch, with two different magnets.

}
}

public static class Metrics {
public static class Chassis {
public static final double TICKS_PER_REVOLUTION = -1; // TODO: CHANGE CONSTS
public static final double DIAMETER_INCHES = -1;
public static final double CIRCUMFERENCE_INCHES = Metrics.Chassis.DIAMETER_INCHES * Math.PI;
public static final double DIAMETER_METERS = -1;
public static final double CIRCUMFERENCE_METERS = Metrics.Chassis.DIAMETER_METERS * Math.PI;
public static final double TICKS_PER_INCH = Metrics.Chassis.TICKS_PER_REVOLUTION
/ Metrics.Chassis.CIRCUMFERENCE_INCHES;
/ Metrics.Chassis.CIRCUMFERENCE_METERS;
public static final double DISTANCE_FRONT_BACK = -1;
public static final double DISTANCE_SIDE_SIDE = -1;
public static final double INCHES_PER_TICK = Metrics.Chassis.CIRCUMFERENCE_INCHES
public static final double METERS_PER_TICK = Metrics.Chassis.CIRCUMFERENCE_METERS
/ Metrics.Chassis.TICKS_PER_REVOLUTION;
}

public static class Encoders {
public static class TalonEncoders {
public static final double TICKS_PER_REVOLUTION = 2048.0;
public static final double REVOLUTIONS_PER_TICK = 1 / TICKS_PER_REVOLUTION;
}

public static class CANCoders {
public static final double TICKS_PER_REVOLUTION = 4096.0;
public static final double REVOLUTIONS_PER_TICK = 1 / TICKS_PER_REVOLUTION;
}
}

public static class Hood {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are the other constants, for converting from motor spins to hood movement?

public static final double LOWER_HOOD_ANGLE = 0; // TODO: Add this value
public static final double RANGE_HOOD_ANGLES = 35.0;
public static final double UPPER_HOOD_ANGLE = LOWER_HOOD_ANGLE + RANGE_HOOD_ANGLES; // TODO: Does having all
// of these theoretical
// constants negate the
// zeroing we're doing?
}
}

public static class DriveConstants {
public static final boolean kGyroReversed = false;
public static final double ksVolts = -1;
public static final double kvVoltSecondsPerMeter = -1;
public static final double kaVoltSecondsSquaredPerMeter = -1;
public static final double kTrackwidthMeters = -1;
public static final DifferentialDriveKinematics kDriveKinematics = new DifferentialDriveKinematics(
kTrackwidthMeters);
public static final double kPDriveVel = -1;
}

public static class AutoConstants {
public static final double kMaxSpeedMetersPerSecond = -1;
public static final double kMaxAccelerationMetersPerSecondSquared = -1;
public static final double kRamseteB = -1;
public static final double kRamseteZeta = -1;
}

public static class PID {
public static class Flywheel {
public static final double P = 0.0;
public static final double I = 0.0;
public static final double D = 0.0;
public static final double F = 0.0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably copy over the values that work

}

public static class Hood {
public static final double P = 0.0;
public static final double I = 0.0;
public static final double D = 0.0;
public static final double F = 0.0;
}

public static class Drive {
}

Expand All @@ -52,9 +136,31 @@ public static class Turn {
}

public static class Component {
public static Intake intake;
public static Indexer indexer;
public static Flywheel flywheel;
public static Shooter shooter;
public static Hood hood;

public static SolenoidSubsystem intakeSolenoid;
public static SolenoidSubsystem flipperSolenoid;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not using the flipper anymore

public static SolenoidSubsystem shooterAimSolenoid;

public static Motor intakeRollerMotor;
public static Motor funnelMotor;
public static Motor liftBeltMotor;
public static Motor runUpBeltMotor;
public static Motor flywheelMotorA;
public static Motor flywheelMotorB;
public static Motor hoodMotor;

public static CANTalonEncoder flywheelEncoder;
public static CANTalonEncoder hoodEncoder;
}

public static class Input {
public static CustomDigitalLimitSwitch indexerLimitSwitch;
public static CustomDigitalLimitSwitch hoodLimitSwitch;
}

public static class HumanInput {
Expand All @@ -68,8 +174,46 @@ public static class Operator {
}

public RobotMap() {
/** Human Input */
HumanInput.Driver.xbox = new CustomXbox(Port.HumanInput.xboxController);
HumanInput.Operator.joystick = new CustomJoystick(Port.HumanInput.joystick);

/** Pneumatics */
Component.intakeSolenoid = new SolenoidSubsystem(Port.Pneumatics.INTAKE_SOLENOID.buildDoubleSolenoid());
Component.flipperSolenoid = new SolenoidSubsystem(Port.Pneumatics.FLIPPER_SOLENOID.buildDoubleSolenoid());
Component.shooterAimSolenoid = new SolenoidSubsystem(
Port.Pneumatics.SHOOTER_AIM_SOLENOID.buildDoubleSolenoid());

/** Motors */
Component.intakeRollerMotor = new Motor("intakeRollerMotor",
new CANTalonSRX(Port.CANMotor.INTAKE_ROLLER_MOTOR));
Component.funnelMotor = new Motor("funnelMotor", new CANTalonSRX(Port.CANMotor.INTAKE_FUNNEL_MOTOR));
Component.liftBeltMotor = new Motor("liftBeltMotor", new CANTalonSRX(Port.CANMotor.LIFT_BELT_MOTOR));
Component.runUpBeltMotor = new Motor("runUpBeltMotor", new CANTalonSRX(Port.CANMotor.RUN_UP_BELT_MOTOR));
CANTalonFX flywheelATalon = new CANTalonFX(Port.CANMotor.FLYWHEEL_MOTOR_A);
Component.flywheelMotorA = new Motor("flywheelMotorA", flywheelATalon);
Component.flywheelMotorB = new Motor("flywheelMotorB", new CANTalonFX(Port.CANMotor.FLYWHEEL_MOTOR_B));
CANTalonFX hoodTalon = new CANTalonFX(Port.CAN.HOOD_MOTOR);
Component.hoodMotor = new Motor("hoodMotor", hoodTalon);

/** Digital */
Input.indexerLimitSwitch = new CustomDigitalLimitSwitch(Port.Digital.INDEXER_LIMIT_SWITCH);
Input.hoodLimitSwitch = new CustomDigitalLimitSwitch(Port.Digital.HOOD_LOWER_LIMIT_SWITCH);

/** Encoders */
Component.flywheelEncoder = new CANTalonEncoder(flywheelATalon,
Metrics.Encoders.TalonEncoders.REVOLUTIONS_PER_TICK);
Component.hoodEncoder = new CANTalonEncoder(hoodTalon, Metrics.Encoders.TalonEncoders.REVOLUTIONS_PER_TICK);

/** Classes */
Component.intake = new Intake(Component.intakeRollerMotor, Component.liftBeltMotor, Component.funnelMotor,
Component.intakeSolenoid);
Component.indexer = new Indexer(Component.flipperSolenoid, Input.indexerLimitSwitch);

Component.flywheel = new Flywheel(new CustomPIDController(PID.Flywheel.P, PID.Flywheel.I, PID.Flywheel.D,
PID.Flywheel.F, Component.flywheelEncoder), Component.flywheelMotorA, Component.flywheelMotorB);

Component.hood = new Hood(Component.hoodMotor, Component.hoodEncoder, Input.hoodLimitSwitch);
Component.shooter = new Shooter(Component.flywheel, Component.runUpBeltMotor, Component.hood);
}
}
20 changes: 20 additions & 0 deletions src/main/java/org/usfirst/frc4904/robot/commands/BoxShot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.usfirst.frc4904.robot.commands;

import org.usfirst.frc4904.robot.commands.Shoot;

public class BoxShot extends Shoot {
protected static final double DEFAULT_BOXSHOT_SPEED = 0.0; // TODO: Untested variables

/**
* Run the Shoot command for a box shot.
*
*
* @param indexer The indexer subsystem
* @param shooter The shooter subsystem
* @param speed The target speed of the flywheel
*/
public BoxShot() {
super(DEFAULT_BOXSHOT_SPEED);
setName("BoxShot");
}
}
15 changes: 15 additions & 0 deletions src/main/java/org/usfirst/frc4904/robot/commands/CloseIndexer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.usfirst.frc4904.robot.commands;

import org.usfirst.frc4904.robot.RobotMap;
import org.usfirst.frc4904.standard.commands.solenoid.SolenoidExtend;

public class CloseIndexer extends SolenoidExtend {
/**
* Retract the indexer solenoid to close the indexer flippers.
*
* @param indexer The indexer to manipulate
*/
public CloseIndexer() {
super("CloseIndexer", RobotMap.Component.indexer.flippers);
}
}
13 changes: 13 additions & 0 deletions src/main/java/org/usfirst/frc4904/robot/commands/ExtendIntake.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.usfirst.frc4904.robot.commands;

import org.usfirst.frc4904.robot.RobotMap;
import org.usfirst.frc4904.standard.commands.solenoid.SolenoidExtend;

public class ExtendIntake extends SolenoidExtend {
/**
* Extend the intake solenoid to deploy the intake rollers.
*/
public ExtendIntake() {
super("ExtendIntake", RobotMap.Component.intake.solenoid);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.usfirst.frc4904.robot.commands;

import org.usfirst.frc4904.robot.RobotMap;
import org.usfirst.frc4904.standard.commands.motor.MotorVelocitySet;

public class FlywheelMaintainSpeed extends MotorVelocitySet {

/**
* Spin up the flywheel to a speed
*
* @param flywheel The flywheel to manipulate
* @param speed The speed to spin the flywheel up to
*/
public FlywheelMaintainSpeed(double speed) {
super("FlywheelMaintainSpeed", RobotMap.Component.flywheel, speed);
//addRequirements(RobotMap.Component.flywheelMotorA, RobotMap.Component.flywheelMotorB);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.usfirst.frc4904.robot.commands;

import org.usfirst.frc4904.robot.subsystems.Flywheel;
import edu.wpi.first.wpilibj2.command.CommandBase;

public class FlywheelSpinDown extends CommandBase {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this also be a motorVelocitySet?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because it should just set the speed of the motor 0 (we don't actually care if the motor has some excess speed, so long as it slowly approaches 0).

public static final double IDLE_SPEED = 0.0;
protected final Flywheel flywheel;

/**
* Spin down the flywheel
*
* @param flywheel The flywheel to manipulate
*/
public FlywheelSpinDown(Flywheel flywheel) {
super();
setName("FlywheelSpinDown");
addRequirements(flywheel);
this.flywheel = flywheel;
}

@Override
public void initialize() {
super.initialize();
flywheel.disableMotionController();
}

@Override
public void execute() {
NikhilSuresh24 marked this conversation as resolved.
Show resolved Hide resolved
flywheel.set(IDLE_SPEED);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.usfirst.frc4904.robot.commands;

import org.usfirst.frc4904.robot.RobotMap;
import org.usfirst.frc4904.standard.commands.RunUntil;
import org.usfirst.frc4904.standard.commands.motor.MotorConstant;

import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;

public class FlywheelSpinUp extends SequentialCommandGroup {

public static final double DEFAULT_FLYWHEEL_SPEED = 0.0; // TODO: This is an untested value
public static final double THRESHOLD = 0.0;

/**
* Spin up the flywheel to a speed
*
* @param flywheel The flywheel to manipulate
* @param speed The speed to spin the flywheel up to
*/
public FlywheelSpinUp(double speed) {
// smartdashboard.getNumber(“setpoint”, 0)
super(new RunUntil("FlywheelSpinUp", new MotorConstant(RobotMap.Component.flywheel, speed), () -> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be speed times feedfoward, not just raw speed

return Math.abs(RobotMap.Component.shooter.flywheel.getTargetSpeed() - speed) < THRESHOLD
|| RobotMap.Component.shooter.flywheel.getTargetSpeed() > speed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should also be a RobotMap.Component.shooter.flywheel.getTargetSpeed() < speed I'd presume, in case we go too fast and never fall back into the threshold?

}), new FlywheelMaintainSpeed(speed));
addRequirements(RobotMap.Component.flywheelMotorA, RobotMap.Component.flywheelMotorB);
}

/**
* Spin up the flywheel to the default speed
*
* @param flywheel The flywheel to manipulate
*/
public FlywheelSpinUp() {
this(DEFAULT_FLYWHEEL_SPEED);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.usfirst.frc4904.robot.commands;

import org.usfirst.frc4904.robot.RobotMap;
import org.usfirst.frc4904.standard.commands.motor.MotorConstant;

/**
* Goes to the lower limit and zeroes
*/
public class HoodZeroConstant extends MotorConstant {
public final static double DEFAULT_SPEED = 0;

public HoodZeroConstant() {
super("HoodZeroConstant", RobotMap.Component.hood.getServo(), DEFAULT_SPEED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the servo no longer exists

}

@Override
public void end(boolean interrupted) {
super.end(interrupted);
if (!interrupted) {
RobotMap.Component.hood.setLimit();
}
}

}
Loading