Merge branch 'main' of https://demerso.net/pls5618/2023/robot
This commit is contained in:
@ -8,7 +8,6 @@ import com.kauailabs.navx.frc.AHRS;
|
||||
import com.revrobotics.CANSparkMax;
|
||||
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
||||
import edu.wpi.first.wpilibj.DoubleSolenoid;
|
||||
import edu.wpi.first.wpilibj.DriverStation;
|
||||
import edu.wpi.first.wpilibj.PneumaticsModuleType;
|
||||
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
@ -61,12 +60,12 @@ public void BrakeFerme(){
|
||||
brakegauche.set(Value.kReverse);
|
||||
}
|
||||
public void resetGyro(){
|
||||
try {gyroscope.reset();} catch(Exception e){DriverStation.reportError("bye bye",true);
|
||||
{gyroscope.reset();}
|
||||
}
|
||||
}
|
||||
/** Creates a new BasePilotable. */
|
||||
public BasePilotable() {
|
||||
droit.setInverted(true);
|
||||
teb .addDouble("distance", this::distance);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -78,5 +77,6 @@ public void resetGyro(){
|
||||
//teb .add("distance",0.1);
|
||||
//teb .add("brakedroit",0.1);
|
||||
//teb .add("brakegauche", 0.1);
|
||||
|
||||
}
|
||||
}
|
@ -3,23 +3,36 @@
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package frc.robot.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||
import frc.robot.Constants;
|
||||
|
||||
public class Gratte extends SubsystemBase {
|
||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||
ShuffleboardLayout limitswitchgratte = Shuffleboard.getTab("teb")
|
||||
.getLayout("limitswitchsgratte", BuiltInLayouts.kList)
|
||||
.withSize(2, 2);
|
||||
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.baiserGratte);
|
||||
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 baiser;
|
||||
boolean enHaut = true;
|
||||
public void setenHaut(boolean enHaut){
|
||||
this.enHaut = enHaut;
|
||||
}
|
||||
public boolean getenHaut(){
|
||||
return enHaut;
|
||||
|
||||
}
|
||||
|
||||
public boolean hautd(){
|
||||
return limithd.get();
|
||||
}
|
||||
@ -34,8 +47,13 @@ public class Gratte extends SubsystemBase {
|
||||
public boolean basg(){
|
||||
return limitbg.get();
|
||||
}
|
||||
/** Creates a new Gratte. */
|
||||
public Gratte() {}
|
||||
|
||||
public Gratte() {
|
||||
limitswitchgratte.add ("limitbd", 0.1);
|
||||
limitswitchgratte.add ("limithg", 0.1);
|
||||
limitswitchgratte.add ("limithd", 0.1);
|
||||
limitswitchgratte.add ("limitbg", 0.1);
|
||||
}
|
||||
public void Lever(double vitesse){
|
||||
Gratted.set(vitesse);
|
||||
Gratteg.set(vitesse);
|
||||
@ -45,10 +63,10 @@ public class Gratte extends SubsystemBase {
|
||||
Gratteg.set(-vitesse);
|
||||
}
|
||||
@Override
|
||||
public void periodic() {
|
||||
teb .add("limithd", 0.1);
|
||||
teb .add("limithg", 0.1);
|
||||
teb .add("limitbd", 0.1);
|
||||
teb .add("limitbg", 0.1);
|
||||
}
|
||||
public void periodic(){
|
||||
limitswitchgratte.add ("limitbd", 0.1);
|
||||
limitswitchgratte.add ("limithg", 0.1);
|
||||
limitswitchgratte.add ("limithd", 0.1);
|
||||
limitswitchgratte.add ("limitbg", 0.1);
|
||||
}
|
||||
}
|
@ -21,6 +21,8 @@ public class Limelight extends SubsystemBase {
|
||||
PhotonCamera limelight = new PhotonCamera("limelight");
|
||||
/** Creates a new Limelight. */
|
||||
public Limelight() {
|
||||
CameraServer.startAutomaticCapture();
|
||||
teb .add("limelight", 0.1);
|
||||
PortForwarder.add(5800, "photonvision.local", 5800);
|
||||
}
|
||||
|
||||
@ -58,7 +60,5 @@ public class Limelight extends SubsystemBase {
|
||||
}
|
||||
@Override
|
||||
public void periodic() {
|
||||
CameraServer.startAutomaticCapture();
|
||||
teb .add("limelight", 0.1);
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,12 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import frc.robot.Constants;
|
||||
|
||||
public class BrasTelescopique extends SubsystemBase {
|
||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||
/** Creates a new BrasTelescopique. */
|
||||
public BrasTelescopique() {}
|
||||
public BrasTelescopique() {
|
||||
teb .add("photocell",0.1);
|
||||
teb .add("winch",0.1);
|
||||
teb .add("encodeur",0.1);}
|
||||
final CANSparkMax Winch = new CANSparkMax(Constants.BrasTelescopique,MotorType.kBrushless);
|
||||
private DigitalInput photocell = new DigitalInput(Constants.photocell);
|
||||
private DoubleSolenoid brakewinch = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakewinchf, Constants.brakewinchb);
|
||||
@ -44,9 +47,6 @@ public class BrasTelescopique extends SubsystemBase {
|
||||
}
|
||||
@Override
|
||||
public void periodic() {
|
||||
teb .add("``photocell``",0.1);
|
||||
teb .add("winch",0.1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -14,7 +14,8 @@ import com.revrobotics.CANSparkMax;
|
||||
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
||||
|
||||
public class Pivot extends SubsystemBase {
|
||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||
|
||||
// moteur
|
||||
private CANSparkMax pivot = new CANSparkMax(Constants.pivot,MotorType.kBrushless);
|
||||
private DigitalInput limitpivot = new DigitalInput(Constants.limitpivot);
|
||||
@ -23,7 +24,11 @@ public class Pivot extends SubsystemBase {
|
||||
public void monteDescendre(double vitesse) {
|
||||
pivot.set (vitesse);
|
||||
}
|
||||
// encoder
|
||||
public Pivot(){
|
||||
teb .add ("encodeurpivot",0.1);
|
||||
teb .add ("limitpivot",0.1);
|
||||
}
|
||||
// encodeur
|
||||
public double distance(){
|
||||
return (pivot.getEncoder().getPosition());
|
||||
}
|
||||
@ -36,6 +41,6 @@ public class Pivot extends SubsystemBase {
|
||||
}
|
||||
@Override
|
||||
public void periodic() {
|
||||
teb .add("encodeur", 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user