This commit is contained in:
Olivier Dubois 2023-02-27 19:43:14 -05:00
parent d4a47ec157
commit 7dad4be45c
5 changed files with 30 additions and 10 deletions

View File

@ -13,7 +13,9 @@ import edu.wpi.first.wpilibj.PneumaticsModuleType;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value; import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants; import frc.robot.Constants;
@ -32,6 +34,9 @@ public class BasePilotable extends SubsystemBase {
private DoubleSolenoid brakegauche = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakegauche, Constants.brakegauche); private DoubleSolenoid brakegauche = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakegauche, Constants.brakegauche);
//gyro //gyro
ShuffleboardTab teb = Shuffleboard.getTab("teb"); ShuffleboardTab teb = Shuffleboard.getTab("teb");
ShuffleboardLayout layout = Shuffleboard.getTab("teb")
.getLayout ("encodeurs base pilotable", BuiltInLayouts.kList)
.withSize(2, 2);
private AHRS gyroscope = new AHRS();public double getangle() {return gyroscope.getAngle();} private AHRS gyroscope = new AHRS();public double getangle() {return gyroscope.getAngle();}
public double getpitch() { public double getpitch() {
return gyroscope.getPitch(); return gyroscope.getPitch();
@ -67,10 +72,6 @@ public void BrakeFerme(){
@Override @Override
public void periodic() { public void periodic() {
teb .add("encodeuravantdroit",0.1);
teb .add("encodeurarrieregauche",0.1);
teb .add("encodeurarrieredroit",0.1);
teb .add("encodeuravantgauche",0.1);
teb .add("distance",0.1); teb .add("distance",0.1);
} }
} }

View File

@ -12,13 +12,19 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import frc.robot.Constants; import frc.robot.Constants;
public class Gratte extends SubsystemBase { public class Gratte extends SubsystemBase {
ShuffleboardTab teb = Shuffleboard.getTab("teb");
ShuffleboardLayout layout = Shuffleboard.getTab("teb")
.getLayout("limitswitchsgratte", BuiltInLayouts.kList)
.withSize(2, 2);
private WPI_TalonSRX Gratted = new WPI_TalonSRX(Constants.leverGratte); private WPI_TalonSRX Gratted = new WPI_TalonSRX(Constants.leverGratte);
private WPI_TalonSRX Gratteg = new WPI_TalonSRX(Constants.baisserGratte); private WPI_TalonSRX Gratteg = new WPI_TalonSRX(Constants.baisserGratte);
private DigitalInput limithd = new DigitalInput(Constants.limithd); private DigitalInput limithd = new DigitalInput(Constants.limithd);
@ -51,6 +57,9 @@ public class Gratte extends SubsystemBase {
} }
@Override @Override
public void periodic() { public void periodic() {
// This method will be called once per scheduler run limitswitchgratte.add ("limitbd", 0.1);
limitswitchgratte.add ("limithg", 0.1);
limitswitchgratte.add ("limithd", 0.1);
limitswitchgratte.add ("limitbg", 0.1);
} }
} }

View File

@ -8,11 +8,19 @@ package frc.robot.subsystems.bras;
import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType; import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants; import frc.robot.Constants;
public class BrasTelescopique extends SubsystemBase { public class BrasTelescopique extends SubsystemBase {
ShuffleboardTab teb = Shuffleboard.getTab("teb");
ShuffleboardLayout layout = Shuffleboard.getTab("teb")
.getLayout("yeet", BuiltInLayouts.kList)
.withSize(2, 2);
/** Creates a new BrasTelescopique. */ /** Creates a new BrasTelescopique. */
public BrasTelescopique() {} public BrasTelescopique() {}
final CANSparkMax Winch = new CANSparkMax(Constants.BrasTelescopique,MotorType.kBrushless); final CANSparkMax Winch = new CANSparkMax(Constants.BrasTelescopique,MotorType.kBrushless);
@ -28,6 +36,6 @@ public class BrasTelescopique extends SubsystemBase {
@Override @Override
public void periodic() { public void periodic() {
Shuffleboard.getTab("SmartDashBoard") .add("winch",0.1); yeet.add ("encodeur",0.1);
} }
} }

View File

@ -5,12 +5,14 @@
package frc.robot.subsystems.bras; package frc.robot.subsystems.bras;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType; import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import static frc.robot.Constants.*; import static frc.robot.Constants.*;
public class Pivot extends SubsystemBase { public class Pivot extends SubsystemBase {
ShuffleboardTab teb = Shuffleboard.getTab("teb");
// moteur // moteur
private CANSparkMax pivot = new CANSparkMax(actuateur, MotorType.kBrushless); private CANSparkMax pivot = new CANSparkMax(actuateur, MotorType.kBrushless);
@ -18,7 +20,7 @@ public class Pivot extends SubsystemBase {
public void monteDescendre(double vitesse) { public void monteDescendre(double vitesse) {
pivot.set (vitesse); pivot.set (vitesse);
} }
// encoder // encodeur
public double distance(){ public double distance(){
return (pivot.getEncoder().getPosition()); return (pivot.getEncoder().getPosition());
} }
@ -27,6 +29,6 @@ public class Pivot extends SubsystemBase {
} }
@Override @Override
public void periodic() { public void periodic() {
Shuffleboard.getTab("SmartDashBoard") .add("pivot encodeur",0.1); teb .add ("encodeur pivot",0.1);
} }
} }