Merge branch 'master' of https://git.demerso.net/pls5618/2024/betabot-2024
This commit is contained in:
commit
9ab81ec052
@ -5,6 +5,7 @@
|
||||
package frc.robot;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import edu.wpi.first.cameraserver.CameraServer;
|
||||
import edu.wpi.first.math.MathUtil;
|
||||
import edu.wpi.first.networktables.GenericEntry;
|
||||
@ -36,13 +37,16 @@ import frc.robot.commands.accumulateurtest;
|
||||
import frc.robot.subsystems.Accumulateur;
|
||||
import frc.robot.subsystems.Drive;
|
||||
import frc.robot.subsystems.Lanceur;
|
||||
|
||||
import frc.robot.subsystems.limelight;
|
||||
import frc.robot.commands.AprilTag;
|
||||
public class RobotContainer {
|
||||
|
||||
String avancergaucheString = "droite";
|
||||
String avancerautoString = "gauche";
|
||||
ShuffleboardLayout layoutauto = Shuffleboard.getTab("Dashboard").getLayout("auto", BuiltInLayouts.kList);
|
||||
SendableChooser<String> chooser = new SendableChooser<>();
|
||||
|
||||
limelight limelight = new limelight();
|
||||
Lanceur lanceur = new Lanceur();
|
||||
Accumulateur accumulateur = new Accumulateur();
|
||||
Drive drive = new Drive();
|
||||
@ -78,6 +82,7 @@ String avancerautoString = "gauche";
|
||||
chooser.addOption(avancergaucheString, avancergaucheString);
|
||||
layoutauto.add("choix hauteur", chooser);
|
||||
accumulateurtest accumulateurtest = new accumulateurtest(accumulateur);
|
||||
AprilTag aprilTag = new AprilTag(limelight, lanceur);
|
||||
Force1 Force1 = new Force1(lanceur, force1);
|
||||
Force2 Force2 = new Force2(lanceur, force2);
|
||||
Force3 Force3 = new Force3(lanceur, force3);
|
||||
@ -87,7 +92,7 @@ String avancerautoString = "gauche";
|
||||
Force7 Force7 = new Force7(lanceur, force7);
|
||||
|
||||
//touche
|
||||
|
||||
joystick1.button(2).whileTrue(aprilTag);
|
||||
joystick1.button(3).whileTrue(accumulateurtest);
|
||||
joystick1.button(1).whileTrue(Force1);
|
||||
joystick1.button(7).whileTrue(Force2);
|
||||
|
53
src/main/java/frc/robot/commands/AprilTag.java
Normal file
53
src/main/java/frc/robot/commands/AprilTag.java
Normal file
@ -0,0 +1,53 @@
|
||||
// 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 java.util.function.DoubleSupplier;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc.robot.subsystems.Drive;
|
||||
import frc.robot.subsystems.Lanceur;
|
||||
import frc.robot.subsystems.limelight;
|
||||
|
||||
public class AprilTag extends CommandBase {
|
||||
private Lanceur lanceur;
|
||||
private limelight limelight;
|
||||
|
||||
/** Creates a new Limelight. */
|
||||
public AprilTag(limelight limelight,Lanceur lanceur) {
|
||||
this.lanceur = lanceur;
|
||||
this.limelight = limelight;
|
||||
addRequirements(limelight,lanceur);
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
}
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {
|
||||
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
//drive.drive(0, limelight.getYaw(), 0);
|
||||
if(limelight.tv.getDouble(0) == 1){
|
||||
lanceur.lancer(0.5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
lanceur.lancer(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -7,6 +7,8 @@ package frc.robot.subsystems;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.kauailabs.navx.frc.AHRS;
|
||||
|
||||
import edu.wpi.first.math.geometry.Translation2d;
|
||||
import edu.wpi.first.math.kinematics.SwerveModulePosition;
|
||||
import edu.wpi.first.wpilibj.Filesystem;
|
||||
@ -38,11 +40,18 @@ public class Drive extends SubsystemBase {
|
||||
final CanAndCoderSwerve avantgaucheangle = new CanAndCoderSwerve(Constants.avantgaucheAngle);
|
||||
final CanAndCoderSwerve arrieregaucheangle = new CanAndCoderSwerve(Constants.arrieregaucheAngle);
|
||||
final CanAndCoderSwerve arrieredroitangle = new CanAndCoderSwerve(Constants.arrieredroitAngle); */
|
||||
<<<<<<< HEAD
|
||||
public void drive(double x, double y, double zRotation){
|
||||
swerveDrive.drive(new Translation2d(x*5, y*5), zRotation, true, false);
|
||||
}
|
||||
|
||||
|
||||
=======
|
||||
public void drive(double x, double y, double zRotation){
|
||||
swerveDrive.drive(new Translation2d(x*2, y*2), zRotation, true, false);}
|
||||
|
||||
|
||||
>>>>>>> 05182be6b406e77cf3fc555805b04dba72ec611b
|
||||
|
||||
/** Creates a new Drive. */
|
||||
public Drive() {
|
||||
|
37
src/main/java/frc/robot/subsystems/limelight.java
Normal file
37
src/main/java/frc/robot/subsystems/limelight.java
Normal file
@ -0,0 +1,37 @@
|
||||
// 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 org.photonvision.common.hardware.VisionLEDMode;
|
||||
|
||||
import edu.wpi.first.networktables.NetworkTableEntry;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class limelight extends SubsystemBase {
|
||||
public NetworkTableEntry tv = NetworkTableInstance.getDefault().getTable("limelight").getEntry("tv");
|
||||
limelight limelight = new limelight();
|
||||
/** Creates a new limelight. */
|
||||
public limelight() {}
|
||||
|
||||
/*public void lumiere(){
|
||||
limelight.setLED(VisionLEDMode.kOff);
|
||||
limelight.setPipelineIndex(0);
|
||||
}*/
|
||||
/*public double getYaw() {
|
||||
var result = limelight.getLatestResult();
|
||||
if(result.hasTargets()){
|
||||
return -result.getBestTarget().getYaw()/45;
|
||||
}
|
||||
return 0;}*/
|
||||
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
// This method will be called once per scheduler run
|
||||
}
|
||||
}
|
57
vendordeps/photonlib.json
Normal file
57
vendordeps/photonlib.json
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"fileName": "photonlib.json",
|
||||
"name": "photonlib",
|
||||
"version": "v2024.1.4",
|
||||
"uuid": "515fe07e-bfc6-11fa-b3de-0242ac130004",
|
||||
"frcYear": "2024",
|
||||
"mavenUrls": [
|
||||
"https://maven.photonvision.org/repository/internal",
|
||||
"https://maven.photonvision.org/repository/snapshots"
|
||||
],
|
||||
"jsonUrl": "https://maven.photonvision.org/repository/internal/org/photonvision/photonlib-json/1.0/photonlib-json-1.0.json",
|
||||
"jniDependencies": [],
|
||||
"cppDependencies": [
|
||||
{
|
||||
"groupId": "org.photonvision",
|
||||
"artifactId": "photonlib-cpp",
|
||||
"version": "v2024.1.4",
|
||||
"libName": "photonlib",
|
||||
"headerClassifier": "headers",
|
||||
"sharedLibrary": true,
|
||||
"skipInvalidPlatforms": true,
|
||||
"binaryPlatforms": [
|
||||
"windowsx86-64",
|
||||
"linuxathena",
|
||||
"linuxx86-64",
|
||||
"osxuniversal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"groupId": "org.photonvision",
|
||||
"artifactId": "photontargeting-cpp",
|
||||
"version": "v2024.1.4",
|
||||
"libName": "photontargeting",
|
||||
"headerClassifier": "headers",
|
||||
"sharedLibrary": true,
|
||||
"skipInvalidPlatforms": true,
|
||||
"binaryPlatforms": [
|
||||
"windowsx86-64",
|
||||
"linuxathena",
|
||||
"linuxx86-64",
|
||||
"osxuniversal"
|
||||
]
|
||||
}
|
||||
],
|
||||
"javaDependencies": [
|
||||
{
|
||||
"groupId": "org.photonvision",
|
||||
"artifactId": "photonlib-java",
|
||||
"version": "v2024.1.4"
|
||||
},
|
||||
{
|
||||
"groupId": "org.photonvision",
|
||||
"artifactId": "photontargeting-java",
|
||||
"version": "v2024.1.4"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user