Compare commits

...

10 Commits

Author SHA1 Message Date
Antoine PerreaultE
9ab81ec052 Merge branch 'master' of https://git.demerso.net/pls5618/2024/betabot-2024 2024-01-23 18:46:42 -05:00
Antoine PerreaultE
b0a3bbd4d8 rfvwe 2024-01-23 18:46:30 -05:00
05182be6b4 limelight 2024-01-17 19:40:57 -05:00
1030a95456 limelight 2024-01-15 18:56:17 -05:00
samuel desharnais
6c9a52775b fchg 2024-01-10 20:01:12 -05:00
Antoine PerreaultE
0f6021bcd6 dgxfbgnm 2024-01-10 19:13:08 -05:00
Antoine PerreaultE
55553c9ab8 Merge branch 'master' of https://git.demerso.net/pls5618/2024/betabot-2024 2024-01-10 19:04:01 -05:00
Antoine PerreaultE
6c93d58f09 dgfbcg 2024-01-10 19:03:59 -05:00
199e5a02ed droite et gauche 2023-12-06 20:26:16 -05:00
6635939b11 gvnb 2023-12-06 20:08:38 -05:00
9 changed files with 176 additions and 452 deletions

View File

@ -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;
@ -31,19 +32,21 @@ import frc.robot.commands.Force5;
import frc.robot.commands.Force6;
import frc.robot.commands.Force7;
import frc.robot.commands.LanceurAuto;
import frc.robot.commands.Force1;
import frc.robot.commands.AvancerGauche;
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 = "avancergaucheString";
String avancerautoString = "avancerautoString";
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();
@ -70,7 +73,7 @@ String avancerautoString = "avancerautoString";
CameraServer.startAutomaticCapture();
configureBindings();
drive.setDefaultCommand(new RunCommand(()->{
drive.drive(-joystick1.getY(), -joystick1.getX(), MathUtil.applyDeadband(-joystick1.getZ(), 0.2));
drive.drive(-MathUtil.applyDeadband(joystick1.getY(),0.2), MathUtil.applyDeadband(-joystick1.getX(),0.2), MathUtil.applyDeadband(-joystick1.getZ(), 0.2));
},drive));
}
@ -79,6 +82,7 @@ String avancerautoString = "avancerautoString";
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);
@ -88,7 +92,7 @@ String avancerautoString = "avancerautoString";
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);
@ -102,8 +106,7 @@ String avancerautoString = "avancerautoString";
public Command getAutonomousCommand() {
chooser.getSelected();
return new SequentialCommandGroup(new ParallelCommandGroup(new LanceurAuto(lanceur).withTimeout(6)
,new AccAuto(accumulateur).withTimeout(6)), Commands.waitSeconds(6),
return new ParallelCommandGroup( Commands.waitSeconds(6),
Commands.select(Map.ofEntries(
Map.entry(avancerautoString,avancer),
Map.entry(avancergaucheString, avancerGauche)

View 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;
}
}

View File

@ -38,18 +38,16 @@ public class Avancer extends CommandBase {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
drive.drive(0.5, 0.2, 0);
drive.drive(0.5, -0.2, 0);
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
drive.drive(0, 0, 0);
}
public void end(boolean interrupted) {}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return drive.distance()[0].distanceMeters>0.01;
return drive.distance()[0].distanceMeters>1;
}
}

View File

@ -31,7 +31,7 @@ public class Force1 extends CommandBase {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
lanceur.lancer(0.3);
lanceur.lancer(0.33);
}
// Called once the command ends or is interrupted.

View File

@ -24,7 +24,7 @@ public class LanceurAuto extends CommandBase {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
lanceur.lancer(0.75);
lanceur.lancer(0.755);
}
// Called once the command ends or is interrupted.

View File

@ -7,25 +7,17 @@ package frc.robot.subsystems;
import java.io.File;
import java.io.IOException;
import edu.wpi.first.cameraserver.CameraServer;
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;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.kinematics.SwerveModulePosition;
import edu.wpi.first.wpilibj.Filesystem;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
import swervelib.SwerveDrive;
import swervelib.encoders.CanAndCoderSwerve;
import swervelib.parser.SwerveParser;
public class Drive extends SubsystemBase {
@ -48,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, y), zRotation, false, false);
}
swerveDrive.drive(new Translation2d(x*2, y*2), zRotation, true, false);}
>>>>>>> 05182be6b406e77cf3fc555805b04dba72ec611b
/** Creates a new Drive. */
public Drive() {

View 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
}
}

View File

@ -1,423 +0,0 @@
{
"fileName": "Phoenix.json",
"name": "CTRE-Phoenix (v5)",
"version": "5.31.0+23.2.2",
"frcYear": 2023,
"uuid": "ab676553-b602-441f-a38d-f1296eff6537",
"mavenUrls": [
"https://maven.ctr-electronics.com/release/"
],
"jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2023-latest.json",
"javaDependencies": [
{
"groupId": "com.ctre.phoenix",
"artifactId": "api-java",
"version": "5.31.0"
},
{
"groupId": "com.ctre.phoenix",
"artifactId": "wpiapi-java",
"version": "5.31.0"
}
],
"jniDependencies": [
{
"groupId": "com.ctre.phoenix",
"artifactId": "cci",
"version": "5.31.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"linuxathena"
],
"simMode": "hwsim"
},
{
"groupId": "com.ctre.phoenix.sim",
"artifactId": "cci-sim",
"version": "5.31.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6",
"artifactId": "tools",
"version": "23.2.2",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"linuxathena"
],
"simMode": "hwsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "tools-sim",
"version": "23.2.2",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simTalonSRX",
"version": "23.2.2",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simTalonFX",
"version": "23.2.2",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simVictorSPX",
"version": "23.2.2",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simPigeonIMU",
"version": "23.2.2",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simCANCoder",
"version": "23.2.2",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProTalonFX",
"version": "23.2.2",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProCANcoder",
"version": "23.2.2",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProPigeon2",
"version": "23.2.2",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
}
],
"cppDependencies": [
{
"groupId": "com.ctre.phoenix",
"artifactId": "wpiapi-cpp",
"version": "5.31.0",
"libName": "CTRE_Phoenix_WPI",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"linuxathena"
],
"simMode": "hwsim"
},
{
"groupId": "com.ctre.phoenix",
"artifactId": "api-cpp",
"version": "5.31.0",
"libName": "CTRE_Phoenix",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"linuxathena"
],
"simMode": "hwsim"
},
{
"groupId": "com.ctre.phoenix",
"artifactId": "cci",
"version": "5.31.0",
"libName": "CTRE_PhoenixCCI",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"linuxathena"
],
"simMode": "hwsim"
},
{
"groupId": "com.ctre.phoenix6",
"artifactId": "tools",
"version": "23.2.2",
"libName": "CTRE_PhoenixTools",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"linuxathena"
],
"simMode": "hwsim"
},
{
"groupId": "com.ctre.phoenix.sim",
"artifactId": "wpiapi-cpp-sim",
"version": "5.31.0",
"libName": "CTRE_Phoenix_WPISim",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix.sim",
"artifactId": "api-cpp-sim",
"version": "5.31.0",
"libName": "CTRE_PhoenixSim",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix.sim",
"artifactId": "cci-sim",
"version": "5.31.0",
"libName": "CTRE_PhoenixCCISim",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "tools-sim",
"version": "23.2.2",
"libName": "CTRE_PhoenixTools_Sim",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simTalonSRX",
"version": "23.2.2",
"libName": "CTRE_SimTalonSRX",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simTalonFX",
"version": "23.2.2",
"libName": "CTRE_SimTalonFX",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simVictorSPX",
"version": "23.2.2",
"libName": "CTRE_SimVictorSPX",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simPigeonIMU",
"version": "23.2.2",
"libName": "CTRE_SimPigeonIMU",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simCANCoder",
"version": "23.2.2",
"libName": "CTRE_SimCANCoder",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProTalonFX",
"version": "23.2.2",
"libName": "CTRE_SimProTalonFX",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProCANcoder",
"version": "23.2.2",
"libName": "CTRE_SimProCANcoder",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProPigeon2",
"version": "23.2.2",
"libName": "CTRE_SimProPigeon2",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
}
]
}

57
vendordeps/photonlib.json Normal file
View 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"
}
]
}