-
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 all 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="EclipseModuleManager"> | ||
<varelement var="file://$wpilib$" value="wpilib" /> | ||
<varelement var="file://$wpilib.sources$" kind="src:" value="wpilib.sources" /> | ||
<varelement var="file://$networktables$" value="networktables" /> | ||
<varelement var="file://$networktables.sources$" kind="src:" value="networktables.sources" /> | ||
<varelement var="file://$opencv$" value="opencv" /> | ||
<varelement var="file://$opencv.sources$" kind="src:" value="opencv.sources" /> | ||
<varelement var="file://$cscore$" value="cscore" /> | ||
<varelement var="file://$cscore.sources$" kind="src:" value="cscore.sources" /> | ||
<src_description expected_position="0"> | ||
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" /> | ||
</src_description> | ||
</component> | ||
<component name="NewModuleRootManager" inherit-compiler-output="false"> | ||
<output url="file://$MODULE_DIR$/bin" /> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="module-library"> | ||
<library name="wpilib"> | ||
<CLASSES> | ||
<root url="file://$wpilib$" /> | ||
</CLASSES> | ||
<JAVADOC /> | ||
<SOURCES> | ||
<root url="file://$wpilib.sources$" /> | ||
</SOURCES> | ||
</library> | ||
</orderEntry> | ||
<orderEntry type="module-library"> | ||
<library name="networktables"> | ||
<CLASSES> | ||
<root url="file://$networktables$" /> | ||
</CLASSES> | ||
<JAVADOC /> | ||
<SOURCES> | ||
<root url="file://$networktables.sources$" /> | ||
</SOURCES> | ||
</library> | ||
</orderEntry> | ||
<orderEntry type="module-library"> | ||
<library name="opencv"> | ||
<CLASSES> | ||
<root url="file://$opencv$" /> | ||
</CLASSES> | ||
<JAVADOC /> | ||
<SOURCES> | ||
<root url="file://$opencv.sources$" /> | ||
</SOURCES> | ||
</library> | ||
</orderEntry> | ||
<orderEntry type="module-library"> | ||
<library name="cscore"> | ||
<CLASSES> | ||
<root url="file://$cscore$" /> | ||
</CLASSES> | ||
<JAVADOC /> | ||
<SOURCES> | ||
<root url="file://$cscore.sources$" /> | ||
</SOURCES> | ||
</library> | ||
</orderEntry> | ||
<orderEntry type="inheritedJdk" /> | ||
</component> | ||
</module> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,12 @@ | |
|
||
public class RobotMap { | ||
|
||
// Ports of wheels | ||
// Wheel motors | ||
public static final int FRONT_LEFT = 0; | ||
public static final int BACK_LEFT = 1; | ||
public static final int FRONT_RIGHT = 2; | ||
public static final int BACK_RIGHT = 3; | ||
|
||
// Paramter naming convention : Subsystem SIDE_PLACEMENT | ||
// Ports of intake | ||
public static final int ROLLER_FRONT = 0; | ||
|
@@ -24,6 +25,7 @@ public class RobotMap { | |
public static final int DRIVETRAIN_HEADING_GYRO = 0; | ||
|
||
// Port of gear placer | ||
public static final int GEAR_PLACER = 0; | ||
public static final int GEAR_PLACER_SERVO = 0; | ||
|
||
// Port of shooter | ||
|
@@ -50,7 +52,6 @@ public class RobotMap { | |
public static final int TWIN_RIGHT_ENCODER_2 = 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 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.nutrons.nu17.commands; | ||
|
||
import com.nutrons.nu17.Robot; | ||
import edu.wpi.first.wpilibj.command.Command; | ||
|
||
public class DrivePIDCmd extends Command { | ||
|
||
private double target; | ||
|
||
public DrivePIDCmd(double target) { | ||
requires(Robot.DRIVETRAIN); | ||
this.target = target; | ||
} | ||
|
||
/** | ||
* Sets a target to drive to. Sets how far the robot can be displaced from the target. | ||
*/ | ||
protected void initialize() { | ||
Robot.DRIVETRAIN.DISTANCE_PID.setSetpoint(this.target); | ||
Robot.DRIVETRAIN.DISTANCE_PID.setAbsoluteTolerance(0.2); | ||
Robot.DRIVETRAIN.DISTANCE_PID.enable(); | ||
} | ||
|
||
protected void execute() { | ||
//empty | ||
} | ||
// Finishes when targeted destination is reached | ||
protected boolean isFinished() { | ||
return Math.abs(Robot.DRIVETRAIN.DISTANCE_PID.getError()) < 0.2; | ||
} | ||
|
||
protected void end() { | ||
Robot.DRIVETRAIN.DISTANCE_PID.disable(); | ||
} | ||
|
||
protected void interrupted() { | ||
end(); | ||
} | ||
} |
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" |
||
|
||
/** | ||
* | ||
* Raise the gear placer. | ||
*/ | ||
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 | ||
|
||
/** | ||
* Raise the gear placer to the highest position. | ||
*/ | ||
protected boolean isFinished() { | ||
return Robot.GP.getPosition() == this.PLACER_MAX_POSITION; | ||
} | ||
|
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