Merge branch 'main' of https://git.demerso.net/PLS5618/pratique-2025
This commit is contained in:
		| @@ -5,12 +5,12 @@ | |||||||
|   }, |   }, | ||||||
|   "absoluteEncoderOffset":209.443, |   "absoluteEncoderOffset":209.443, | ||||||
|   "drive": { |   "drive": { | ||||||
|     "type": "sparkmax", |     "type": "talonFX", | ||||||
|     "id": 8, |     "id": 8, | ||||||
|     "canbus": null |     "canbus": null | ||||||
|   }, |   }, | ||||||
|   "angle": { |   "angle": { | ||||||
|     "type": "sparkmax", |     "type": "talonFX", | ||||||
|     "id": 9, |     "id": 9, | ||||||
|     "canbus": null |     "canbus": null | ||||||
|   }, |   }, | ||||||
|   | |||||||
| @@ -5,12 +5,12 @@ | |||||||
|   }, |   }, | ||||||
|   "absoluteEncoderOffset":258.223 , |   "absoluteEncoderOffset":258.223 , | ||||||
|   "drive": { |   "drive": { | ||||||
|     "type": "sparkmax", |     "type": "talonFX", | ||||||
|     "id": 2, |     "id": 2, | ||||||
|     "canbus": null |     "canbus": null | ||||||
|   }, |   }, | ||||||
|   "angle": { |   "angle": { | ||||||
|     "type": "sparkmax", |     "type": "talonFX", | ||||||
|     "id": 3, |     "id": 3, | ||||||
|     "canbus": null |     "canbus": null | ||||||
|   }, |   }, | ||||||
|   | |||||||
| @@ -5,12 +5,12 @@ | |||||||
|   }, |   }, | ||||||
|   "absoluteEncoderOffset": 110.215, |   "absoluteEncoderOffset": 110.215, | ||||||
|   "drive": { |   "drive": { | ||||||
|     "type": "sparkmax", |     "type": "talonFX", | ||||||
|     "id": 18, |     "id": 18, | ||||||
|     "canbus": null |     "canbus": null | ||||||
|   }, |   }, | ||||||
|   "angle": { |   "angle": { | ||||||
|     "type": "sparkmax", |     "type": "talonFX", | ||||||
|     "id": 17, |     "id": 17, | ||||||
|     "canbus": null |     "canbus": null | ||||||
|   }, |   }, | ||||||
|   | |||||||
| @@ -4,12 +4,46 @@ | |||||||
|  |  | ||||||
| package frc.robot.Subsystems; | 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 edu.wpi.first.wpilibj2.command.SubsystemBase; | ||||||
|  | import swervelib.SwerveDrive; | ||||||
|  | import swervelib.parser.SwerveParser; | ||||||
|  |  | ||||||
|  |  | ||||||
| public class Drive extends SubsystemBase { | public class Drive extends SubsystemBase { | ||||||
|  |  | ||||||
|   /** Creates a new Drive. */ |     SwerveDrive swerveDrive; | ||||||
|   public Drive() {} |  | ||||||
|  |   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 |   @Override | ||||||
|   public void periodic() { |   public void periodic() { | ||||||
|   | |||||||
							
								
								
									
										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