This commit is contained in:
Antoine PerreaultE 2023-03-07 17:52:41 -05:00
commit 337199e19c
3 changed files with 12 additions and 8 deletions

View File

@ -76,6 +76,7 @@ public RobotContainer() {
manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince));
manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable));
manette1.y().whileTrue(gyro);
// manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte));
manette1.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable));
manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte));
// manette 2

View File

@ -19,11 +19,11 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
public class BasePilotable extends SubsystemBase {
final CANSparkMax avantdroit = new CANSparkMax(Constants.avantdroit, MotorType.kBrushless);
final CANSparkMax avantd = new CANSparkMax(Constants.avantdroit, MotorType.kBrushless);
final CANSparkMax avantgauche = new CANSparkMax(Constants.avantgauche, MotorType.kBrushless);
final CANSparkMax arrieredroit = new CANSparkMax(Constants.arrieredroit, MotorType.kBrushless);
final CANSparkMax arrieregauche = new CANSparkMax(Constants.arrieregauche, MotorType.kBrushless);
final MotorControllerGroup droit = new MotorControllerGroup(avantdroit, arrieredroit);
final MotorControllerGroup droit = new MotorControllerGroup(avantd, arrieredroit);
final MotorControllerGroup gauche = new MotorControllerGroup(avantgauche, arrieregauche);
final DifferentialDrive drive = new DifferentialDrive(gauche, droit);
@ -41,13 +41,13 @@ public class BasePilotable extends SubsystemBase {
drive.arcadeDrive(xSpeed, zRotation);
}
public double distance(){
return (-avantdroit.getEncoder().getPosition()
return (-avantd.getEncoder().getPosition()
+avantgauche.getEncoder().getPosition()
-arrieredroit.getEncoder().getPosition()
+arrieregauche.getEncoder().getPosition()) / 4;
}
public void Reset() {
avantdroit.getEncoder().setPosition(0);
avantd.getEncoder().setPosition(0);
avantgauche.getEncoder().setPosition(0);
arrieredroit.getEncoder().setPosition(0);
arrieregauche.getEncoder().setPosition(0);

View File

@ -12,13 +12,18 @@ import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.PneumaticsModuleType;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
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 edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
public class BrasTelescopique extends SubsystemBase {
ShuffleboardTab teb = Shuffleboard.getTab("teb");
ShuffleboardLayout layout = Shuffleboard.getTab("teb")
.getLayout("layout", BuiltInLayouts.kList)
.withSize(2, 2);
/** Creates a new BrasTelescopique. */
public BrasTelescopique() {}
final CANSparkMax Winch = new CANSparkMax(Constants.BrasTelescopique,MotorType.kBrushless);
@ -44,9 +49,7 @@ public class BrasTelescopique extends SubsystemBase {
}
@Override
public void periodic() {
teb .add("``photocell``",0.1);
teb .add("photocell",0.1);
teb .add("winch",0.1);
}
}