-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'origin/arm-subsystem-scaffolding'
- Loading branch information
Showing
7 changed files
with
326 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,37 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration": "automatic", | ||
"java.server.launchMode": "Standard", | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.svn": true, | ||
"**/.hg": true, | ||
"**/CVS": true, | ||
"**/.DS_Store": true, | ||
"bin/": true, | ||
"**/.classpath": true, | ||
"**/.project": true, | ||
"**/.settings": true, | ||
"**/.factorypath": true, | ||
"**/*~": true | ||
}, | ||
"java.test.config": [ | ||
{ | ||
"name": "WPIlibUnitTests", | ||
"workingDirectory": "${workspaceFolder}/build/jni/release", | ||
"vmargs": [ | ||
"-Djava.library.path=${workspaceFolder}/build/jni/release" | ||
], | ||
"env": { | ||
"LD_LIBRARY_PATH": "${workspaceFolder}/build/jni/release", | ||
"DYLD_LIBRARY_PATH": "${workspaceFolder}/build/jni/release" | ||
} | ||
}, | ||
], | ||
"java.test.defaultConfig": "WPIlibUnitTests", | ||
// Style guide - most of this came from clicking buttons and then copying from my user settings.json | ||
// General editor stuff | ||
"editor.formatOnSave": true, // So you cant forget | ||
"editor.tabSize": 4, // 4 char width indentation | ||
"editor.detectIndentation": false, // Prevent above from being overridden | ||
"editor.insertSpaces": false, // use tab character instead of spaces | ||
"java.cleanup.actionsOnSave": [ | ||
"addOverride", | ||
] | ||
} | ||
"java.configuration.updateBuildConfiguration": "automatic", | ||
"java.server.launchMode": "Standard", | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.svn": true, | ||
"**/.hg": true, | ||
"**/CVS": true, | ||
"**/.DS_Store": true, | ||
"bin/": true, | ||
"**/.classpath": true, | ||
"**/.project": true, | ||
"**/.settings": true, | ||
"**/.factorypath": true, | ||
"**/*~": true | ||
}, | ||
"java.test.config": [ | ||
{ | ||
"name": "WPIlibUnitTests", | ||
"workingDirectory": "${workspaceFolder}/build/jni/release", | ||
"vmargs": [ "-Djava.library.path=${workspaceFolder}/build/jni/release" ], | ||
"env": { | ||
"LD_LIBRARY_PATH": "${workspaceFolder}/build/jni/release" , | ||
"DYLD_LIBRARY_PATH": "${workspaceFolder}/build/jni/release" | ||
} | ||
}, | ||
], | ||
"java.test.defaultConfig": "WPIlibUnitTests", | ||
"cSpell.words": [ | ||
"AHRS", | ||
"Deadzone", | ||
"Odometry", | ||
"setpoint", | ||
"velociticities" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package frc.robot.commands; | ||
|
||
import frc.robot.Constants.ArmConstants; | ||
import frc.robot.subsystems.Arm; | ||
import frc.robot.subsystems.ExampleSubsystem; | ||
import frc.robot.inputs.OptionButtonInput; | ||
import edu.wpi.first.wpilibj.TimedRobot; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.Commands; | ||
import edu.wpi.first.wpilibj2.command.Subsystem; | ||
|
||
|
||
public class ArmRemoteControl extends Command { | ||
private final Arm arm; | ||
|
||
private final OptionButtonInput raiseArmButton; | ||
private final OptionButtonInput lowerArmButton; | ||
|
||
private final OptionButtonInput speakerPositionButton; | ||
private final OptionButtonInput ampPositionButton; | ||
private final OptionButtonInput intakePositionButton; | ||
|
||
|
||
public ArmRemoteControl(Arm arm, OptionButtonInput raiseArmButton, OptionButtonInput lowerArmButton, | ||
OptionButtonInput speakerPositionButton, OptionButtonInput ampPositionButton, OptionButtonInput intakePositionButton) { | ||
this.arm = arm; | ||
|
||
this.raiseArmButton = raiseArmButton; | ||
this.lowerArmButton = lowerArmButton; | ||
|
||
this.speakerPositionButton = speakerPositionButton; | ||
this.ampPositionButton = ampPositionButton; | ||
this.intakePositionButton = intakePositionButton; | ||
|
||
|
||
addRequirements(arm); | ||
} | ||
|
||
|
||
|
||
@Override | ||
public void initialize() { | ||
} | ||
|
||
/** | ||
* execute() is called repeatedly while a command is scheduled, about every | ||
* 20ms. | ||
*/ | ||
@Override | ||
public void execute() { | ||
|
||
// Arm Motor | ||
arm.changeArmAngleDegreesBy(Double.valueOf(raiseArmButton.getStateAsInt()) * TimedRobot.kDefaultPeriod * ArmConstants.DEGREES_PER_SECOND); | ||
arm.changeArmAngleDegreesBy(Double.valueOf(-lowerArmButton.getStateAsInt()) * TimedRobot.kDefaultPeriod * ArmConstants.DEGREES_PER_SECOND); | ||
|
||
// Arm Povs | ||
if (speakerPositionButton.getState()) { | ||
arm.setArmToSpeakerPosition(); | ||
} | ||
if (ampPositionButton.getState()) { | ||
arm.setArmToAmpPosition(); | ||
} | ||
if (intakePositionButton.getState()) { | ||
arm.setArmToIntakePosition(); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.Arm; | ||
|
||
public class ArmRotateTo extends Command{ | ||
|
||
private final double setpoint; | ||
private final Arm arm; | ||
|
||
public ArmRotateTo(Arm arm, double degree){ | ||
this.setpoint = degree; | ||
this.arm = arm; | ||
|
||
addRequirements(arm); | ||
|
||
} | ||
|
||
@Override | ||
public void initialize() { | ||
arm.setSetpoint(setpoint); | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return arm.isAtDesiredPosition(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.