diff --git a/src/main/java/frc/robot/command/CoralAlgueExpire.java b/src/main/java/frc/robot/command/CoralAlgueExpire.java new file mode 100644 index 0000000..261619f --- /dev/null +++ b/src/main/java/frc/robot/command/CoralAlgueExpire.java @@ -0,0 +1,43 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.command; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Pince; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class CoralAlgueExpire extends Command { + private Pince pince; + /** Creates a new CoralAlgue. */ + public CoralAlgueExpire(Pince pince) { + this.pince = pince; + addRequirements(pince); + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + pince.aspirecoral(.5); + pince.aspirealgue(0.5); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + pince.aspirecoral(0); + pince.aspirealgue(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/command/CoralAlgueInspire.java b/src/main/java/frc/robot/command/CoralAlgueInspire.java new file mode 100644 index 0000000..d870285 --- /dev/null +++ b/src/main/java/frc/robot/command/CoralAlgueInspire.java @@ -0,0 +1,43 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.command; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Pince; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class CoralAlgueInspire extends Command { + private Pince pince; + /** Creates a new CoralAlgue. */ + public CoralAlgueInspire(Pince pince) { + this.pince = pince; + addRequirements(pince); + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + pince.aspirecoral(-.5); + pince.aspirealgue(-0.5); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + pince.aspirecoral(0); + pince.aspirealgue(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/command/CoralExpire.java b/src/main/java/frc/robot/command/CoralExpire.java new file mode 100644 index 0000000..f4fc090 --- /dev/null +++ b/src/main/java/frc/robot/command/CoralExpire.java @@ -0,0 +1,41 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.command; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Pince; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class CoralExpire extends Command { + private Pince pince; + /** Creates a new CoralAlgue. */ + public CoralExpire(Pince pince) { + this.pince = pince; + addRequirements(pince); + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + pince.aspirecoral(.5); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + pince.aspirecoral(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/command/CoralInspire.java b/src/main/java/frc/robot/command/CoralInspire.java new file mode 100644 index 0000000..6a3cc9e --- /dev/null +++ b/src/main/java/frc/robot/command/CoralInspire.java @@ -0,0 +1,41 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.command; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Pince; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class CoralInspire extends Command { + private Pince pince; + /** Creates a new CoralAlgue. */ + public CoralInspire(Pince pince) { + this.pince = pince; + addRequirements(pince); + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + pince.aspirecoral(-.5); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + pince.aspirecoral(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/command/DepartPince.java b/src/main/java/frc/robot/command/DepartPince.java new file mode 100644 index 0000000..6e229f1 --- /dev/null +++ b/src/main/java/frc/robot/command/DepartPince.java @@ -0,0 +1,47 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.command; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Pince; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class DepartPince extends Command { + private Pince pince; + /** Creates a new DepartPince. */ + public DepartPince(Pince pince) { + this.pince = pince; + addRequirements(pince); + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + if(pince.position()==true){ + pince.pivote(0); + pince.reset(); + } + else{ + pince.pivote(-.5); + } + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + pince.pivote(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/subsystems/Pince.java b/src/main/java/frc/robot/subsystems/Pince.java index e5219be..9b44423 100644 --- a/src/main/java/frc/robot/subsystems/Pince.java +++ b/src/main/java/frc/robot/subsystems/Pince.java @@ -31,8 +31,8 @@ public void aspirealgue(double vitesse){ public double encodeurpivot(){ return pivoti.getEncoder().getPosition(); } -public void pisotion(){ - limit6.get(); +public boolean position(){ + return limit6.get(); } public void reset(){ pivoti.getEncoder().setPosition(0);