This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
simple lights red when we are in endgame #9
Open
maxspier
wants to merge
6
commits into
main
Choose a base branch
from
candle-lights
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
import edu.wpi.first.wpilibj.DriverStation; | ||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | ||
|
||
|
||
/** | ||
* This class is the glue that binds the controls on the physical operator | ||
* interface to the code that allow control of the robot. | ||
|
@@ -66,6 +67,7 @@ public void run(Context context) { | |
context.takeOwnership(Robot.drive); | ||
// context.takeOwnership(Robot.intake); | ||
context.takeOwnership(Robot.gyro); | ||
context.takeOwnership(Robot.lights); | ||
|
||
while (true) { | ||
context.waitFor(() -> RobotProvider.instance.hasNewDriverStationData()); | ||
|
@@ -87,6 +89,9 @@ public void run(Context context) { | |
// SmartDashboard.putString("Alliance", "NULLLLLLLLL"); | ||
// } | ||
|
||
if(DriverStation.isTeleop() && DriverStation.getMatchTime() < 30){ | ||
Robot.lights.signalMalfunction(); | ||
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. why malfunction? |
||
} | ||
|
||
if (leftJoystick.getButtonPressed(InputConstants.RESET_GYRO)) { | ||
Robot.gyro.resetGyro(); | ||
|
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 |
---|---|---|
@@ -1,30 +1,49 @@ | ||
package com.team766.robot.mechanisms; | ||
import com.ctre.phoenix.led.CANdle; | ||
import com.ctre.phoenix.led.RainbowAnimation; | ||
import com.team766.framework.Mechanism; | ||
|
||
|
||
public class Lights extends Mechanism{ | ||
|
||
private CANdle candle; | ||
private static final int CANID = 5; | ||
private int numLEDs = 8; | ||
RainbowAnimation rainbowAnim = new RainbowAnimation(1, 0.5, numLEDs); | ||
|
||
public Lights(){ | ||
candle = new CANdle(CANID); | ||
|
||
} | ||
|
||
public void purple(){ | ||
public void setNumLEDs(int num){ | ||
checkContextOwnership(); | ||
numLEDs = num; | ||
rainbowAnim.setNumLed(num); | ||
} | ||
|
||
public void signalCube(){ | ||
checkContextOwnership(); | ||
candle.setLEDs(128, 0, 128); | ||
} | ||
|
||
public void white(){ | ||
public void resetLights(){ | ||
checkContextOwnership(); | ||
candle.setLEDs(255, 255, 255); | ||
} | ||
|
||
public void yellow(){ | ||
public void signalCone(){ | ||
checkContextOwnership(); | ||
candle.setLEDs(255, 255, 0); | ||
} | ||
|
||
public void signalMalfunction(){ | ||
checkContextOwnership(); | ||
candle.setLEDs(255, 0, 0); | ||
} | ||
|
||
public void signalBalance(){ | ||
checkContextOwnership(); | ||
candle.animate(rainbowAnim); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
we should only grab ownership of lights for the small chunk where needed (below) as other mechanisms will also use Lights.