This commit is contained in:
Olivier Dubois 2024-02-07 19:38:43 -05:00
parent 18bc9052da
commit 7a5705baa0
5 changed files with 33 additions and 7 deletions

View File

@ -45,8 +45,7 @@ public class Constants {
// Limit switch
public static int guideurhaut = 0;
public static int guideurbas = 1;
public static int limitacc = 2;
public static int limitacc2 = 3;
public static int photocellacc = 2;
public static int limithaut = 4;
public static int limitbas = 5;

View File

@ -54,6 +54,7 @@ public class RobotContainer {
Lancerampli lancerampli = new Lancerampli(lanceur);
CommandJoystick joystick = new CommandJoystick(0);
CommandXboxController manette = new CommandXboxController(1);
//command
GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftX);
GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getLeftY);
public RobotContainer() {

View File

@ -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() {

View File

@ -8,9 +8,12 @@ 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.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;
@ -18,7 +21,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
@ -27,6 +31,23 @@ public class Grimpeur extends SubsystemBase {
final DoubleSolenoid pistondroite= new DoubleSolenoid(PneumaticsModuleType.CTREPCM, Constants.pistondroiteouvre, Constants.pistondroiteouvre);
final DoubleSolenoid pistondgauche= new DoubleSolenoid(PneumaticsModuleType.CTREPCM, Constants.pistondgaucheouvre, Constants.pistondroiteouvre);
//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);
}

View File

@ -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);
}