-
Notifications
You must be signed in to change notification settings - Fork 0
Limelight2.0 #4
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
Open
DevenVElani
wants to merge
32
commits into
main
Choose a base branch
from
limelight2.0
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
Limelight2.0 #4
Changes from 7 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
9c89a6b
problems
cookieandrew e23d6ba
new
cookieandrew 3cc8adc
new new
RundleRoboticsGithub 58b2e5f
new new new new
RundleRoboticsGithub 15c4805
new new new new new
cookieandrew eba3fed
new x10 to the 2
RundleRoboticsGithub 5edbb34
limelight Area targeting
cookieandrew 0d3be4d
limelight drive closer draft (new new new new new)
cookieandrew ebb2f57
added ta thing
cookieandrew 15b1a55
neo thing. unimportant do not return
cookieandrew 9698ee5
reduced motor spinning speed
RundleRoboticsGithub 8d836b9
limelight code Functions
cookieandrew 583edde
garbage
RundleRoboticsGithub 4afc959
Limelight new new new with added new
RundleRoboticsGithub c266d94
Merge branch 'limelight2.0' of https://github.com/Rundle-Robotics/202…
RundleRoboticsGithub f3a5376
Fix horrendous formatting
damians13 8d843ef
Add cap() and print statements
damians13 5106392
Simplify execute
damians13 4a32e0e
Simplify execute
damians13 419998e
Merge branch 'limelight2.0' of https://github.com/Rundle-Robotics/202…
damians13 e848e04
small fixes
RundleRoboticsGithub 9ae16f0
Limelight Auto Update
cookieandrew c723bd9
new changes limelight with drivetrain
RundleRoboticsGithub 71c17a7
Add pipeline switching
damians13 5e7a13a
Mostly wokrs
RundleRoboticsGithub 84d3c9d
Limelight methods working
RundleRoboticsGithub b5362c3
TSHORT TLONG UPDATES
cookieandrew 67b3cf5
TCORNXY
cookieandrew a48a5e4
idek and idec
cookieandrew 5e05c70
ODD UPDATES
RundleRoboticsGithub 4cabc44
i should be an engineer
RundleRoboticsGithub 37da313
Add debug code for SmartDashboard
damians13 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 hidden or 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
Empty file.
This file contains hidden or 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 hidden or 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 hidden or 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,88 @@ | ||
| // Copyright (c) FIRST and other WPILib contributors. | ||
| // Open Source Software; you can modify and/or share it under the terms of | ||
| // the WPILib BSD license file in the root directory of this project. | ||
|
|
||
| package frc.robot.commands; | ||
|
|
||
| import edu.wpi.first.wpilibj2.command.CommandBase; | ||
| import frc.robot.RobotContainer; | ||
| import frc.robot.subsystems.Drivetrain; | ||
| import frc.robot.subsystems.Limelight; | ||
|
|
||
|
|
||
| public class LimelightFollow extends CommandBase { | ||
| /** Creates a new LimelightFollow. */ | ||
|
|
||
|
|
||
| private Drivetrain drivetrain; | ||
| private Limelight limelight; | ||
|
|
||
|
|
||
|
|
||
|
|
||
| public LimelightFollow(Drivetrain drivetrain, Limelight limelight) { | ||
| this.drivetrain = drivetrain; | ||
| this.limelight = limelight; | ||
|
|
||
| addRequirements(drivetrain); | ||
| addRequirements(limelight); | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| } | ||
|
|
||
|
|
||
| // Called when the command is initially scheduled. | ||
| @Override | ||
| public void initialize() { | ||
| Limelight.enableLimelight(); | ||
| } | ||
|
|
||
| // Called every time the scheduler runs while the command is scheduled. | ||
| @Override | ||
| public void execute() { | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| if (limelight.getTV() == 0){ | ||
| drivetrain.setSpeeds(0, .5); | ||
|
|
||
|
|
||
| } | ||
| else if (Math.abs(limelight.getTX()) > 1){ | ||
| drivetrain.setSpeeds(0,limelight.getTX() / Math.abs(limelight.getTX()) * 0.5); | ||
|
|
||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
| // Called once the command ends or is interrupted. | ||
| @Override | ||
| public void end(boolean interrupted) { | ||
|
|
||
| limelight.disableLimelight(); | ||
| } | ||
|
|
||
| // Returns true when the command should end. | ||
| @Override | ||
| public boolean isFinished() { | ||
| return false; | ||
|
|
||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 @@ | ||
| // Copyright (c) FIRST and other WPILib contributors. | ||
| // Open Source Software; you can modify and/or share it under the terms of | ||
| // the WPILib BSD license file in the root directory of this project. | ||
|
|
||
| package frc.robot.subsystems; | ||
|
|
||
| import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
| import frc.robot.RobotContainer; | ||
| import edu.wpi.first.networktables.NetworkTable; | ||
| import edu.wpi.first.networktables.NetworkTableInstance; | ||
| import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | ||
| import edu.wpi.first.wpilibj.XboxController; | ||
| import frc.robot.commands.LimelightFollow;; | ||
| public class Limelight extends SubsystemBase { | ||
| private static NetworkTable table; | ||
|
|
||
| private double tx; | ||
| private double ty; | ||
| private double ta; | ||
| private double apriltagid; | ||
|
|
||
|
|
||
| /** Creates a new Limelight. */ | ||
| public Limelight() { | ||
| table = NetworkTableInstance.getDefault().getTable("limelight"); | ||
| disableLimelight(); | ||
|
|
||
|
|
||
| } | ||
|
|
||
| public static void enableLimelight() { | ||
| table.getEntry("ledMode").setNumber(3); | ||
| } | ||
| public void disableLimelight() { | ||
| table.getEntry("ledMode").setNumber(1); | ||
| } | ||
|
|
||
| @Override | ||
| public void periodic() { | ||
| tx = table.getEntry("tx").getDouble(0.0); | ||
| ty = table.getEntry("ty").getDouble(0.0); | ||
| ta = table.getEntry("ta").getDouble(0.0); | ||
|
|
||
|
|
||
|
|
||
|
|
||
| apriltagid = table.getEntry("tid").getDouble(0.0); | ||
|
|
||
| SmartDashboard.putNumber("x offset", tx); | ||
| SmartDashboard.putNumber("y offset", ty); | ||
| SmartDashboard.putNumber("area", ta); | ||
|
|
||
| SmartDashboard.putNumber("TId", apriltagid); | ||
|
|
||
| limelightCenter(); | ||
ishanvermani marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
|
|
||
| } | ||
| public double getTX(){ | ||
| return table.getEntry("tx").getDouble(0.0); | ||
| } | ||
| public double getTV(){ | ||
| return table.getEntry("tv").getDouble(0.0); | ||
| } | ||
|
|
||
|
||
|
|
||
| public void limelightCenter() { | ||
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.