generated from DeepBlueRobotics/EmptyProject2024
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into camera-skt
- Loading branch information
Showing
11 changed files
with
120 additions
and
93 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,5 @@ | ||
# All PRs need to be approved by a member of the reviewers team | ||
# Note that for this to work, the repository's access settings (https://github.com/DeepBlueRobotics/RobotCode2024/settings/access) | ||
# need to be configured to allow the reviewers team (or a parent team like devs) to explicitly have write (or higher) access. | ||
# It isn't sufficient for all org members to have write access. | ||
* @DeepBlueRobotics/reviewers |
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,20 @@ | ||
name: Java CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
- name: Build with Gradle | ||
run: ./gradlew build |
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
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
43 changes: 0 additions & 43 deletions
43
src/main/java/org/carlmontrobotics/commands/AimArmSpeaker.java
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
src/main/java/org/carlmontrobotics/commands/AimAtSpeaker.java
This file was deleted.
Oops, something went wrong.
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
59 changes: 59 additions & 0 deletions
59
src/main/java/org/carlmontrobotics/commands/MoveToNote.java
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,59 @@ | ||
// 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 org.carlmontrobotics.commands; | ||
|
||
import org.carlmontrobotics.Constants.Limelightc; | ||
import org.carlmontrobotics.subsystems.Drivetrain; | ||
import org.carlmontrobotics.subsystems.Limelight; | ||
import org.carlmontrobotics.subsystems.LimelightHelpers; | ||
|
||
import edu.wpi.first.math.util.Units; | ||
import edu.wpi.first.wpilibj.Timer; | ||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
|
||
public class MoveToNote extends Command { | ||
private final Drivetrain dt; | ||
private final Limelight ll; | ||
private Timer timer = new Timer(); | ||
private boolean originalFieldOrientation; | ||
/** Creates a new MoveToNote. */ | ||
public MoveToNote(Drivetrain dt, Limelight ll) { | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
addRequirements(this.dt=dt); | ||
this.ll = ll; | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
originalFieldOrientation = dt.getFieldOriented(); | ||
timer.reset(); | ||
timer.start(); | ||
dt.setFieldOriented(false); | ||
} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() { | ||
double radErr = Units.degreesToRadians(LimelightHelpers.getTX(Limelightc.INTAKE_LL_NAME)); | ||
double distErr = ll.getDistanceToNoteMeters(); //meters | ||
double forwardErr = distErr * Math.cos(radErr); | ||
dt.drive(Math.max(forwardErr*2, .5), 0, 0); | ||
//180deg is about 6.2 rad/sec, min is .5rad/sec | ||
} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
dt.setFieldOriented(originalFieldOrientation); | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
return timer.get() >= 0.5; | ||
} | ||
} |
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