Compare commits
	
		
			34 Commits
		
	
	
		
			Lanceur
			...
			104c9195bc
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 104c9195bc | ||
|  | 205da73570 | ||
| 1989806378 | |||
| fd72aaf8bd | |||
|  | 99525dc7d7 | ||
|  | 2533a3a462 | ||
|  | ed5d3bc08b | ||
|  | e9f55c9fd6 | ||
| bde1715f76 | |||
|  | 48a4f2e0f4 | ||
|  | fc75e1f997 | ||
|  | d6508d513b | ||
| 1a899887da | |||
| 7e65352246 | |||
|  | ee263139c1 | ||
|  | 938198d4e2 | ||
|  | b460501b95 | ||
|  | 5e39e6fc4d | ||
|  | 6bec6011ca | ||
| e1111511b7 | |||
| c3d4b8c43c | |||
| 4944f4662b | |||
|  | 4f6552202c | ||
|  | adb6d5554f | ||
| eca7bb1891 | |||
| 6687dc73ea | |||
|  | ea96a16864 | ||
|  | dfa05d79a7 | ||
| 650e8341ec | |||
|  | 025d9e47f0 | ||
| f0cdb9a241 | |||
| ae9e9577c2 | |||
|  | 89d155ae5e | ||
|  | 787251658c | 
							
								
								
									
										1
									
								
								src/main/deploy/pathplanner/navgrid.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/main/deploy/pathplanner/navgrid.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										8
									
								
								src/main/deploy/swerve/controllerproperties.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/main/deploy/swerve/controllerproperties.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | { | ||||||
|  |   "angleJoystickRadiusDeadband": 0.5, | ||||||
|  |   "heading": { | ||||||
|  |     "p": 0.4, | ||||||
|  |     "i": 0, | ||||||
|  |     "d": 0.01 | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										30
									
								
								src/main/deploy/swerve/modules/backleft.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/main/deploy/swerve/modules/backleft.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | |||||||
|  | { | ||||||
|  |   "location": { | ||||||
|  |     "front": -12.375, | ||||||
|  |     "left": 12.375 | ||||||
|  |   }, | ||||||
|  |   "absoluteEncoderOffset":209.443, | ||||||
|  |   "drive": { | ||||||
|  |     "type": "talonFX", | ||||||
|  |     "id": 8, | ||||||
|  |     "canbus": null | ||||||
|  |   }, | ||||||
|  |   "angle": { | ||||||
|  |     "type": "talonFX", | ||||||
|  |     "id": 9, | ||||||
|  |     "canbus": null | ||||||
|  |   }, | ||||||
|  |   "inverted": { | ||||||
|  |     "angle": true, | ||||||
|  |     "drive": false | ||||||
|  |   }, | ||||||
|  |   "conversionFactor": { | ||||||
|  |     "angle": 0, | ||||||
|  |     "drive": 0 | ||||||
|  |   }, | ||||||
|  |   "encoder": { | ||||||
|  |     "type": "cancoder", | ||||||
|  |     "id": 6, | ||||||
|  |     "canbus": null | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										30
									
								
								src/main/deploy/swerve/modules/backright.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/main/deploy/swerve/modules/backright.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | |||||||
|  | { | ||||||
|  |   "location": { | ||||||
|  |     "front": -12.375, | ||||||
|  |     "left": -12.375 | ||||||
|  |   }, | ||||||
|  |   "absoluteEncoderOffset": 5.537, | ||||||
|  |   "drive": { | ||||||
|  |     "type": "sparkmax", | ||||||
|  |     "id": 11, | ||||||
|  |     "canbus": null | ||||||
|  |   }, | ||||||
|  |   "angle": { | ||||||
|  |     "type": "sparkmax", | ||||||
|  |     "id": 12, | ||||||
|  |     "canbus": null | ||||||
|  |   }, | ||||||
|  |   "inverted": { | ||||||
|  |     "angle": true, | ||||||
|  |     "drive": false | ||||||
|  |   }, | ||||||
|  |   "conversionFactor": { | ||||||
|  |     "angle": 0, | ||||||
|  |     "drive": 0 | ||||||
|  |   }, | ||||||
|  |   "encoder": { | ||||||
|  |     "type": "cancoder", | ||||||
|  |     "id": 7, | ||||||
|  |     "canbus": null | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										30
									
								
								src/main/deploy/swerve/modules/frontleft.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/main/deploy/swerve/modules/frontleft.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | |||||||
|  | { | ||||||
|  |   "location": { | ||||||
|  |     "front": 12.375, | ||||||
|  |     "left": 12.375 | ||||||
|  |   }, | ||||||
|  |   "absoluteEncoderOffset":258.223 , | ||||||
|  |   "drive": { | ||||||
|  |     "type": "talonFX", | ||||||
|  |     "id": 2, | ||||||
|  |     "canbus": null | ||||||
|  |   }, | ||||||
|  |   "angle": { | ||||||
|  |     "type": "talonFX", | ||||||
|  |     "id": 3, | ||||||
|  |     "canbus": null | ||||||
|  |   }, | ||||||
|  |   "inverted": { | ||||||
|  |     "angle": true, | ||||||
|  |     "drive": false | ||||||
|  |   }, | ||||||
|  |   "conversionFactor": { | ||||||
|  |     "angle": 0, | ||||||
|  |     "drive": 0 | ||||||
|  |   }, | ||||||
|  |   "encoder": { | ||||||
|  |     "type": "cancoder", | ||||||
|  |     "id": 4, | ||||||
|  |     "canbus": null | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										30
									
								
								src/main/deploy/swerve/modules/frontright.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/main/deploy/swerve/modules/frontright.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | |||||||
|  | { | ||||||
|  |   "location": { | ||||||
|  |     "front": 12.375, | ||||||
|  |     "left": -12.375 | ||||||
|  |   }, | ||||||
|  |   "absoluteEncoderOffset": 110.215, | ||||||
|  |   "drive": { | ||||||
|  |     "type": "talonFX", | ||||||
|  |     "id": 18, | ||||||
|  |     "canbus": null | ||||||
|  |   }, | ||||||
|  |   "angle": { | ||||||
|  |     "type": "talonFX", | ||||||
|  |     "id": 17, | ||||||
|  |     "canbus": null | ||||||
|  |   }, | ||||||
|  |   "inverted": { | ||||||
|  |     "angle": true, | ||||||
|  |     "drive": false | ||||||
|  |   }, | ||||||
|  |   "conversionFactor": { | ||||||
|  |     "angle": 0, | ||||||
|  |     "drive": 0 | ||||||
|  |   }, | ||||||
|  |   "encoder": { | ||||||
|  |     "type": "cancoder", | ||||||
|  |     "id": 5, | ||||||
|  |     "canbus": null | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								src/main/deploy/swerve/modules/physicalproperties.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/main/deploy/swerve/modules/physicalproperties.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | { | ||||||
|  |   "optimalVoltage": 12, | ||||||
|  |   "wheelGripCoefficientOfFriction": 1.19, | ||||||
|  |   "currentLimit": { | ||||||
|  |     "drive": 40, | ||||||
|  |     "angle": 20 | ||||||
|  |   }, | ||||||
|  |   "conversionFactor": { | ||||||
|  |     "angle": 16.8, | ||||||
|  |     "drive": 0.04 | ||||||
|  |   }, | ||||||
|  |   "rampRate": { | ||||||
|  |     "drive": 0.25, | ||||||
|  |     "angle": 0.25 | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								src/main/deploy/swerve/modules/pidfproperties.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/main/deploy/swerve/modules/pidfproperties.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | { | ||||||
|  |   "drive": { | ||||||
|  |     "p": 0.0020645, | ||||||
|  |     "i": 0, | ||||||
|  |     "d": 0, | ||||||
|  |     "f": 0, | ||||||
|  |     "iz": 0 | ||||||
|  |   }, | ||||||
|  |   "angle": { | ||||||
|  |     "p": 0.01, | ||||||
|  |     "i": 0, | ||||||
|  |     "d": 0, | ||||||
|  |     "f": 0, | ||||||
|  |     "iz": 0 | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										14
									
								
								src/main/deploy/swerve/swervedrive.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/main/deploy/swerve/swervedrive.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | { | ||||||
|  |   "imu": { | ||||||
|  |     "type": "pigeon", | ||||||
|  |     "id": 0, | ||||||
|  |     "canbus": null | ||||||
|  |   }, | ||||||
|  |   "invertedIMU": false, | ||||||
|  |   "modules": [ | ||||||
|  |     "frontleft.json", | ||||||
|  |     "frontright.json", | ||||||
|  |     "backleft.json", | ||||||
|  |     "backright.json" | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										42
									
								
								src/main/java/frc/robot/Commands/Desaccumuler.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								src/main/java/frc/robot/Commands/Desaccumuler.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | |||||||
|  | // 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.Command; | ||||||
|  | import frc.robot.Subsystems.Accumulateur; | ||||||
|  |  | ||||||
|  | public class Desaccumuler extends Command { | ||||||
|  |   private Accumulateur accumulateur; | ||||||
|  |   /** Creates a new Desaccumuler. */ | ||||||
|  |   public Desaccumuler(Accumulateur accumulateur){ | ||||||
|  |     this.accumulateur = accumulateur; | ||||||
|  |     addRequirements(accumulateur); | ||||||
|  |     // 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() { | ||||||
|  |     accumulateur.desaccumule(0.1); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Called once the command ends or is interrupted. | ||||||
|  |   @Override | ||||||
|  |   public void end(boolean interrupted) { | ||||||
|  |    accumulateur.desaccumule(0); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Returns true when the command should end. | ||||||
|  |   @Override | ||||||
|  |   public boolean isFinished() { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										54
									
								
								src/main/java/frc/robot/Commands/FollowAprilTag.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								src/main/java/frc/robot/Commands/FollowAprilTag.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | |||||||
|  | // 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.Command; | ||||||
|  | import frc.robot.Subsystems.Drive; | ||||||
|  | import frc.robot.Subsystems.Limelight3G; | ||||||
|  |  | ||||||
|  | public class FollowAprilTag extends Command { | ||||||
|  |  | ||||||
|  |   private Limelight3G enlignement; | ||||||
|  |   private Drive drive; | ||||||
|  |   /** Creates a new Limelight3g. */ | ||||||
|  |   public FollowAprilTag(Limelight3G enlignement, Drive drive) { | ||||||
|  |     // Use addRequirements() here to declare subsystem dependencies. | ||||||
|  |     this.drive = drive; | ||||||
|  |     this.enlignement = enlignement; | ||||||
|  |  | ||||||
|  |     addRequirements(drive, enlignement); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // 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() { | ||||||
|  |  | ||||||
|  |     if (enlignement.getv()==1) | ||||||
|  |     { | ||||||
|  |       drive.drive(0, 0, enlignement.getx()/30); | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |       drive.drive(0, 0, 0); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Called once the command ends or is interrupted. | ||||||
|  |   @Override | ||||||
|  |   public void end(boolean interrupted) { | ||||||
|  |     drive.drive(0, 0, 0); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Returns true when the command should end. | ||||||
|  |   @Override | ||||||
|  |   public boolean isFinished() { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										1265
									
								
								src/main/java/frc/robot/LimelightHelpers.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1265
									
								
								src/main/java/frc/robot/LimelightHelpers.java
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -4,11 +4,20 @@ | |||||||
|  |  | ||||||
| package frc.robot; | package frc.robot; | ||||||
|  |  | ||||||
|  | import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; | ||||||
|  | import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
| import edu.wpi.first.wpilibj2.command.Commands; | import edu.wpi.first.wpilibj2.command.Commands; | ||||||
|  |  | ||||||
| public class RobotContainer { | public class RobotContainer { | ||||||
|  |   ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); | ||||||
|   public RobotContainer() { |   public RobotContainer() { | ||||||
|  |     dashboard.addCamera("limelight3G", "limelight3G","limelight.local:5800") | ||||||
|  |     .withSize(3,4) | ||||||
|  |     .withPosition(0,0); | ||||||
|  |     dashboard.addCamera("limelight3", "limelight3","limelight.local:5800") | ||||||
|  |     .withSize(3,4) | ||||||
|  |     .withPosition(3,0);   | ||||||
|     configureBindings(); |     configureBindings(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										52
									
								
								src/main/java/frc/robot/Subsystems/Accumulateur.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/main/java/frc/robot/Subsystems/Accumulateur.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | |||||||
|  | // 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.networktables.GenericEntry; | ||||||
|  | import edu.wpi.first.wpilibj.DigitalInput; | ||||||
|  | import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; | ||||||
|  | import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; | ||||||
|  | import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; | ||||||
|  | public class Accumulateur extends SubsystemBase { | ||||||
|  |    | ||||||
|  |   /** Creates a new Accumulateur. */ | ||||||
|  |   public Accumulateur() {dashboard.addBoolean("photocellacc", this::limitswitch) | ||||||
|  |     .withSize(1, 1) | ||||||
|  |     .withPosition(0, 1); | ||||||
|  |     | ||||||
|  |     } | ||||||
|  |   ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); | ||||||
|  |    | ||||||
|  |   private GenericEntry vitesse = | ||||||
|  |       dashboard.add("vitesseacc", 0.1) | ||||||
|  |       .withSize(1, 1) | ||||||
|  |       .withPosition(0, 4) | ||||||
|  |       .getEntry();  | ||||||
|  |        | ||||||
|  |   final WPI_TalonSRX accumulateur1 = new WPI_TalonSRX(0); | ||||||
|  |   final WPI_TalonSRX accumulateur2 = new WPI_TalonSRX(10); | ||||||
|  |   final DigitalInput photocell = new DigitalInput(94); | ||||||
|  |   public void encodeur(){ | ||||||
|  |   } | ||||||
|  |   public boolean limitswitch(){ | ||||||
|  |     return !photocell.get(); | ||||||
|  |   } | ||||||
|  |   public void desaccumule(double vitesse){ | ||||||
|  |     accumulateur1.set(vitesse); | ||||||
|  |     accumulateur2.set(-vitesse); | ||||||
|  |   } | ||||||
|  |   public void desaccumule(){ | ||||||
|  |     desaccumule(vitesse.getDouble(0.9)); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   @Override | ||||||
|  |   public void periodic() { | ||||||
|  |     // This method will be called once per scheduler run | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										52
									
								
								src/main/java/frc/robot/Subsystems/Drive.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/main/java/frc/robot/Subsystems/Drive.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | |||||||
|  | // 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 java.io.File; | ||||||
|  | import java.io.IOException; | ||||||
|  |  | ||||||
|  | import com.ctre.phoenix6.hardware.Pigeon2; | ||||||
|  |  | ||||||
|  | import edu.wpi.first.math.geometry.Translation2d; | ||||||
|  | import edu.wpi.first.math.kinematics.SwerveModulePosition; | ||||||
|  | import edu.wpi.first.wpilibj.Filesystem; | ||||||
|  | import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||||||
|  | import swervelib.SwerveDrive; | ||||||
|  | import swervelib.parser.SwerveParser; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | public class Drive extends SubsystemBase { | ||||||
|  |  | ||||||
|  |     SwerveDrive swerveDrive; | ||||||
|  |  | ||||||
|  |   File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve"); | ||||||
|  |    | ||||||
|  |   Pigeon2 Gyro = new Pigeon2(0); | ||||||
|  |     | ||||||
|  |   public void drive(double x, double y, double zRotation){ | ||||||
|  |     swerveDrive.drive(new Translation2d(x*5, y*5), zRotation*4, true, false); | ||||||
|  |   } | ||||||
|  |    | ||||||
|  |   public Drive() { | ||||||
|  |      try { | ||||||
|  |       this.swerveDrive = new SwerveParser(swerveJsonDirectory).createSwerveDrive(5); | ||||||
|  |       swerveDrive.setHeadingCorrection(true); | ||||||
|  |     } catch (IOException e) { | ||||||
|  |       e.printStackTrace(); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   public void restgyroscope(){ | ||||||
|  |     Gyro.reset(); | ||||||
|  |   } | ||||||
|  |   public SwerveModulePosition[] distance(){ | ||||||
|  |     return swerveDrive.getModulePositions(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |    | ||||||
|  |   @Override | ||||||
|  |   public void periodic() { | ||||||
|  |     // This method will be called once per scheduler run | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -6,11 +6,14 @@ package frc.robot.Subsystems; | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import com.ctre.phoenix.motorcontrol.FeedbackDevice; | ||||||
|  | import com.ctre.phoenix.motorcontrol.StatusFrameEnhanced; | ||||||
| import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; | import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; | ||||||
|  |  | ||||||
| import com.revrobotics.CANSparkMax; | import com.revrobotics.CANSparkMax; | ||||||
| import com.revrobotics.CANSparkLowLevel.MotorType; | import com.revrobotics.CANSparkLowLevel.MotorType; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| import edu.wpi.first.wpilibj2.command.SubsystemBase; | import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||||||
|  |  | ||||||
| public class Lanceur extends SubsystemBase { | public class Lanceur extends SubsystemBase { | ||||||
| @@ -19,15 +22,31 @@ public class Lanceur extends SubsystemBase { | |||||||
|    |    | ||||||
|   final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0); |   final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0); | ||||||
|   final WPI_TalonSRX lanceur2 = new WPI_TalonSRX(1); |   final WPI_TalonSRX lanceur2 = new WPI_TalonSRX(1); | ||||||
|   final CANSparkMax tourel = new CANSparkMax(2, MotorType.kBrushed); |   final CANSparkMax tourelle = new CANSparkMax(2, MotorType.kBrushed); | ||||||
|  |   public void encodeur(double distance){ | ||||||
|  |     lanceur1.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative); | ||||||
|  |     lanceur2.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative); | ||||||
|  |     lanceur1.setStatusFramePeriod(StatusFrameEnhanced.Status_2_Feedback0, 1); | ||||||
|  |     lanceur2.setStatusFramePeriod(StatusFrameEnhanced.Status_2_Feedback0, 1); | ||||||
|  |      | ||||||
|  |   } | ||||||
|  |   public void masterslave(){ | ||||||
|  |     lanceur2.follow(lanceur1); | ||||||
|  |     lanceur2.setInverted(true); | ||||||
|  |   } | ||||||
|   public void lance(double vitesse){ |   public void lance(double vitesse){ | ||||||
|     lanceur1.set(vitesse); |     lanceur1.set(vitesse); | ||||||
|     lanceur2.set(-vitesse); |  | ||||||
|   } |   } | ||||||
|   public void tourelRotation(double vitesse){ |   public void tourelRotation(double vitesse){ | ||||||
|     tourel.set(vitesse); |     tourelle.set(vitesse); | ||||||
|   } |   } | ||||||
|   public void setPID(double p, double i, int d) { |   public double distancetourel(){ | ||||||
|  |     return(tourelle.getEncoder().getPosition()); | ||||||
|  |   } | ||||||
|  |   public void PIDlanceur(double p, double i, double d) { | ||||||
|  |    lanceur1.config_kP(0, p); | ||||||
|  |    lanceur1.config_kI(0, i); | ||||||
|  |    lanceur1.config_kD(0, d); | ||||||
|   } |   } | ||||||
|   @Override |   @Override | ||||||
|   public void periodic() { |   public void periodic() { | ||||||
|   | |||||||
							
								
								
									
										48
									
								
								src/main/java/frc/robot/Subsystems/Limelight3G.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								src/main/java/frc/robot/Subsystems/Limelight3G.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | |||||||
|  | // 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 edu.wpi.first.net.PortForwarder; | ||||||
|  | import edu.wpi.first.networktables.NetworkTable; | ||||||
|  | import edu.wpi.first.networktables.NetworkTableEntry; | ||||||
|  | import edu.wpi.first.networktables.NetworkTableInstance; | ||||||
|  | public class Limelight3G extends SubsystemBase { | ||||||
|  |   NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight"); | ||||||
|  |  | ||||||
|  |   NetworkTableEntry tx = table.getEntry("tx"); | ||||||
|  |   NetworkTableEntry ty = table.getEntry("ty"); | ||||||
|  |   NetworkTableEntry pipeline = table.getEntry("pipeline"); | ||||||
|  |   NetworkTableEntry tv = table.getEntry("tv"); | ||||||
|  |   NetworkTableEntry camMode = table.getEntry("camMode"); | ||||||
|  |   NetworkTableEntry tid = table.getEntry("tid"); | ||||||
|  |   /** Creates a new Limelight. */ | ||||||
|  |   public Limelight3G() { | ||||||
|  |     for (int port = 5800; port <= 5807; port++) { | ||||||
|  |       PortForwarder.add(port, "limelight.local", port); | ||||||
|  |   }} | ||||||
|  |   public  double getx(){ | ||||||
|  |     return tx.getDouble(0);  | ||||||
|  |   } | ||||||
|  |   public double gety(){ | ||||||
|  |     return ty.getDouble(0); | ||||||
|  |   } | ||||||
|  |   public double getv(){ | ||||||
|  |     return tv.getDouble(0); | ||||||
|  |   } | ||||||
|  |   public void setpipeline(){ | ||||||
|  |      pipeline.setNumber(0); | ||||||
|  |   } | ||||||
|  |   public void setcamMode(){ | ||||||
|  |     camMode.setNumber(0); | ||||||
|  |   } | ||||||
|  |   public double getTid(){ | ||||||
|  |     return tid.getDouble(0); | ||||||
|  |   } | ||||||
|  |   @Override | ||||||
|  |   public void periodic() { | ||||||
|  |     // This method will be called once per scheduler run | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										38
									
								
								vendordeps/PathplannerLib.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								vendordeps/PathplannerLib.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | { | ||||||
|  |     "fileName": "PathplannerLib.json", | ||||||
|  |     "name": "PathplannerLib", | ||||||
|  |     "version": "2024.2.8", | ||||||
|  |     "uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786", | ||||||
|  |     "frcYear": "2024", | ||||||
|  |     "mavenUrls": [ | ||||||
|  |         "https://3015rangerrobotics.github.io/pathplannerlib/repo" | ||||||
|  |     ], | ||||||
|  |     "jsonUrl": "https://3015rangerrobotics.github.io/pathplannerlib/PathplannerLib.json", | ||||||
|  |     "javaDependencies": [ | ||||||
|  |         { | ||||||
|  |             "groupId": "com.pathplanner.lib", | ||||||
|  |             "artifactId": "PathplannerLib-java", | ||||||
|  |             "version": "2024.2.8" | ||||||
|  |         } | ||||||
|  |     ], | ||||||
|  |     "jniDependencies": [], | ||||||
|  |     "cppDependencies": [ | ||||||
|  |         { | ||||||
|  |             "groupId": "com.pathplanner.lib", | ||||||
|  |             "artifactId": "PathplannerLib-cpp", | ||||||
|  |             "version": "2024.2.8", | ||||||
|  |             "libName": "PathplannerLib", | ||||||
|  |             "headerClassifier": "headers", | ||||||
|  |             "sharedLibrary": false, | ||||||
|  |             "skipInvalidPlatforms": true, | ||||||
|  |             "binaryPlatforms": [ | ||||||
|  |                 "windowsx86-64", | ||||||
|  |                 "linuxx86-64", | ||||||
|  |                 "osxuniversal", | ||||||
|  |                 "linuxathena", | ||||||
|  |                 "linuxarm32", | ||||||
|  |                 "linuxarm64" | ||||||
|  |             ] | ||||||
|  |         } | ||||||
|  |     ] | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user