Merge branch 'main' of https://demerso.net/pls5618/2023/robot
This commit is contained in:
		| @@ -5,13 +5,22 @@ public class Constants { | ||||
|     public static int avantgauche = 1; | ||||
|     public static int arrieredroit = 2; | ||||
|     public static int arrieregauche = 3; | ||||
| <<<<<<< HEAD | ||||
|     // pneumatique | ||||
|     public static int pistonpinceouvre = 0; | ||||
|     public static int pistonpinceferme = 1; | ||||
|  | ||||
| ======= | ||||
| <<<<<<< HEAD | ||||
|     public static int BrasTelescopique = 5; | ||||
| >>>>>>> a6d29dff41c9186a3dd56354d6416a625159f366 | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| ======= | ||||
|     public static int actuateur = 4; | ||||
| >>>>>>> 91d5a71d52bad9fc56b40c68d78207113e16cd21 | ||||
| } | ||||
|   | ||||
| @@ -22,6 +22,22 @@ public class BasePilotable extends SubsystemBase { | ||||
|  | ||||
|   final DifferentialDrive drive = new DifferentialDrive(gauche, droit); | ||||
|  | ||||
|   public void drive(double xSpeed, double zRotation){ | ||||
|     drive.arcadeDrive(xSpeed, zRotation); | ||||
|   } | ||||
|   public double distance(){ | ||||
|     return (-avantdroit.getEncoder().getPosition() | ||||
|     +avantgauche.getEncoder().getPosition() | ||||
|     -arrieredroit.getEncoder().getPosition() | ||||
|     +arrieregauche.getEncoder().getPosition()) / 4; | ||||
|   } | ||||
|   public void Reset() { | ||||
|     avantdroit.getEncoder().setPosition(0); | ||||
|     avantgauche.getEncoder().setPosition(0); | ||||
|     arrieredroit.getEncoder().setPosition(0); | ||||
|     arrieregauche.getEncoder().setPosition(0); | ||||
|   } | ||||
|  | ||||
|   /** Creates a new BasePilotable. */ | ||||
|   public BasePilotable() { | ||||
|     droit.setInverted(true); | ||||
|   | ||||
							
								
								
									
										17
									
								
								src/main/java/frc/robot/subsystems/Gratte.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/main/java/frc/robot/subsystems/Gratte.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| // 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; | ||||
|  | ||||
| public class Gratte extends SubsystemBase { | ||||
|   /** Creates a new Gratte. */ | ||||
|   public Gratte() {} | ||||
|  | ||||
|   @Override | ||||
|   public void periodic() { | ||||
|     // This method will be called once per scheduler run | ||||
|   } | ||||
| } | ||||
| @@ -4,11 +4,26 @@ | ||||
|  | ||||
| package frc.robot.subsystems.bras; | ||||
|  | ||||
|  | ||||
| import com.revrobotics.CANSparkMax; | ||||
| import com.revrobotics.CANSparkMaxLowLevel.MotorType; | ||||
|  | ||||
| import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||||
| import frc.robot.Constants; | ||||
|  | ||||
| public class BrasTelescopique extends SubsystemBase { | ||||
|   /** Creates a new BrasTelescopique. */ | ||||
|   public BrasTelescopique() {} | ||||
|   final CANSparkMax Winch = new CANSparkMax(Constants.BrasTelescopique,MotorType.kBrushless); | ||||
|   public void AvanceRecule(double vitesse) { | ||||
|     Winch.set(vitesse); | ||||
|   } | ||||
|   public double distance() { | ||||
|     return(Winch.getEncoder().getPosition()); | ||||
|   } | ||||
|   public void Reset() { | ||||
|     Winch.getEncoder().setPosition(0); | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   public void periodic() { | ||||
|   | ||||
| @@ -5,11 +5,25 @@ | ||||
| package frc.robot.subsystems.bras; | ||||
|  | ||||
| import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||||
| import com.revrobotics.CANSparkMax; | ||||
| import com.revrobotics.CANSparkMaxLowLevel.MotorType;  | ||||
| import static frc.robot.Constants.*; | ||||
|  | ||||
| public class Pivot extends SubsystemBase { | ||||
|   /** Creates a new Pivot. */ | ||||
|   public Pivot() {} | ||||
|   // moteur | ||||
|   private CANSparkMax pivot = new CANSparkMax(actuateur, MotorType.kBrushless); | ||||
|  | ||||
|   // function | ||||
|   public void monteDescendre(double vitesse) { | ||||
|     pivot.set (vitesse); | ||||
|   }  | ||||
|   // encoder | ||||
|   public double distance(){ | ||||
|     return (pivot.getEncoder().getPosition()); | ||||
|   } | ||||
|   public void Reset(){ | ||||
|     pivot.getEncoder().setPosition(0); | ||||
|   } | ||||
|   @Override | ||||
|   public void periodic() { | ||||
|     // This method will be called once per scheduler run | ||||
|   | ||||
		Reference in New Issue
	
	Block a user