diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index dea7d5a..dbb28e5 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -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 } diff --git a/src/main/java/frc/robot/subsystems/BasePilotable.java b/src/main/java/frc/robot/subsystems/BasePilotable.java index 53ef9ba..1379188 100644 --- a/src/main/java/frc/robot/subsystems/BasePilotable.java +++ b/src/main/java/frc/robot/subsystems/BasePilotable.java @@ -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); diff --git a/src/main/java/frc/robot/subsystems/Gratte.java b/src/main/java/frc/robot/subsystems/Gratte.java new file mode 100644 index 0000000..5baa6b8 --- /dev/null +++ b/src/main/java/frc/robot/subsystems/Gratte.java @@ -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 + } +} diff --git a/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java b/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java index 140625f..f4f1458 100644 --- a/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java +++ b/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java @@ -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() { diff --git a/src/main/java/frc/robot/subsystems/bras/Pivot.java b/src/main/java/frc/robot/subsystems/bras/Pivot.java index 2742df8..e8d5dbb 100644 --- a/src/main/java/frc/robot/subsystems/bras/Pivot.java +++ b/src/main/java/frc/robot/subsystems/bras/Pivot.java @@ -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