Merge branch 'main' of https://git.demerso.net/pls5618/2024/robot
This commit is contained in:
@ -24,7 +24,7 @@ public class Accumulateur extends SubsystemBase {
|
||||
.getEntry();
|
||||
final WPI_TalonSRX Moteuracc2 = new WPI_TalonSRX(Constants.Moteuracc2);
|
||||
final WPI_TalonSRX Moteuracc = new WPI_TalonSRX(Constants.Moteuracc);
|
||||
final DigitalInput limitacc = new DigitalInput(Constants.limitacc);
|
||||
final DigitalInput photocellacc = new DigitalInput(Constants.photocellacc);
|
||||
|
||||
public void Deaccumuler(double vitesse){
|
||||
Moteuracc2.set(vitesse);
|
||||
@ -34,7 +34,7 @@ public class Accumulateur extends SubsystemBase {
|
||||
Moteuracc.setInverted(true);
|
||||
}
|
||||
public boolean limitswitch(){
|
||||
return limitacc.get();
|
||||
return photocellacc.get();
|
||||
}
|
||||
public Accumulateur() {
|
||||
|
||||
|
@ -8,10 +8,13 @@ import com.kauailabs.navx.frc.AHRS;
|
||||
import com.revrobotics.CANSparkMax;
|
||||
import com.revrobotics.CANSparkLowLevel.MotorType;
|
||||
|
||||
import edu.wpi.first.networktables.GenericEntry;
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj.DoubleSolenoid;
|
||||
import edu.wpi.first.wpilibj.PneumaticsModuleType;
|
||||
import edu.wpi.first.wpilibj.Solenoid;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import frc.robot.Constants;
|
||||
@ -19,7 +22,8 @@ import frc.robot.Constants;
|
||||
public class Grimpeur extends SubsystemBase {
|
||||
/** Creates a new Acrocheur. */
|
||||
// moteur
|
||||
public Grimpeur() {}
|
||||
|
||||
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
|
||||
final CANSparkMax grimpeurd = new CANSparkMax(Constants.grimpeurd,MotorType.kBrushless);
|
||||
final CANSparkMax grimpeurg = new CANSparkMax(Constants.grimpeurg,MotorType.kBrushless);
|
||||
// limit switch
|
||||
@ -28,6 +32,23 @@ public class Grimpeur extends SubsystemBase {
|
||||
final Solenoid pistondroite= new Solenoid(PneumaticsModuleType.CTREPCM, Constants.pistondroiteouvre);
|
||||
final Solenoid pistondgauche = new Solenoid(PneumaticsModuleType.CTREPCM, Constants.pistondgaucheouvre);
|
||||
//fonction
|
||||
public Grimpeur() {
|
||||
dashboard.add("limitgrimpeurd", droite())
|
||||
.withSize(1, 1)
|
||||
.withPosition(1, 5);
|
||||
dashboard.add("limitgrimpeurd", droite())
|
||||
.withSize(1, 1)
|
||||
.withPosition(1, 4);
|
||||
dashboard.add("grimpeurencodeurd", encoderd())
|
||||
.withSize(1, 1)
|
||||
.withPosition(1, 3);
|
||||
dashboard.add("grimpeurencodeurg", encoderg())
|
||||
.withSize(1, 1)
|
||||
.withPosition(1, 2);
|
||||
dashboard.add("pitchgyrogrimpeur", getpitch())
|
||||
.withSize(1, 1)
|
||||
.withPosition(1, 1);
|
||||
}
|
||||
public void droit(double vitesse){
|
||||
grimpeurd.set(vitesse);
|
||||
}
|
||||
@ -56,14 +77,13 @@ public AHRS gyroscope = new AHRS();
|
||||
public double getpitch(){
|
||||
return gyroscope.getPitch();
|
||||
}
|
||||
public void pistonouvre(){
|
||||
pistondroite.get();
|
||||
pistondgauche.get();
|
||||
public boolean pistondroiteouvre(){
|
||||
return pistondroite.get();
|
||||
}
|
||||
public void pistonferme(){
|
||||
pistondroite.get();
|
||||
pistondgauche.get();
|
||||
public boolean pistondgaucheouvre(){
|
||||
return pistondgauche.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
// This method will be called once per scheduler run
|
||||
|
@ -7,17 +7,22 @@ package frc.robot.subsystem;
|
||||
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.ShuffleboardTab;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import frc.robot.Constants;
|
||||
|
||||
public class Guideur extends SubsystemBase {
|
||||
/** Creates a new Guideur. */
|
||||
public Guideur() {}
|
||||
|
||||
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
|
||||
final WPI_TalonSRX guideur = new WPI_TalonSRX(Constants.guideur);
|
||||
final DigitalInput guideurhaut = new DigitalInput(Constants.guideurhaut);
|
||||
final DigitalInput guideurbas = new DigitalInput(Constants.guideurbas);
|
||||
|
||||
public Guideur() {
|
||||
dashboard.add("limitguideurhaut", haut());
|
||||
dashboard.add("limitguideurbas", bas());
|
||||
}
|
||||
public void guider(double vitesse){
|
||||
guideur.set(vitesse);
|
||||
}
|
||||
|
@ -11,27 +11,44 @@ import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
|
||||
|
||||
public class Limelight extends SubsystemBase {
|
||||
/** Creates a new Limelight. */
|
||||
public Limelight() {
|
||||
NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight");
|
||||
|
||||
NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight");
|
||||
NetworkTableEntry tx = table.getEntry("tx");
|
||||
NetworkTableEntry ty = table.getEntry("ty");
|
||||
NetworkTableEntry ta = table.getEntry("ta");
|
||||
NetworkTableEntry pipeline = table.getEntry("pipeline");
|
||||
NetworkTableEntry tv = table.getEntry("tv");
|
||||
NetworkTableEntry camMode = table.getEntry("camMode");
|
||||
NetworkTableEntry tid = table.getEntry("tid");
|
||||
|
||||
double x = tx.getDouble(0.0);
|
||||
double y = ty.getDouble(0.0);
|
||||
double area = ta.getDouble(0.0);
|
||||
|
||||
SmartDashboard.putNumber("LimelightX", x);
|
||||
SmartDashboard.putNumber("LimelightY", y);
|
||||
SmartDashboard.putNumber("LimelightArea", area);
|
||||
|
||||
}
|
||||
/** Creates a new Limelight. */
|
||||
public Limelight() {
|
||||
|
||||
}
|
||||
|
||||
public double getx(){
|
||||
return tx.getDouble(0);
|
||||
}
|
||||
public double gety(){
|
||||
return ty.getDouble(0);
|
||||
}
|
||||
/* public double geta() {
|
||||
return ta.getDouble(0);
|
||||
}*/
|
||||
public boolean getv(){
|
||||
return tv.getBoolean(false);
|
||||
}
|
||||
public void setpipeline(){
|
||||
pipeline.setNumber(0);
|
||||
}
|
||||
public void setcamMode(){
|
||||
camMode.setNumber(0);
|
||||
}
|
||||
public double getTid(){
|
||||
return tid.getDouble(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
// This method will be called once per scheduler run
|
||||
|
Reference in New Issue
Block a user