-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add blinky code #29
Add blinky code #29
Changes from all commits
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 |
---|---|---|
@@ -1,7 +1,36 @@ | ||
# Java-Template | ||
[![CI](https://github.com/Frc5572/FRC2023/actions/workflows/main.yml/badge.svg)](https://github.com/Frc5572/FRC2023/actions/workflows/main.yml) [![Java Docs](https://img.shields.io/badge/docs-20XX-blue)](https://frc5572.github.io/Java-Template/) | ||
|
||
[![CI](https://github.com/Frc5572/FRC2023/actions/workflows/main.yml/badge.svg)](https://github.com/Frc5572/FRC2023/actions/workflows/main.yml) [![Java Docs](https://img.shields.io/badge/docs-20XX-blue)](https://frc5572.github.io/Java-Template/) | ||
|
||
Template repo for Java template | ||
|
||
Good examples can be found https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples | ||
Good examples can be found <https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples> | ||
|
||
# Subsystems | ||
|
||
## Drive Train | ||
|
||
Port 7- motor bl Right VictorSP | ||
Port 6 - motor fl Right VictorSP | ||
Port 5 -motor fr Right VictorSP | ||
Port 4 - motor br Right VictorSP | ||
Drive forward | ||
Drive back | ||
turn left | ||
turn right | ||
|
||
## Intake | ||
|
||
~Right VictorSP intake motor (ID: 2)~ | ||
~Left VictorSP intake motor (ID: 1)~ | ||
~Intake~ | ||
Outake | ||
|
||
## LEDS | ||
|
||
PWM Port 9 | ||
80 LEDS | ||
|
||
Red - Red Alliance | ||
Blue - Blue alliance | ||
Green - intaking |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"keyboardJoysticks": [ | ||
{ | ||
"axisConfig": [ | ||
{ | ||
"decKey": 65, | ||
"incKey": 68 | ||
}, | ||
{ | ||
"decKey": 87, | ||
"incKey": 83 | ||
}, | ||
{ | ||
"decKey": 69, | ||
"decayRate": 0.0, | ||
"incKey": 82, | ||
"keyRate": 0.009999999776482582 | ||
} | ||
], | ||
"axisCount": 3, | ||
"buttonCount": 4, | ||
"buttonKeys": [ | ||
90, | ||
88, | ||
67, | ||
86 | ||
], | ||
"povConfig": [ | ||
{ | ||
"key0": 328, | ||
"key135": 323, | ||
"key180": 322, | ||
"key225": 321, | ||
"key270": 324, | ||
"key315": 327, | ||
"key45": 329, | ||
"key90": 326 | ||
} | ||
], | ||
"povCount": 1 | ||
}, | ||
{ | ||
"axisConfig": [ | ||
{ | ||
"decKey": 74, | ||
"incKey": 76 | ||
}, | ||
{ | ||
"decKey": 73, | ||
"incKey": 75 | ||
} | ||
], | ||
"axisCount": 2, | ||
"buttonCount": 4, | ||
"buttonKeys": [ | ||
77, | ||
44, | ||
46, | ||
47 | ||
], | ||
"povCount": 0 | ||
}, | ||
{ | ||
"axisConfig": [ | ||
{ | ||
"decKey": 263, | ||
"incKey": 262 | ||
}, | ||
{ | ||
"decKey": 265, | ||
"incKey": 264 | ||
} | ||
], | ||
"axisCount": 2, | ||
"buttonCount": 6, | ||
"buttonKeys": [ | ||
260, | ||
268, | ||
266, | ||
261, | ||
269, | ||
267 | ||
], | ||
"povCount": 0 | ||
}, | ||
{ | ||
"axisCount": 0, | ||
"buttonCount": 0, | ||
"povCount": 0 | ||
} | ||
], | ||
"robotJoysticks": [ | ||
{ | ||
"guid": "78696e70757401000000000000000000", | ||
"useGamepad": true | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"HALProvider": { | ||
"Addressable LEDs": { | ||
"0": { | ||
"columns": 4 | ||
}, | ||
"window": { | ||
"visible": true | ||
} | ||
}, | ||
"DIO": { | ||
"window": { | ||
"visible": true | ||
} | ||
}, | ||
"Other Devices": { | ||
"window": { | ||
"visible": false | ||
} | ||
} | ||
}, | ||
"NTProvider": { | ||
"types": { | ||
"/FMSInfo": "FMSInfo", | ||
"/SmartDashboard/Choose Auto: ": "String Chooser" | ||
} | ||
}, | ||
"NetworkTables Info": { | ||
"visible": true | ||
} | ||
} |
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.Intake; | ||
|
||
public class IntakeCommand extends Command { | ||
Check warning on line 6 in src/main/java/frc/robot/commands/IntakeCommand.java GitHub Actions / testtool[testtool] src/main/java/frc/robot/commands/IntakeCommand.java#L6 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>
Raw output
|
||
|
||
Intake intake; | ||
|
||
public IntakeCommand(Intake intake) { | ||
this.intake = intake; | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
intake.intake(); | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
intake.stop(); | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return false; // intake.beambrake.get(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package frc.robot.subsystems; | ||
|
||
import edu.wpi.first.wpilibj.DigitalInput; | ||
import edu.wpi.first.wpilibj.motorcontrol.VictorSP; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.Commands; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
|
||
public class Intake extends SubsystemBase { | ||
Check warning on line 9 in src/main/java/frc/robot/subsystems/Intake.java GitHub Actions / testtool[testtool] src/main/java/frc/robot/subsystems/Intake.java#L9 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>
Raw output
|
||
|
||
VictorSP intakeMotor1 = new VictorSP(1); | ||
VictorSP intakeMotor2 = new VictorSP(2); | ||
|
||
public DigitalInput touchSensor = new DigitalInput(1); | ||
|
||
public Intake() { | ||
intakeMotor2.setInverted(true); | ||
intakeMotor1.addFollower(intakeMotor2); | ||
} | ||
|
||
public void setPower(double power) { | ||
intakeMotor1.set(power); | ||
} | ||
|
||
public void intake() { | ||
setPower(-0.7); | ||
} | ||
|
||
public void outtake() { | ||
setPower(0.7); | ||
} | ||
|
||
public void stop() { | ||
setPower(0); | ||
} | ||
|
||
public Command intakeCommand() { | ||
return Commands.runEnd(this::intake, this::stop, this); // .until(() -> beambrake.get()); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package frc.robot.subsystems; | ||
|
||
import edu.wpi.first.wpilibj.AddressableLED; | ||
import edu.wpi.first.wpilibj.AddressableLEDBuffer; | ||
import edu.wpi.first.wpilibj.DriverStation; | ||
import edu.wpi.first.wpilibj.DriverStation.Alliance; | ||
import edu.wpi.first.wpilibj.util.Color; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.Commands; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
|
||
public class LEDs extends SubsystemBase { | ||
Check warning on line 12 in src/main/java/frc/robot/subsystems/LEDs.java GitHub Actions / testtool[testtool] src/main/java/frc/robot/subsystems/LEDs.java#L12 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>
Raw output
|
||
|
||
AddressableLED leds; | ||
AddressableLEDBuffer buffer; | ||
|
||
public LEDs(int portNum, int length) { | ||
Check warning on line 17 in src/main/java/frc/robot/subsystems/LEDs.java GitHub Actions / testtool[testtool] src/main/java/frc/robot/subsystems/LEDs.java#L17 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>
Raw output
|
||
this.leds = new AddressableLED(portNum); | ||
this.buffer = new AddressableLEDBuffer(length); | ||
leds.setLength(buffer.getLength()); | ||
leds.setData(buffer); | ||
leds.start(); | ||
} | ||
|
||
public void setColor(Color color) { | ||
Check warning on line 25 in src/main/java/frc/robot/subsystems/LEDs.java GitHub Actions / testtool[testtool] src/main/java/frc/robot/subsystems/LEDs.java#L25 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>
Raw output
|
||
for (var i = 0; i < buffer.getLength(); i++) { | ||
buffer.setLED(i, color); | ||
} | ||
leds.setData(buffer); | ||
} | ||
|
||
public Command setAllianceColor() { | ||
Check warning on line 32 in src/main/java/frc/robot/subsystems/LEDs.java GitHub Actions / testtool[testtool] src/main/java/frc/robot/subsystems/LEDs.java#L32 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>
Raw output
|
||
return Commands.run(() -> { | ||
Color color = Color.kYellow; | ||
if (DriverStation.getAlliance().isPresent()) { | ||
if (DriverStation.getAlliance().get() == Alliance.Red) { | ||
color = Color.kRed; | ||
} else { | ||
color = Color.kBlue; | ||
} | ||
} | ||
setColor(color); | ||
}, this); | ||
} | ||
} |
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.
Hey this needs to be changed.....