This commit is contained in:
EdwardFaucher 2024-11-13 19:13:35 -05:00
commit 75c59ddbe5
4 changed files with 24 additions and 21 deletions

View File

@ -22,7 +22,7 @@ public class Desaccumuler extends Command {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
if(accumulateur.photocell()){accumulateur.desaccumule(0.1);}
if(accumulateur.photocell() || accumulateur.photocell2()){accumulateur.desaccumule(0.1);}
}
// Called once the command ends or is interrupted.

View File

@ -28,11 +28,11 @@ public class RobotContainer {
CommandXboxController manette = new CommandXboxController(0);
public RobotContainer() {
dashboard.addCamera("limelight3G", "limelight3G","limelight.local:5800")
.withSize(3,4)
.withSize(4,3)
.withPosition(0,0);
dashboard.addCamera("limelight3", "limelight3","limelight.local:5800")
.withSize(3,4)
.withPosition(3,0);
.withSize(4,3)
.withPosition(4,0);
configureBindings();
drive.setDefaultCommand(new RunCommand(()->{
drive.drive(-MathUtil.applyDeadband(manette.getRightX(),0.2), MathUtil.applyDeadband(-manette.getRightY(),0.2), MathUtil.applyDeadband(-manette.getRightX(), 0.2));

View File

@ -12,8 +12,8 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
public class Accumulateur extends SubsystemBase {
/** Creates a new Accumulateur. */
public Accumulateur() {dashboard.addBoolean("photocellacc", this::photocell).withSize(1, 1).withPosition(0, 1);
dashboard.addBoolean("photocellacc2", this::photocell).withSize(1, 1).withPosition(0, 1);
public Accumulateur() {dashboard.addBoolean("photocell", this::photocell).withSize(1, 1).withPosition(0, 1);
dashboard.addBoolean("photocell2", this::photocell).withSize(1, 1).withPosition(0, 1);
}
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
@ -23,8 +23,8 @@ public class Accumulateur extends SubsystemBase {
.withPosition(0, 4)
.getEntry();
final WPI_TalonSRX accumulateur1 = new WPI_TalonSRX(0);
final WPI_TalonSRX accumulateur2 = new WPI_TalonSRX(10);
final WPI_TalonSRX strap = new WPI_TalonSRX(0);
final WPI_TalonSRX roueRouge = new WPI_TalonSRX(10);
final DigitalInput photocell = new DigitalInput(20);
final DigitalInput photocell2 = new DigitalInput(21);
public void encodeur(){
@ -32,10 +32,17 @@ public class Accumulateur extends SubsystemBase {
public boolean photocell(){
return photocell.get();
}
public void desaccumule(double vitesse){
accumulateur1.set(vitesse);
accumulateur2.set(-vitesse);
public boolean photocell2(){
return photocell2.get();
}
public void desaccumule(double vitesse){
strap.set(vitesse);
}
public void Petitlanceur(double vitesse){
roueRouge.set(vitesse);
}
public void desaccumule(){
desaccumule(vitesse.getDouble(0.9));
}

View File

@ -21,7 +21,9 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Lanceur extends SubsystemBase {
/** Creates a new Lanceur. */
public Lanceur() {}
public Lanceur() {dashboard.add("rottourel", 0.2)
.withSize(0,0)
.withPosition(1, 3);}
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0);
@ -32,13 +34,9 @@ public class Lanceur extends SubsystemBase {
private GenericEntry vitesse =
dashboard.add("vitesselanceur", 0.2)
.withSize(0,0)
.withPosition(1, 4)
.getEntry();
private GenericEntry rotation =
dashboard.add("rottourel", 0.2)
.withSize(0,0)
.withPosition(1, 5)
.withPosition(0, 3)
.getEntry();
public void encodeur(double distance){
lanceur1.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
lanceur2.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
@ -58,9 +56,7 @@ public class Lanceur extends SubsystemBase {
public void tourelRotation(double x, double y, double rotation){
tourelle.set(rotation);
}
public void tourelRotation(){
tourelle.set(rotation.getDouble(0.1));
}
public double vitessetourel(){
return(tourelle.getEncoder().getVelocity());
}