diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index b325967..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,14 +0,0 @@ -default: - image: gradle:jdk11 - tags: - - robot - -stages: # List of stages for jobs, and their order of execution - - build - -build-job: # This job runs in the build stage, which runs first. - stage: build - script: - - chmod +x gradlew - - ./gradlew build - diff --git a/bin/main/frc/robot/subsystems/BasePilotable.class b/bin/main/frc/robot/subsystems/BasePilotable.class deleted file mode 100644 index 20fa95d..0000000 Binary files a/bin/main/frc/robot/subsystems/BasePilotable.class and /dev/null differ diff --git a/src/main/java/frc/robot/Robot.java b/src/main/java/frc/robot/Robot.java index b68462c..50229b4 100644 --- a/src/main/java/frc/robot/Robot.java +++ b/src/main/java/frc/robot/Robot.java @@ -4,7 +4,10 @@ package frc.robot; + import edu.wpi.first.wpilibj.TimedRobot; +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; + import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.CommandScheduler; @@ -35,7 +38,6 @@ public class Robot extends TimedRobot { @Override public void autonomousInit() { m_autonomousCommand = m_robotContainer.getAutonomousCommand(); - if (m_autonomousCommand != null) { m_autonomousCommand.schedule(); } diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 2f46998..9f46643 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -8,10 +8,19 @@ import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.XboxController; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; +<<<<<<< HEAD import edu.wpi.first.wpilibj2.command.button.JoystickButton; import edu.wpi.first.wpilibj2.command.button.Trigger; import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; +======= +import edu.wpi.first.wpilibj2.command.RunCommand; +import edu.wpi.first.wpilibj2.command.button.CommandXboxController; +import edu.wpi.first.wpilibj2.command.button.JoystickButton; +import edu.wpi.first.wpilibj2.command.button.Trigger; +import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; +import edu.wpi.first.wpilibj2.command.button.JoystickButton; +>>>>>>> 856a2295bef699955297a016b8d5ddd1d8bd68d8 //subsystems import frc.robot.subsystems.BasePilotable; import frc.robot.subsystems.Gratte; @@ -34,8 +43,8 @@ import frc.robot.commands.bras.PivoteBrasHaut; import frc.robot.commands.bras.PivoteBrasMilieux; public class RobotContainer { -XboxController manette1 = new XboxController(0); -XboxController manette2 = new XboxController(1); +CommandXboxController manette1 = new CommandXboxController(0); +CommandXboxController manette2 = new CommandXboxController(1); // subsystems BasePilotable basePilotable = new BasePilotable(); Gratte gratte = new Gratte(); @@ -59,16 +68,15 @@ PivoteBrasHaut pivoteBrasHaut = new PivoteBrasHaut(brasTelescopique, pivot); public RobotContainer() { configureBindings(); - basePilotable.setDefaultCommand(brakeOuvre); - basePilotable.drive(-manette1.getLeftY(), manette1.getLeftX(), -manette1.getLeftTriggerAxis()+manette1.getRightTriggerAxis()); + basePilotable.setDefaultCommand(new RunCommand(() -> { + basePilotable.drive(-manette1.getLeftY(), manette1.getLeftX()); + },basePilotable)); + } - private void configureBindings() { - XboxController exampleController = new XboxController(2); - Trigger aButton = new JoystickButton(exampleController, XboxController.Button.kY.value); - - + manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); + manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable)); @@ -76,7 +84,6 @@ public RobotContainer() { } public Command getAutonomousCommand() { - return Commands.print("No autonomous command configured"); return new SequentialCommandGroup( new PivoteBrasMilieux(brasTelescopique, pivot), new OuvrePince(pince), diff --git a/src/main/java/frc/robot/commands/Gyro.java b/src/main/java/frc/robot/commands/Gyro.java index 8492e0d..dcb7893 100644 --- a/src/main/java/frc/robot/commands/Gyro.java +++ b/src/main/java/frc/robot/commands/Gyro.java @@ -25,15 +25,15 @@ public class Gyro extends CommandBase { public void execute() { if(basePilotable.getpitch()<10) { - basePilotable.drive(0.4, 0, 0); + basePilotable.drive(0.4, 0); } else if(basePilotable.getpitch()>-10) { - basePilotable.drive(-0.4, 0, 0); + basePilotable.drive(-0.4, 0); } else { - basePilotable.drive(0, 0, 0); + basePilotable.drive(0, 0); } } diff --git a/src/main/java/frc/robot/commands/Reculer.java b/src/main/java/frc/robot/commands/Reculer.java index ce9aecf..7ff9989 100644 --- a/src/main/java/frc/robot/commands/Reculer.java +++ b/src/main/java/frc/robot/commands/Reculer.java @@ -5,6 +5,7 @@ package frc.robot.commands; +import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.BasePilotable; @@ -26,7 +27,7 @@ public class Reculer extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - basePilotable.drive(0.2, 0, 0); + basePilotable.drive(SmartDashboard.getNumber("vitesse auto", -0.3), 0); } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/subsystems/BasePilotable.java b/src/main/java/frc/robot/subsystems/BasePilotable.java index 4ed9d06..272c321 100644 --- a/src/main/java/frc/robot/subsystems/BasePilotable.java +++ b/src/main/java/frc/robot/subsystems/BasePilotable.java @@ -32,7 +32,7 @@ public class BasePilotable extends SubsystemBase { return gyroscope.getPitch(); } - public void drive(double xSpeed, double zRotation, double d){ + public void drive(double xSpeed, double zRotation){ drive.arcadeDrive(xSpeed, zRotation); } public double distance(){ diff --git a/src/main/java/frc/robot/subsystems/Gratte.java b/src/main/java/frc/robot/subsystems/Gratte.java index 9bc4bb1..3aa09ac 100644 --- a/src/main/java/frc/robot/subsystems/Gratte.java +++ b/src/main/java/frc/robot/subsystems/Gratte.java @@ -7,6 +7,7 @@ package frc.robot.subsystems; import edu.wpi.first.wpilibj2.command.SubsystemBase; import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; import edu.wpi.first.wpilibj.DigitalInput; +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import frc.robot.Constants; public class Gratte extends SubsystemBase { @@ -42,6 +43,9 @@ public class Gratte extends SubsystemBase { } @Override public void periodic() { - // This method will be called once per scheduler run + Shuffleboard.getTab("SmartDashBoard") .add("limithd",0.1); + Shuffleboard.getTab("SmartDashBoard") .add("limitbd",0.1); + Shuffleboard.getTab("SmartDashBoard") .add("limithg",0.1); + Shuffleboard.getTab("SmartDashBoard") .add("limitbg",0.1); } } diff --git a/src/main/java/frc/robot/subsystems/Limelight.java b/src/main/java/frc/robot/subsystems/Limelight.java index ac1d815..7e88f9b 100644 --- a/src/main/java/frc/robot/subsystems/Limelight.java +++ b/src/main/java/frc/robot/subsystems/Limelight.java @@ -4,6 +4,8 @@ package frc.robot.subsystems; +import edu.wpi.first.cameraserver.CameraServer; +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import org.photonvision.PhotonCamera; import org.photonvision.common.hardware.VisionLEDMode; @@ -40,6 +42,7 @@ public class Limelight extends SubsystemBase { @Override public void periodic() { - // This method will be called once per scheduler run + CameraServer.startAutomaticCapture(); + Shuffleboard.getTab("SmartDashBoard") .add("limelight",0.1); } }