From 077494b9fd8ae6c50c7b526c0e45689870d7938c Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Wed, 8 Feb 2023 19:55:20 -0500 Subject: [PATCH] Message constuctif --- src/main/java/frc/robot/Constants.java | 8 +++++ .../java/frc/robot/subsystems/Gratte.java | 30 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 426f892..4cf8973 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -5,9 +5,17 @@ public class Constants { public static int avantgauche = 1; public static int arrieredroit = 2; public static int arrieregauche = 3; + public static int leverGratte = 0; + public static int baisserGratte = 1; // pneumatique public static int pistonpinceouvre = 0; public static int pistonpinceferme = 1; + // DIO + public static int limitbd = 0; + public static int limitbg = 2; + public static int limithd = 3; + public static int limithg = 1; + diff --git a/src/main/java/frc/robot/subsystems/Gratte.java b/src/main/java/frc/robot/subsystems/Gratte.java index 5baa6b8..50adfbb 100644 --- a/src/main/java/frc/robot/subsystems/Gratte.java +++ b/src/main/java/frc/robot/subsystems/Gratte.java @@ -4,12 +4,40 @@ package frc.robot.subsystems; +import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; +import com.fasterxml.jackson.annotation.JacksonInject.Value; + +import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.robot.Constants; public class Gratte extends SubsystemBase { + private WPI_TalonSRX baisserGratte = new WPI_TalonSRX(Constants.leverGratte); + private WPI_TalonSRX leverGratte = new WPI_TalonSRX(Constants.baisserGratte); + private DigitalInput limithd = new DigitalInput(Constants.limithd); + private DigitalInput limithg = new DigitalInput(Constants.limithg); + private DigitalInput limitbd = new DigitalInput(Constants.limitbd); + private DigitalInput limitbg = new DigitalInput(Constants.limitbg); + public boolean hautd(){ + return limithd.get(); + } + + public boolean hautg(){ + return limithg.get(); + } + + public boolean basd(){ + return limitbd.get(); + } + public boolean basg(){ + return limitbg.get(); + } /** Creates a new Gratte. */ public Gratte() {} - + public void BaisserLever(double vitesse){ + baisserGratte.set(vitesse); + leverGratte.set(vitesse); + } @Override public void periodic() { // This method will be called once per scheduler run