-
Notifications
You must be signed in to change notification settings - Fork 0
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
Added GearPlacerServo subsystem and added some Javadocs. #4
base: master
Are you sure you want to change the base?
Changes from 2 commits
aa099d3
10bd240
996818c
c6b144a
013bb20
75708ea
277784b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,40 +2,22 @@ | |
|
||
public class RobotMap { | ||
|
||
// Ports of wheels | ||
public static final int FRONT_LEFT = 0; | ||
public static final int FRONT_RIGHT = 1; | ||
public static final int BACK_LEFT = 2; | ||
public static final int BACK_RIGHT = 3; | ||
|
||
// Ports of intake | ||
public static final int ROLLER_A = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which ones are A and B? Top/Bottom? Left/Right? Specify. If you don't know, put that in a TODO comment |
||
public static final int ROLLER_B = 0; | ||
|
||
// Ports of fly wheels | ||
public static final int FLY_WHEEL_R = 0; | ||
public static final int FLY_WHEEL_L = 0; | ||
|
||
// Ports of Ultrasonics | ||
public static final int ULTRASONIC_RX = 0; | ||
public static final int ULTRASONIC_TX = 1; | ||
|
||
// Port of gyro | ||
public static final int GYRO = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We know the RobotMap class is full of port numbers, eliminate that from the comments throughout the class |
||
|
||
// Port of gear placer | ||
public static final int PLACER = 0; | ||
|
||
// Port of shooter | ||
public static final int GEAR_PLACER = 0; | ||
public static final int GEAR_PLACER_SERVO = 0; | ||
public static final int SHOOTER = 0; | ||
|
||
// Port of climber | ||
public static final int CLIMBER = 0; | ||
|
||
// Port of micro switch | ||
public static final int MICRO_SWITCH = 0; | ||
|
||
// Ports of encoders | ||
public static final int DT_ENCODER_1 = 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A number tells us nothing. Where are these on the robot? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll be using CANTalons so we won't need these anymore. |
||
public static final int DT_ENCODER_2 = 2; | ||
public static final int DT_ENCODER_3 = 3; | ||
|
@@ -50,8 +32,6 @@ public class RobotMap { | |
public static final int TWIN_ENCODER_4 = 12; | ||
public static final int SHOOT_ENCODER_1 = 0; | ||
public static final int SHOOT_ENCODER_2 = 1; | ||
|
||
// Port of joysticks | ||
public static final int JOYSTICK1 = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which joysticks? The number does not tell me anything |
||
public static final int JOYSTICK2 = 1; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
import edu.wpi.first.wpilibj.command.Command; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These descriptions are for commands. Write them like commands i.e. "Raise the gear placer" instead of "Raises the gear placer" |
||
|
||
/** | ||
* | ||
* Lifts the gear placer to interact with a gear. | ||
*/ | ||
public class RaiseGearPlacerCmd extends Command { | ||
|
||
|
@@ -16,7 +16,7 @@ public RaiseGearPlacerCmd() { | |
} | ||
|
||
/** | ||
* Lowers the gear placer. | ||
* Raises the gear placer. | ||
*/ | ||
protected void initialize() { | ||
Robot.GP.set(this.PLACER_MAX_POSITION); | ||
|
@@ -25,7 +25,10 @@ protected void initialize() { | |
protected void execute() { | ||
//empty | ||
} | ||
// Finishes when the placer is at the highest position | ||
|
||
/** | ||
* Raises the gear placer to the highest position. | ||
*/ | ||
protected boolean isFinished() { | ||
return Robot.GP.getPosition() == this.PLACER_MAX_POSITION; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.nutrons.nu17.subsystems; | ||
|
||
import com.nutrons.nu17.RobotMap; | ||
|
||
import edu.wpi.first.wpilibj.Servo; | ||
import edu.wpi.first.wpilibj.command.Subsystem; | ||
|
||
/** | ||
* Similar to {@link GearPlacer} class but uses a servo instead. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps this should extend the GearPlacer class or alternately you should have an interface that abstracts over both. |
||
*/ | ||
public class GearPlacerServo extends Subsystem { | ||
|
||
private final Servo PLACER = new Servo(RobotMap.GEAR_PLACER_SERVO); | ||
|
||
public void initDefaultCommand() { | ||
//empty | ||
} | ||
|
||
/** | ||
* Sets the gear placer to a position. | ||
* | ||
* @param position Where the gear placer will be set to. | ||
*/ | ||
public void setPosition(double position) { | ||
PLACER.set(position); | ||
} | ||
|
||
/** | ||
* Returns the current position of the gear placer. | ||
* | ||
* @return Gives us where the gear placer is at this moment. | ||
*/ | ||
public double getPosition() { | ||
return PLACER.get(); | ||
} | ||
|
||
public void stop() { | ||
this.setPosition(this.getPosition()); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bit that said they were wheels was helpful. Add a comment:
// Wheel motors