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 74 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
215 changes: 165 additions & 50 deletions src/main/java/org/usfirst/frc4904/robot/RobotMap.java
Original file line number Diff line number Diff line change
@@ -1,75 +1,190 @@
package org.usfirst.frc4904.robot;

import com.ctre.phoenix.sensors.CANCoderConfiguration;

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.ContinuousServoController;
import org.usfirst.frc4904.standard.custom.motioncontrollers.CustomPIDController;
import org.usfirst.frc4904.standard.custom.sensors.CANEncoder;
import org.usfirst.frc4904.standard.custom.sensors.CANTalonEncoder;
import org.usfirst.frc4904.standard.custom.sensors.CustomCANCoder;
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.PWMSpeedController;
import edu.wpi.first.wpilibj.kinematics.DifferentialDriveKinematics;

public class RobotMap {
public static class Port {
public static class HumanInput {
public static final int joystick = 0;
public static final int xboxController = 1;
}

public static class CANMotor {
}

public static class PWM {
}

public static class CAN {
}

public static class Pneumatics {
}

public static class Digital {
}
public static class Port {
public static class HumanInput {
public static final int joystick = 0;
public static final int xboxController = 1;
}

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 TICKS_PER_INCH = Metrics.Chassis.TICKS_PER_REVOLUTION
/ Metrics.Chassis.CIRCUMFERENCE_INCHES;
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
/ Metrics.Chassis.TICKS_PER_REVOLUTION;
}
public static class CANMotor { // TODO: CHANGE CONSTS
// Intake
public static final int INTAKE_ROLLER_MOTOR = -1;
public static final int INTAKE_FUNNEL_MOTOR = -1;
// Indexer
public static final int LIFT_BELT_MOTOR = -1;
// Flywheel
public static final int FLYWHEEL_MOTOR_A = -1;
public static final int FLYWHEEL_MOTOR_B = -1;
// Shooter
public static final int RUN_UP_BELT_MOTOR = -1;
}

public static class PID {
public static class Drive {
}
public static class PWM {
public static final int HOOD_MOTOR = -1;
}

public static class Turn {
}
public static class CAN {
public static final int HOOD_ENCODER = -1;
}

public static class Pneumatics {
public static final PCMPort INTAKE_SOLENOID = new PCMPort(0, -1, -1);
public static final PCMPort FLIPPER_SOLENOID = new PCMPort(0, -1, -1);
public static final PCMPort SHOOTER_AIM_SOLENOID = new PCMPort(0, -1, -1);
}

public static class Component {
public static class Digital {
public static final int INDEXER_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.

Where are the ports for hoodLowLimitSwitch and hoodHighLimitSwitch

}
}

public static class Metrics {
public static class Chassis {
public static final double TICKS_PER_REVOLUTION = -1; // TODO: CHANGE CONSTS
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_METERS;
public static final double DISTANCE_FRONT_BACK = -1;
public static final double DISTANCE_SIDE_SIDE = -1;
public static final double METERS_PER_TICK = Metrics.Chassis.CIRCUMFERENCE_METERS
/ Metrics.Chassis.TICKS_PER_REVOLUTION;
}
public static class Flywheel {
public static final double ROTATIONS_PER_TICK = 1.0 / 2048.0;
}
}

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;
}
Copy link
Member

Choose a reason for hiding this comment

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

Why are the spline constants, which are specifically for the drivetrain, in a flywheel PR?

Copy link
Author

Choose a reason for hiding this comment

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

I think they were merged into master when this branch was created.


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

Choose a reason for hiding this comment

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

wheres F

}

public static class Input {
public static class Hood {
public static final double P = 0;
public static final double I = 0;
public static final double D = 0;
Copy link
Member

Choose a reason for hiding this comment

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

add F

}

public static class HumanInput {
public static class Driver {
public static CustomXbox xbox;
}
public static class Drive {
}

public static class Operator {
public static CustomJoystick joystick;
}
public static class Turn {
}

public RobotMap() {
HumanInput.Driver.xbox = new CustomXbox(Port.HumanInput.xboxController);
HumanInput.Operator.joystick = new CustomJoystick(Port.HumanInput.joystick);
}

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;
public static SolenoidSubsystem shooterAimSolenoid;

public static Motor intakeRollerMotor;
public static Motor funnelMotor;
public static Motor liftBeltMotor;
public static Motor runUpBeltMotor;
Numdoc marked this conversation as resolved.
Show resolved Hide resolved
public static Motor flywheelMotorA;
public static Motor flywheelMotorB;
public static Motor hoodMotor;

public static CANTalonEncoder flywheelEncoder;
public static CANEncoder hoodEncoder;
}

public static class Input {
public static CustomDigitalLimitSwitch limitSwitch;
Copy link
Member

Choose a reason for hiding this comment

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

better name please

public static CustomDigitalLimitSwitch hoodLowLimitSwitch;
public static CustomDigitalLimitSwitch hoodHighLimitSwitch;
}

public static class HumanInput {
public static class Driver {
public static CustomXbox xbox;
}

public static class Operator {
public static CustomJoystick joystick;
}
}

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

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());

// TODO: FIX MOTOR TYPES
Copy link
Member

Choose a reason for hiding this comment

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

does this still need to be done? If so let's do it because its all built

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); //TODO: Nicer way to do this?
Copy link
Member

Choose a reason for hiding this comment

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

you could make the Talons separately if you want as Components and pass them in but this is probably fine

Copy link
Member

Choose a reason for hiding this comment

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

I'm going to leave it as-is for now, but question: do we want to average the reading of the two encoders, or just take one?

Component.flywheelMotorA = new Motor("flywheelMotorA", flywheelATalon);
Component.flywheelMotorB = new Motor("flywheelMotorB", new CANTalonFX(Port.CANMotor.FLYWHEEL_MOTOR_B));
Component.hoodMotor = new Motor("hoodMotor", new ContinuousServoController(Port.PWM.HOOD_MOTOR));

Component.intake = new Intake(Component.intakeRollerMotor, Component.funnelMotor, Component.intakeSolenoid);
Component.indexer = new Indexer(Component.liftBeltMotor, Component.flipperSolenoid, Input.limitSwitch);
Copy link
Member

Choose a reason for hiding this comment

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

does this limit switch need to be constructed?


Component.flywheelEncoder = new CANTalonEncoder(flywheelATalon, Metrics.Flywheel.ROTATIONS_PER_TICK);
Component.flywheel = new Flywheel(
new CustomPIDController(PID.Flywheel.P, PID.Flywheel.I, PID.Flywheel.D, Component.flywheelEncoder));

Copy link
Member

Choose a reason for hiding this comment

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

you will also need an encoder for the runup belt, because that also needs to run at a set speed

Copy link
Member

@Daniel-E-B Daniel-E-B Feb 3, 2020

Choose a reason for hiding this comment

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

this will be a CANCoder

Component.hoodEncoder = new CANEncoder(Port.CAN.HOOD_ENCODER);
Component.hood = new Hood(Component.hoodMotor, Component.hoodEncoder, Input.hoodLowLimitSwitch, Input.hoodHighLimitSwitch); //TODO: Remove this redundancy.
Copy link
Member

Choose a reason for hiding this comment

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

1.) what redundancy?
2.) do you ever construct these limit switches?

Component.shooter = new Shooter(Component.flywheel, Component.shooterAimSolenoid, Component.hood);
}
}
22 changes: 22 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,22 @@
package org.usfirst.frc4904.robot.commands;

import org.usfirst.frc4904.robot.commands.Shoot;
import org.usfirst.frc4904.robot.subsystems.Indexer;
import org.usfirst.frc4904.robot.subsystems.Shooter;

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(Indexer indexer, Shooter shooter) {
super(indexer, shooter, 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.subsystems.Indexer;
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(Indexer indexer) {
super("CloseIndexer", indexer.flippers);
}
}
15 changes: 15 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,15 @@
package org.usfirst.frc4904.robot.commands;

import org.usfirst.frc4904.robot.subsystems.Intake;
import org.usfirst.frc4904.standard.commands.solenoid.SolenoidExtend;

public class ExtendIntake extends SolenoidExtend {
/**
* Extend the intake solenoid to deploy the intake rollers.
*
* @param intake The intake to manipulate
*/
public ExtendIntake(Intake intake) {
super("ExtendIntake", intake.solenoid);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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 DEFAULT_IDLE_SPEED = 0.0;
protected final Flywheel flywheel;

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

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

import org.usfirst.frc4904.robot.subsystems.Flywheel;
import org.usfirst.frc4904.standard.commands.motor.MotorVelocitySet;
public class FlywheelSpinUp extends MotorVelocitySet {
public static final double DEFAULT_FLYWHEEL_SPEED = 0.0; // TODO: This is an untested value

/**
* Spin up the flywheel to a speed
*
* @param flywheel The flywheel to manipulate
* @param speed The speed to spin the flywheel up to
*/
FlywheelSpinUp(Flywheel flywheel, double speed) {
super("FlywheelSpinUp", flywheel, speed);
}

/**
* Spin up the flywheel to the default speed
*
* @param flywheel The flywheel to manipulate
*/
FlywheelSpinUp(Flywheel flywheel) {
this(flywheel, DEFAULT_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.

does this need to be done constantly like motorSet? I'm not sure but we should check

Copy link
Member

Choose a reason for hiding this comment

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

I had to constantly set the setpoint when testing the VelocitySensorMotor for Blinky, so I assumed this would act the same... though I agree, we should test/check.

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.usfirst.frc4904.robot.commands;

import org.usfirst.frc4904.robot.subsystems.Hood;
import org.usfirst.frc4904.standard.commands.motor.MotorConstant;

public class HoodZeroConstant extends MotorConstant {
protected final boolean limitType;
protected final Hood hood;

public HoodZeroConstant(String name, Hood hood, double motorSpeed, boolean limitType) {
Copy link
Member

Choose a reason for hiding this comment

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

1.) the motor speed should be a constant in this file
2.) please add to the javadoc a thing saying which limit positions correspond to true and false or just make the limitType an enum

super(name, hood.getServo(), motorSpeed);
this.hood = hood;
this.limitType = limitType;
}

public HoodZeroConstant(Hood hood, double motorspeed, boolean limitType) {
this("HoodZeroConstant", hood, motorspeed, limitType);
}

@Override
public void end(boolean interrupted) {
if (!interrupted) {
super.motor.set(0.0);
hood.setLimit(limitType);
}
}

}
Loading