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

JW/RX - LEDController + Rainbow LEDs #174

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3dbe69d
made LED abstract class
jowalkup Mar 31, 2023
7ac1bb7
wrote LED commands and rainbow color
jowalkup Mar 31, 2023
9cdacd9
fixed auton files and made rainbow command
jowalkup Apr 1, 2023
e9cc3ff
deleted test folder, worked on rainbow
jowalkup Apr 2, 2023
2ca6b4e
LEDRainbow shows LEDS!
Keobkeig Apr 3, 2023
175537f
.
Keobkeig Apr 3, 2023
9ede47f
Add LEDSetPulseRed! (WIP to be used in autons)
Keobkeig Apr 3, 2023
00a592c
Add LEDPulseColor() with any colour, SLColor util
Keobkeig Apr 3, 2023
288f6cf
stuff
naowalrahman Apr 3, 2023
efb07a6
Merge branch 'jw-rx/LED-controller' of github.com:StuyPulse/Jim into …
naowalrahman Apr 3, 2023
0824c64
Made LEDSet take LEDInstruction- pls check this !!
jowalkup Apr 5, 2023
6f1392b
Cleaned up LED + auton code, made Richie mode
naowalrahman Apr 5, 2023
ceaf554
Cleaned up LED + auton code, made Richie mode
naowalrahman Apr 5, 2023
68f8135
Merge branch 'jw-rx/LED-controller' of github.com:StuyPulse/Jim into …
naowalrahman Apr 5, 2023
85c028d
- remove unused imports
vincentw921 Apr 6, 2023
1f6306b
simplify pulse color logic
vincentw921 Apr 6, 2023
6cd9fd3
clean rainbow led
vincentw921 Apr 6, 2023
768574f
Merge branch 'robot/nyny' of github.com:StuyPulse/Jim into jw-rx/LED-…
Keobkeig Apr 7, 2023
9aa79ea
Add 3 piece with low first piece
Apr 10, 2023
760d05c
Remove NYC function, add theoretical y values
BenG49 Apr 10, 2023
aa0ca1c
Revert X alignment poses to pre-NYC values
BenG49 Apr 10, 2023
18e62bf
Fix typo
BenG49 Apr 10, 2023
9bc4e6c
Three piece W Low changes
vincentw921 Apr 10, 2023
e1f0f9f
Increase robot score wrist voltage
Apr 10, 2023
4d34453
Update pathplannerlib
Apr 10, 2023
57c3b12
Adjust 3 piece w low path and prep for arm jig
Apr 10, 2023
47f8970
Tune wrist and shoulder zero angle
vincentw921 Apr 10, 2023
e0cbe15
Tune stuff
vincentw921 Apr 10, 2023
5a3f0a7
Tune one piece mobility dock
vincentw921 Apr 10, 2023
4b96190
Tune 2 piece wire
vincentw921 Apr 10, 2023
bc671ba
Comment out old autos
vincentw921 Apr 10, 2023
05d62b2
BOOM THREE PIECE
vincentw921 Apr 10, 2023
e3a0924
Three piece wire (sad)
vincentw921 Apr 10, 2023
36bd6cf
Align against grid detection (#183)
vincentw921 Apr 10, 2023
730da45
Merge branch 'se/apr10' of https://github.com/StuyPulse/Jim into jw-r…
vincentw921 Apr 10, 2023
c0d51cc
LED code cleanup + LEDController periodic fix
naowalrahman Apr 13, 2023
f365c25
Merge branch 'main' into jw-rx/LED-controller
Keobkeig Dec 11, 2023
aa3daf5
Add AddressableLED sim
Keobkeig Dec 13, 2023
9092837
Add LEDSection
Keobkeig Dec 13, 2023
31fd6bc
Delete SLColor, use awt.Color instead
Keobkeig Dec 13, 2023
235225e
Fix errors in LEDInstruction implementations
Keobkeig Dec 13, 2023
2c9f6f4
INSANELY SMOOTH LEDRAINBOW
Keobkeig Dec 14, 2023
fc851c5
Greatly simplified LEDController subsystem
Keobkeig Dec 16, 2023
6d06715
Revamped LED subsystem
Keobkeig Dec 23, 2023
70ceec7
Prep SLColor for StuyLib
Keobkeig Dec 23, 2023
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
202 changes: 202 additions & 0 deletions src/main/deploy/pathplanner/3 Piece W Low.path
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
{
"waypoints": [
{
"anchorPoint": {
"x": 1.8,
"y": 4.6
},
"prevControl": null,
"nextControl": {
"x": 3.1835287054512387,
"y": 4.6
},
"holonomicAngle": 0,
"isReversal": false,
"velOverride": null,
"isLocked": false,
"isStopPoint": false,
"stopEvent": {
"names": [],
"executionBehavior": "parallel",
"waitBehavior": "none",
"waitTime": 0
}
},
{
"anchorPoint": {
"x": 6.187741628152297,
"y": 4.44
},
"prevControl": {
"x": 5.435011671065698,
"y": 4.44
},
"nextControl": {
"x": 6.396944039439681,
"y": 4.44
},
"holonomicAngle": 0,
"isReversal": false,
"velOverride": 1.0,
"isLocked": false,
"isStopPoint": false,
"stopEvent": {
"names": [],
"executionBehavior": "parallel",
"waitBehavior": "none",
"waitTime": 0
}
},
{
"anchorPoint": {
"x": 6.62,
"y": 4.4
},
"prevControl": {
"x": 6.501547629778108,
"y": 4.431296466187375
},
"nextControl": {
"x": 6.501547629778108,
"y": 4.431296466187375
},
"holonomicAngle": 0,
"isReversal": true,
"velOverride": null,
"isLocked": false,
"isStopPoint": true,
"stopEvent": {
"names": [],
"executionBehavior": "parallel",
"waitBehavior": "none",
"waitTime": 0
}
},
{
"anchorPoint": {
"x": 2.1599999999999997,
"y": 4.6
},
"prevControl": {
"x": 3.4298747164225913,
"y": 4.6
},
"nextControl": {
"x": 3.4298747164225913,
"y": 4.6
},
"holonomicAngle": 6.54,
"isReversal": true,
"velOverride": null,
"isLocked": false,
"isStopPoint": true,
"stopEvent": {
"names": [],
"executionBehavior": "parallel",
"waitBehavior": "none",
"waitTime": 0
}
},
{
"anchorPoint": {
"x": 6.58,
"y": 3.53
},
"prevControl": {
"x": 4.903826385233523,
"y": 4.751390831153475
},
"nextControl": {
"x": 6.7315776729384345,
"y": 3.419548684990858
},
"holonomicAngle": -30.0,
"isReversal": false,
"velOverride": 1.0,
"isLocked": false,
"isStopPoint": false,
"stopEvent": {
"names": [],
"executionBehavior": "parallel",
"waitBehavior": "none",
"waitTime": 0
}
},
{
"anchorPoint": {
"x": 6.9,
"y": 3.25
},
"prevControl": {
"x": 6.842860523327884,
"y": 3.3115587598696563
},
"nextControl": {
"x": 6.842860523327884,
"y": 3.3115587598696563
},
"holonomicAngle": -30.0,
"isReversal": true,
"velOverride": null,
"isLocked": false,
"isStopPoint": true,
"stopEvent": {
"names": [],
"executionBehavior": "parallel",
"waitBehavior": "none",
"waitTime": 0
}
},
{
"anchorPoint": {
"x": 1.7999999999999998,
"y": 4.5
},
"prevControl": {
"x": 5.794373267068212,
"y": 4.905051768145495
},
"nextControl": {
"x": 5.794373267068212,
"y": 4.905051768145495
},
"holonomicAngle": 10.0,
"isReversal": true,
"velOverride": null,
"isLocked": false,
"isStopPoint": true,
"stopEvent": {
"names": [],
"executionBehavior": "parallel",
"waitBehavior": "none",
"waitTime": 0
}
},
{
"anchorPoint": {
"x": 7.494791213358649,
"y": 5.540372759067196
},
"prevControl": {
"x": 6.738011797701916,
"y": 5.2881129538482865
},
"nextControl": null,
"holonomicAngle": 0,
"isReversal": false,
"velOverride": null,
"isLocked": false,
"isStopPoint": false,
"stopEvent": {
"names": [],
"executionBehavior": "parallel",
"waitBehavior": "none",
"waitTime": 0
}
}
],
"maxVelocity": 4.0,
"maxAcceleration": 3.0,
"isReversed": null,
"markers": []
}
1 change: 1 addition & 0 deletions src/main/java/com/stuypulse/robot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package com.stuypulse.robot;

import com.stuypulse.robot.constants.Settings;
import com.stuypulse.stuylib.util.StopWatch;

import edu.wpi.first.wpilibj.RobotBase;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/stuypulse/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void robotInit() {

@Override
public void robotPeriodic() {
//new LEDSetRainbow();
scheduler.run();
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/stuypulse/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
import com.stuypulse.robot.commands.arm.*;
import com.stuypulse.robot.commands.arm.routines.*;
import com.stuypulse.robot.commands.auton.*;
import com.stuypulse.robot.commands.auton.battlecry.BCThreePieceBumpBlue;
import com.stuypulse.robot.commands.auton.battlecry.BCThreePieceBumpRed;
import com.stuypulse.robot.commands.auton.battlecry.BCTwoPieceDockBumpBlue;
import com.stuypulse.robot.commands.auton.battlecry.BCTwoPieceDockBumpRed;
import com.stuypulse.robot.commands.intake.*;
import com.stuypulse.robot.commands.leds.LEDSet;
import com.stuypulse.robot.commands.manager.*;
Expand All @@ -31,12 +27,14 @@
import com.stuypulse.robot.subsystems.Manager.*;
import com.stuypulse.robot.subsystems.arm.*;
import com.stuypulse.robot.subsystems.intake.*;
import com.stuypulse.robot.subsystems.leds.LEDController;
import com.stuypulse.robot.subsystems.odometry.*;
import com.stuypulse.robot.subsystems.plant.*;
import com.stuypulse.robot.subsystems.swerve.*;
import com.stuypulse.robot.subsystems.vision.*;
import com.stuypulse.robot.subsystems.wing.*;
import com.stuypulse.robot.util.*;

import com.stuypulse.robot.util.BootlegXbox;

import edu.wpi.first.cameraserver.CameraServer;
Expand Down Expand Up @@ -236,6 +234,8 @@ private void configureOperatorBindings() {
/**************/

public void configureAutons() {
autonChooser.setDefaultOption("Do Nothing", new DoNothing());
/*
autonChooser.addOption("Do Nothing", new DoNothing());
autonChooser.addOption("Mobility", new Mobility());

Expand Down Expand Up @@ -266,7 +266,7 @@ public void configureAutons() {
// autonChooser.addOption("Three Piece Bump Removed Blue", new BCThreePieceBumpBlue());
// autonChooser.addOption("Three Piece Bump Removed Red", new BCThreePieceBumpRed());
autonChooser.addOption("Three Piece Bump", new ThreePieceBump());

*/
SmartDashboard.putData("Autonomous", autonChooser);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.stuypulse.stuylib.streams.filters.IFilter;
import com.stuypulse.robot.constants.ArmTrajectories;
import com.stuypulse.robot.constants.Settings;
import com.stuypulse.robot.subsystems.LEDController;
import com.stuypulse.robot.constants.Settings.Alignment;
import com.stuypulse.robot.constants.Settings.Alignment.Rotation;
import com.stuypulse.robot.constants.Settings.Alignment.Translation;
Expand All @@ -21,6 +20,7 @@
import com.stuypulse.robot.subsystems.Manager.NodeLevel;
import com.stuypulse.robot.subsystems.arm.Arm;
import com.stuypulse.robot.subsystems.intake.*;
import com.stuypulse.robot.subsystems.leds.LEDController;
import com.stuypulse.robot.subsystems.odometry.Odometry;
import com.stuypulse.robot.subsystems.swerve.SwerveDrive;
import com.stuypulse.robot.util.Derivative;
Expand All @@ -41,6 +41,7 @@ public class RobotAlignThenScore extends CommandBase {
private final SwerveDrive swerve;
private final Arm arm;
private final Intake intake;
private final LEDController leds;

private final Manager manager;

Expand All @@ -61,6 +62,7 @@ public RobotAlignThenScore() {
this.arm = Arm.getInstance();
this.intake = Intake.getInstance();
manager = Manager.getInstance();
this.leds = LEDController.getInstance();

controller = new HolonomicController(
new PIDController(Translation.P,Translation.I,Translation.D),
Expand Down Expand Up @@ -111,7 +113,7 @@ public void initialize() {

xErrorChange.reset();

LEDController.getInstance().setColor(LEDColor.BLUE, 694000000);
leds.forceSetLED(LEDColor.BLUE);
}

@Override
Expand Down Expand Up @@ -179,7 +181,7 @@ public void end(boolean interupted) {
intake.stop();
targetPose2d.setPose(Double.NaN, Double.NaN, new Rotation2d(Double.NaN));

LEDController.getInstance().setColor(LEDController.getInstance().getDefaultColor(), 0);
leds.forceSetLED(leds.getDefaultColor());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import com.stuypulse.stuylib.streams.booleans.BStream;
import com.stuypulse.stuylib.streams.booleans.filters.BDebounceRC;

import com.stuypulse.robot.subsystems.LEDController;
import com.stuypulse.robot.constants.ArmTrajectories;
import com.stuypulse.robot.constants.Settings;
import com.stuypulse.robot.subsystems.leds.LEDController;
import com.stuypulse.robot.constants.Settings.Alignment;
import com.stuypulse.robot.constants.Settings.Alignment.Rotation;
import com.stuypulse.robot.constants.Settings.Alignment.Translation;
Expand All @@ -33,6 +35,7 @@ public class RobotAlignThenScoreCubes extends CommandBase {
// Subsystems
private final SwerveDrive swerve;
private final Intake intake;
private final LEDController leds;

private final Manager manager;

Expand All @@ -48,6 +51,7 @@ public RobotAlignThenScoreCubes(){
this.swerve = SwerveDrive.getInstance();
this.intake = Intake.getInstance();
manager = Manager.getInstance();
this.leds = LEDController.getInstance();

controller = new HolonomicController(
new PIDController(Translation.P,Translation.I,Translation.D),
Expand Down Expand Up @@ -91,7 +95,7 @@ public void initialize() {
intake.enableBreak();
Odometry.USE_VISION_ANGLE.set(true);

LEDController.getInstance().setColor(LEDColor.BLUE, 694000000);
leds.forceSetLED(LEDColor.BLUE);
}

@Override
Expand All @@ -109,7 +113,7 @@ public void execute() {

// simply outtake when low
if (manager.getNodeLevel() == NodeLevel.LOW) {
LEDController.getInstance().setColor(LEDColor.GREEN, 694000000);
leds.forceSetLED(LEDColor.GREEN);
intake.deacquire();
}

Expand All @@ -119,7 +123,7 @@ public void execute() {

// only score for cubes
if (manager.getGamePiece().isCube()) {
LEDController.getInstance().setColor(LEDColor.GREEN, 694000000);
leds.forceSetLED(LEDColor.GREEN);
intake.deacquire();
}
}
Expand All @@ -144,7 +148,7 @@ public void end(boolean interupted) {
intake.stop();
targetPose2d.setPose(Double.NaN, Double.NaN, new Rotation2d(Double.NaN));

LEDController.getInstance().setColor(LEDController.getInstance().getDefaultColor(), 0);
leds.forceSetLED(leds.getDefaultColor());
}

}
Loading