This commit is contained in:
EdwardFaucher 2022-11-29 20:45:47 -05:00
parent 96a5eeb103
commit 2a5d7a1d21
2 changed files with 6 additions and 4 deletions

View File

@ -20,7 +20,6 @@ import frc.robot.commands.Activer_poussoir;
import frc.robot.commands.ActiverBlockeur;
import frc.robot.commands.DesactiverBlockeur;
import frc.robot.commands.Reculer;
import frc.robot.commands.ResetGyro;
import frc.robot.commands.TournerDroite;
import frc.robot.commands.TournerGauche;
import frc.robot.commands.Activershaker;
@ -66,7 +65,7 @@ public class RobotContainer {
*/
private void configureButtonBindings() {
JoystickButton buttonA = new JoystickButton(manette, XboxController.Button.kA.value);
buttonA.whileHeld(BoutonA);
buttonA.whileHeld(new);
JoystickButton rightbumper = new JoystickButton(manette, XboxController.Button.kLeftBumper.value);
rightbumper.whileHeld(Activershaker);
JoystickButton buttonY = new JoystickButton(manette, XboxController.Button.kY.value);

View File

@ -9,6 +9,7 @@ import com.kauailabs.navx.frc.AHRS;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.drive.MecanumDrive;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
@ -30,21 +31,23 @@ public double getangle() {
return gyroscope.getAngle();
}
public void drive(double y, double x, double rot){
mecanum.driveCartesian(y, rot, x, -getangle());
mecanum.driveCartesian(y, rot, -x, 0);
}
public void resetgyro(){
try { gyroscope.reset(); } catch( Exception e) {DriverStation.reportError(e.getMessage(), true); }
try { gyroscope.reset(); } catch( Exception e) {DriverStation.reportError("bye bye", true); }
}
/** Creates a new BasePilotable. */
public BasePilotable() {
avantDroit.setInverted(true);
arriereDroit.setInverted(true);
mecanum = new MecanumDrive(avantGauche, arriereGauche, avantDroit, arriereDroit);
mecanum.setDeadband(0.1);
}
@Override
public void periodic() {
// This method will be called once per scheduler run
SmartDashboard.putNumber("angle gyro" , getangle());
}
}