Merge branch 'main' of https://git.demerso.net/PLS5618/Reefscape-2025
This commit is contained in:
commit
b312854f0b
@ -1,9 +1,4 @@
|
||||
{
|
||||
"Joysticks": {
|
||||
"window": {
|
||||
"visible": false
|
||||
}
|
||||
},
|
||||
"System Joysticks": {
|
||||
"window": {
|
||||
"enabled": false
|
||||
|
@ -24,30 +24,27 @@ import edu.wpi.first.wpilibj2.command.RunCommand;
|
||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||
import frc.robot.TunerConstants.TunerConstants;
|
||||
import frc.robot.commands.Algue1Test;
|
||||
import frc.robot.commands.Algue2Test;
|
||||
import frc.robot.commands.AlgueExpire;
|
||||
import frc.robot.commands.Algue_inspire;
|
||||
import frc.robot.commands.AprilTag3;
|
||||
import frc.robot.commands.AprilTag3G;
|
||||
import frc.robot.commands.CorailAspir;
|
||||
import frc.robot.commands.CorailTest;
|
||||
import frc.robot.commands.CoralAlgueInspire;
|
||||
import frc.robot.commands.CoralExpire;
|
||||
import frc.robot.commands.Depart;
|
||||
import frc.robot.commands.ElevateurManuel;
|
||||
import frc.robot.commands.Forme3;
|
||||
import frc.robot.commands.L2;
|
||||
import frc.robot.commands.L3;
|
||||
import frc.robot.commands.L4;
|
||||
import frc.robot.commands.PinceManuel;
|
||||
import frc.robot.commands.PinceManuel2;
|
||||
import frc.robot.commands.RainBow;
|
||||
import frc.robot.commands.StationPince;
|
||||
import frc.robot.commands.reset;
|
||||
import frc.robot.commands.Elevateur.Depart;
|
||||
import frc.robot.commands.Elevateur.ElevateurManuel;
|
||||
import frc.robot.commands.Elevateur.L2;
|
||||
import frc.robot.commands.Elevateur.L3;
|
||||
import frc.robot.commands.Elevateur.L4;
|
||||
import frc.robot.commands.Pince.AlgueExpire;
|
||||
import frc.robot.commands.Pince.Algue_inspire;
|
||||
import frc.robot.commands.Pince.CorailAspir;
|
||||
import frc.robot.commands.Pince.CoralAlgueInspire;
|
||||
import frc.robot.commands.Pince.CoralExpire;
|
||||
import frc.robot.commands.Pince.PinceManuel;
|
||||
import frc.robot.subsystems.Bougie;
|
||||
import frc.robot.subsystems.CommandSwerveDrivetrain;
|
||||
import frc.robot.subsystems.Elevateur;
|
||||
import frc.robot.subsystems.Grimpeur;
|
||||
import frc.robot.subsystems.Limelight3;
|
||||
import frc.robot.subsystems.Limelight3G;
|
||||
import frc.robot.subsystems.Pince;
|
||||
@ -76,14 +73,12 @@ public class RobotContainer {
|
||||
Pince pince = new Pince();
|
||||
ElevateurManuel elevateurManuel = new ElevateurManuel(elevateur, manette2::getLeftY);
|
||||
PinceManuel pinceManuel = new PinceManuel(pince,manette2::getRightY);
|
||||
PinceManuel2 pinceManuel2 = new PinceManuel2(pince);
|
||||
Bougie bougie = new Bougie();
|
||||
Limelight3G limelight3g = new Limelight3G();
|
||||
Limelight3 limelight3 = new Limelight3();
|
||||
Pose2d pose = new Pose2d();
|
||||
Grimpeur Grimpeur = new Grimpeur();
|
||||
|
||||
|
||||
|
||||
public RobotContainer() {
|
||||
autoChooser = AutoBuilder.buildAutoChooser("New Auto");
|
||||
SmartDashboard.putData("Auto Mode", autoChooser);
|
||||
@ -118,31 +113,35 @@ public class RobotContainer {
|
||||
|
||||
|
||||
// manette1
|
||||
// reset the field-centric heading on left bumper press
|
||||
|
||||
// reset the field-centric heading on start press
|
||||
manette1.start().onTrue(drivetrain.runOnce(() -> drivetrain.seedFieldCentric()));
|
||||
|
||||
//elevateur
|
||||
manette1.a().whileTrue(new Depart(elevateur, pince));
|
||||
manette1.b().whileTrue(new L2(elevateur,pince));
|
||||
manette1.x().whileTrue(new L3(elevateur, pince));
|
||||
manette1.y().whileTrue(new L4(elevateur, pince));
|
||||
|
||||
//pince
|
||||
manette1.rightTrigger().whileTrue(new CoralAlgueInspire(pince, bougie));
|
||||
manette1.rightBumper().whileTrue(new StationPince(pince, elevateur));
|
||||
manette1.leftTrigger().whileTrue(new CoralExpire(pince, bougie));
|
||||
|
||||
//manette2
|
||||
manette2.leftTrigger().whileTrue(new AlgueExpire(pince, bougie));
|
||||
|
||||
//pince
|
||||
manette2.a().whileTrue(new CorailAspir(pince));
|
||||
manette2.start().whileTrue(new reset(elevateur,pince));
|
||||
manette2.b().whileTrue(new Algue_inspire(pince));
|
||||
manette2.start().whileTrue(new reset(elevateur,pince));
|
||||
manette2.leftTrigger().whileTrue(new AlgueExpire(pince, bougie));
|
||||
|
||||
//limelight
|
||||
manette2.leftBumper().whileTrue(new AprilTag3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY));
|
||||
manette2.rightBumper().whileTrue(new Forme3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Note that X is defined as forward according to WPILib convention,
|
||||
// and Y is defined as to the left according to WPILib convention.
|
||||
|
||||
|
||||
// manette2.leftTrigger().whileTrue(new AprilTag3G(limelight3g,drivetrain,manette1::getLeftX,manette1::getLeftY));
|
||||
|
||||
public Command getAutonomousCommand() {
|
||||
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Elevateur;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Elevateur;
|
||||
@ -11,12 +11,10 @@ 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 Depart extends Command {
|
||||
private Elevateur elevateur;
|
||||
private Pince pince;
|
||||
/** Creates a new L2. */
|
||||
public Depart(Elevateur elevateur, Pince pince) {
|
||||
this.pince = pince;
|
||||
this.elevateur = elevateur;
|
||||
addRequirements(elevateur,pince);
|
||||
addRequirements(elevateur);
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
}
|
||||
|
||||
@ -41,12 +39,11 @@ public class Depart extends Command {
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
elevateur.vitesse(0);
|
||||
pince.pivote(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return elevateur.limit2()==true;
|
||||
return elevateur.limit2() == true;
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Elevateur;
|
||||
|
||||
import java.util.function.DoubleSupplier;
|
||||
|
||||
@ -28,9 +28,7 @@ public class ElevateurManuel extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(elevateur.limit2()==true){
|
||||
elevateur.vitesse(0);
|
||||
}
|
||||
if (elevateur.limit2())
|
||||
elevateur.vitesse(doubleSupplier.getAsDouble()/3.5);
|
||||
}
|
||||
|
@ -2,8 +2,10 @@
|
||||
// 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.commands;
|
||||
|
||||
package frc.robot.commands.Elevateur;
|
||||
import edu.wpi.first.networktables.DoubleSubscriber;
|
||||
import edu.wpi.first.networktables.NetworkTable;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
|
||||
import frc.robot.subsystems.Elevateur;
|
||||
@ -13,6 +15,13 @@ import frc.robot.subsystems.Pince;
|
||||
public class L2 extends Command {
|
||||
private Elevateur elevateur;
|
||||
private Pince pince;
|
||||
|
||||
NetworkTableInstance networktable = NetworkTableInstance.getDefault();
|
||||
NetworkTable tabelevateur = networktable.getTable("tabelevateur");
|
||||
private DoubleSubscriber encodeur1 = tabelevateur.getDoubleTopic("encodeurelevateurbasL2").subscribe(-1);
|
||||
private DoubleSubscriber encodeur2 = tabelevateur.getDoubleTopic("encodeurelevateurhautL2").subscribe(-0.9);
|
||||
private DoubleSubscriber encodeur3 = tabelevateur.getDoubleTopic("encodeurpincebasL2").subscribe(-1);
|
||||
private DoubleSubscriber encodeur4 = tabelevateur.getDoubleTopic("encodeurpinceautL2").subscribe(-0.9);
|
||||
/** Creates a new L2. */
|
||||
public L2(Elevateur elevateur,Pince pince) {
|
||||
this.elevateur = elevateur;
|
||||
@ -28,10 +37,14 @@ public class L2 extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(elevateur.position()<=-1 && elevateur.position()>=-0.9){
|
||||
double encodeurbase = encodeur1.get();
|
||||
double encodeurhaute = encodeur2.get();
|
||||
double encodeurbasp = encodeur3.get();
|
||||
double encodeurhautp = encodeur4.get();
|
||||
if(elevateur.position()<=encodeurbase && elevateur.position()>=-encodeurhaute){
|
||||
elevateur.vitesse(0);
|
||||
}
|
||||
else if(elevateur.position()>=-1){
|
||||
else if(elevateur.position()>=encodeurbase){
|
||||
elevateur.vitesse(-0.2);
|
||||
}
|
||||
else{
|
@ -2,8 +2,11 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Elevateur;
|
||||
|
||||
import edu.wpi.first.networktables.DoubleSubscriber;
|
||||
import edu.wpi.first.networktables.NetworkTable;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
|
||||
import frc.robot.subsystems.Elevateur;
|
||||
@ -13,6 +16,12 @@ import frc.robot.subsystems.Pince;
|
||||
public class L3 extends Command {
|
||||
private Elevateur elevateur;
|
||||
private Pince pince;
|
||||
NetworkTableInstance networktable = NetworkTableInstance.getDefault();
|
||||
NetworkTable tabelevateur = networktable.getTable("tabelevateur");
|
||||
private DoubleSubscriber encodeur1 = tabelevateur.getDoubleTopic("encodeurhautL3").subscribe(-2.9);
|
||||
private DoubleSubscriber encodeur2 = tabelevateur.getDoubleTopic("encodeurbasL3").subscribe(-3);
|
||||
private DoubleSubscriber encodeur3 = tabelevateur.getDoubleTopic("encodeurpincebasL3").subscribe(-1);
|
||||
private DoubleSubscriber encodeur4 = tabelevateur.getDoubleTopic("encodeurpincehautL3").subscribe(-0.9);
|
||||
/** Creates a new L2. */
|
||||
public L3(Elevateur elevateur,Pince pince) {
|
||||
this.elevateur = elevateur;
|
||||
@ -28,10 +37,14 @@ public class L3 extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(elevateur.position()<=-2.9 && elevateur.position()>=-3){
|
||||
double encodeurHaute = encodeur1.get();
|
||||
double encodeurBase = encodeur2.get();
|
||||
double encodeurbase = encodeur3.get();
|
||||
double encodeurhaute = encodeur4.get();
|
||||
if(elevateur.position()<=-encodeurHaute && elevateur.position()>=encodeurBase){
|
||||
elevateur.vitesse(0);
|
||||
}
|
||||
else if(elevateur.position()>=-2.9){
|
||||
else if(elevateur.position()>=-encodeurHaute){
|
||||
elevateur.vitesse(-0.2);
|
||||
}
|
||||
else{
|
@ -2,8 +2,12 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Elevateur;
|
||||
|
||||
import edu.wpi.first.networktables.DoubleSubscriber;
|
||||
import edu.wpi.first.networktables.DoubleTopic;
|
||||
import edu.wpi.first.networktables.NetworkTable;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
|
||||
import frc.robot.subsystems.Elevateur;
|
||||
@ -13,10 +17,18 @@ import frc.robot.subsystems.Pince;
|
||||
public class L4 extends Command {
|
||||
private Elevateur elevateur;
|
||||
private Pince pince;
|
||||
NetworkTableInstance networktable = NetworkTableInstance.getDefault();
|
||||
NetworkTable tabelevateur = networktable.getTable("tabelevateur");
|
||||
private DoubleTopic encodeur1topic = tabelevateur.getDoubleTopic("encodeurbasL4");
|
||||
DoubleSubscriber encodeur1 = encodeur1topic.subscribe(-6.4);
|
||||
private DoubleSubscriber encodeur2 = tabelevateur.getDoubleTopic("encodeurhautL4").subscribe(-6.5);
|
||||
private DoubleSubscriber encodeur3 = tabelevateur.getDoubleTopic("encodeurpincebasL4").subscribe(-1);
|
||||
private DoubleSubscriber encodeur4 = tabelevateur.getDoubleTopic("encodeurpincehautL4").subscribe(-0.9);
|
||||
/** Creates a new L2. */
|
||||
public L4(Elevateur elevateur,Pince pince) {
|
||||
this.elevateur = elevateur;
|
||||
this.pince = pince;
|
||||
encodeur1topic.setPersistent(true);
|
||||
addRequirements(elevateur,pince);
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
}
|
||||
@ -28,10 +40,14 @@ public class L4 extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(elevateur.position()<=-6.5 && elevateur.position()>=-6.4){
|
||||
double encodeurBase = encodeur1.get();
|
||||
double encodeurhaute = encodeur2.get();
|
||||
double encodeurbasp = encodeur3.get();
|
||||
double encodeurhautp = encodeur4.get();
|
||||
if(elevateur.position()<=encodeurhaute && elevateur.position()>=encodeurBase){
|
||||
elevateur.vitesse(0);
|
||||
}
|
||||
else if(elevateur.position()>=-6.5){
|
||||
else if(elevateur.position()>=encodeurhaute){
|
||||
elevateur.vitesse(-0.2);
|
||||
}
|
||||
else{
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Pince;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Pince;
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Pince;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Pince;
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Pince;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Bougie;
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Pince;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Pince;
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Pince;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Pince;
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Pince;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Pince;
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Pince;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Bougie;
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Pince;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Pince;
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Pince;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Pince;
|
@ -2,7 +2,7 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.Pince;
|
||||
import java.util.function.DoubleSupplier;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
@ -9,8 +9,8 @@ import frc.robot.subsystems.Bougie;
|
||||
|
||||
/* 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 RainBow extends Command {
|
||||
Bougie bougie;
|
||||
/** Creates a new RainBow. */
|
||||
private Bougie bougie;
|
||||
public RainBow(Bougie bougie) {
|
||||
this.bougie = bougie;
|
||||
addRequirements(bougie);
|
||||
|
@ -4,6 +4,9 @@
|
||||
|
||||
package frc.robot.commands;
|
||||
|
||||
import edu.wpi.first.networktables.DoubleSubscriber;
|
||||
import edu.wpi.first.networktables.NetworkTable;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Elevateur;
|
||||
import frc.robot.subsystems.Pince;
|
||||
@ -13,6 +16,12 @@ public class StationPince extends Command {
|
||||
|
||||
private Pince pince;
|
||||
private Elevateur elevateur;
|
||||
NetworkTableInstance networktable = NetworkTableInstance.getDefault();
|
||||
NetworkTable tabelevateur = networktable.getTable("tabelevateur");
|
||||
private DoubleSubscriber encodeur1 = tabelevateur.getDoubleTopic("encodeur bas Station").subscribe(-0.5);
|
||||
private DoubleSubscriber encodeur2 = tabelevateur.getDoubleTopic("encodeur haut Station").subscribe(-0.4);
|
||||
private DoubleSubscriber encodeur3 = tabelevateur.getDoubleTopic("encodeur pince bas Station").subscribe(-1);
|
||||
private DoubleSubscriber encodeur4 = tabelevateur.getDoubleTopic("encodeur pince haut Station").subscribe(-0.9);
|
||||
/** Creates a new L2Pince. */
|
||||
public StationPince(Pince pince,Elevateur elevateur) {
|
||||
this.elevateur = elevateur;
|
||||
@ -28,11 +37,15 @@ public class StationPince extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
double encodeurBase = encodeur1.get();
|
||||
double encodeurhaute = encodeur2.get();
|
||||
double encodeurbasp = encodeur3.get();
|
||||
double encodeurhautp = encodeur4.get();
|
||||
pince.aspirecoral(0.5);
|
||||
if(pince.encodeurpivot()>=900 && pince.encodeurpivot()<=910){
|
||||
if(pince.encodeurpivot()<=encodeurBase && pince.encodeurpivot()>=encodeurhaute){
|
||||
pince.pivote(0);
|
||||
}
|
||||
else if(pince.encodeurpivot()>=910){
|
||||
else if(pince.encodeurpivot()>=encodeurBase){
|
||||
pince.pivote(0.2);
|
||||
}
|
||||
else{
|
||||
|
56
src/main/java/frc/robot/commands/grimpeur/GrimperHaut.java
Normal file
56
src/main/java/frc/robot/commands/grimpeur/GrimperHaut.java
Normal file
@ -0,0 +1,56 @@
|
||||
// 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.commands.grimpeur;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Bougie;
|
||||
import frc.robot.subsystems.Grimpeur;
|
||||
|
||||
/* 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 GrimperHaut extends Command {
|
||||
private Grimpeur grimpeur;
|
||||
private Bougie bougie;
|
||||
/** Creates a new Grimper. */
|
||||
public GrimperHaut(Grimpeur grimpeur, Bougie bougie) {
|
||||
this.grimpeur = grimpeur;
|
||||
this.bougie = bougie;
|
||||
addRequirements(grimpeur,bougie);
|
||||
// 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(grimpeur.stop()==true){
|
||||
grimpeur.grimpe(0);
|
||||
grimpeur.reset();
|
||||
bougie.RainBow();
|
||||
}
|
||||
else{
|
||||
grimpeur.grimpe(0.5);
|
||||
bougie.RainBowStop();
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
grimpeur.grimpe(0);
|
||||
if(grimpeur.stop()){
|
||||
bougie.RainBow();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return grimpeur.stop()==true;
|
||||
}
|
||||
}
|
57
src/main/java/frc/robot/commands/grimpeur/GrimpeurBas.java
Normal file
57
src/main/java/frc/robot/commands/grimpeur/GrimpeurBas.java
Normal file
@ -0,0 +1,57 @@
|
||||
// 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.commands.grimpeur;
|
||||
|
||||
import edu.wpi.first.networktables.DoubleSubscriber;
|
||||
import edu.wpi.first.networktables.NetworkTable;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Grimpeur;
|
||||
|
||||
/* 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 GrimpeurBas extends Command {
|
||||
private Grimpeur grimpeur;
|
||||
NetworkTableInstance networktable = NetworkTableInstance.getDefault();
|
||||
NetworkTable tabelevateur = networktable.getTable("tabelevateur");
|
||||
private DoubleSubscriber encodeur1 = tabelevateur.getDoubleTopic("encodeurgrimpeurbas").subscribe(-39.19);
|
||||
private DoubleSubscriber encodeur2 = tabelevateur.getDoubleTopic("encodeurgrimpeurhaut ").subscribe(-38.5);
|
||||
/** Creates a new GrimpeurBas. */
|
||||
public GrimpeurBas(Grimpeur grimpeur) {
|
||||
this.grimpeur = grimpeur;
|
||||
addRequirements(grimpeur);
|
||||
// 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() {
|
||||
double encodeurbas = encodeur1.get();
|
||||
double encodeurhaut = encodeur2.get();
|
||||
if(grimpeur.encodeur()>=encodeurhaut && grimpeur.encodeur()<=encodeurbas){
|
||||
grimpeur.grimpe(0);
|
||||
}
|
||||
else if(grimpeur.encodeur()>=encodeurhaut){
|
||||
grimpeur.grimpe(-0.5);
|
||||
}
|
||||
else{grimpeur.grimpe(0.5);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
grimpeur.grimpe(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
// 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.commands.grimpeur;
|
||||
|
||||
import java.util.function.DoubleSupplier;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Grimpeur;
|
||||
|
||||
/* 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 GrimpeurManuel extends Command {
|
||||
private Grimpeur grimpeur;
|
||||
private DoubleSupplier x;
|
||||
/** Creates a new GrimpeurManuel. */
|
||||
public GrimpeurManuel(Grimpeur grimpeur,DoubleSupplier x) {
|
||||
this.grimpeur = grimpeur;
|
||||
this.x = x;
|
||||
addRequirements(grimpeur);
|
||||
// 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(grimpeur.stop()){
|
||||
grimpeur.grimpe(0);
|
||||
}
|
||||
else{
|
||||
grimpeur.grimpe(x.getAsDouble());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
grimpeur.grimpe(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
39
src/main/java/frc/robot/commands/grimpeur/ResetGrimpeur.java
Normal file
39
src/main/java/frc/robot/commands/grimpeur/ResetGrimpeur.java
Normal file
@ -0,0 +1,39 @@
|
||||
// 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.commands.grimpeur;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Grimpeur;
|
||||
|
||||
/* 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 ResetGrimpeur extends Command {
|
||||
private Grimpeur grimpeur;
|
||||
/** Creates a new ResetGrimpeur. */
|
||||
public ResetGrimpeur(Grimpeur grimpeur) {
|
||||
this.grimpeur = grimpeur;
|
||||
addRequirements(grimpeur);
|
||||
// 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() {
|
||||
grimpeur.reset();
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
63
src/main/java/frc/robot/commands/requin/BalayeuseAlgue.java
Normal file
63
src/main/java/frc/robot/commands/requin/BalayeuseAlgue.java
Normal file
@ -0,0 +1,63 @@
|
||||
// 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.commands.requin;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Bougie;
|
||||
import frc.robot.subsystems.Requin;
|
||||
|
||||
/* 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 BalayeuseAlgue extends Command {
|
||||
private Requin requin;
|
||||
private Bougie bougie;
|
||||
/** Creates a new Balayeuse. */
|
||||
public BalayeuseAlgue(Requin requin, Bougie bougie) {
|
||||
this.requin = requin;
|
||||
this.bougie =bougie;
|
||||
addRequirements(requin,bougie);
|
||||
// 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(requin.encodeur()>=500 && requin.encodeur()<=510)
|
||||
{
|
||||
requin.rotationer(0);
|
||||
if(requin.amp()> 60){
|
||||
requin.balaye(0);
|
||||
bougie.Vert();
|
||||
}
|
||||
else
|
||||
{
|
||||
requin.balaye(0.5);
|
||||
}
|
||||
}
|
||||
else if(requin.encodeur()>=510){
|
||||
requin.rotationer(0.5);
|
||||
}
|
||||
else{
|
||||
requin.rotationer(-0.5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
requin.rotationer(0);
|
||||
requin.balaye(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
40
src/main/java/frc/robot/commands/requin/BalayeuseBas.java
Normal file
40
src/main/java/frc/robot/commands/requin/BalayeuseBas.java
Normal file
@ -0,0 +1,40 @@
|
||||
// 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.commands.requin;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Requin;
|
||||
|
||||
/* 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 BalayeuseBas extends Command {
|
||||
private Requin requin;
|
||||
/** Creates a new Balayeuse. */
|
||||
public BalayeuseBas(Requin requin) {
|
||||
this.requin = requin;
|
||||
addRequirements(requin);
|
||||
// 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() {
|
||||
requin.rotationer(-0.5);
|
||||
}
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
requin.rotationer(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
67
src/main/java/frc/robot/commands/requin/BalayeuseCoral.java
Normal file
67
src/main/java/frc/robot/commands/requin/BalayeuseCoral.java
Normal file
@ -0,0 +1,67 @@
|
||||
// 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.commands.requin;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Bougie;
|
||||
import frc.robot.subsystems.Requin;
|
||||
|
||||
/* 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 BalayeuseCoral extends Command {
|
||||
private Requin requin;
|
||||
private Bougie bougie;
|
||||
/** Creates a new Balayeuse. */
|
||||
public BalayeuseCoral(Requin requin, Bougie bougie) {
|
||||
this.requin = requin;
|
||||
this.bougie = bougie;
|
||||
addRequirements(requin,bougie);
|
||||
// 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(requin.encodeur()>=100 && requin.encodeur()<=110){
|
||||
requin.rotationer(0);
|
||||
if(requin.amp()>60){
|
||||
requin.balaye(0);
|
||||
bougie.Vert();
|
||||
if(requin.enHaut()){
|
||||
requin.rotationer(0);
|
||||
}
|
||||
else{
|
||||
requin.rotationer(0.5);
|
||||
}
|
||||
}
|
||||
else{
|
||||
requin.balaye(0.5);
|
||||
}
|
||||
}
|
||||
else if(requin.encodeur()>=110){
|
||||
requin.rotationer(0.5);
|
||||
}
|
||||
else{
|
||||
requin.rotationer(-0.5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
requin.rotationer(0);
|
||||
requin.balaye(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -2,22 +2,18 @@
|
||||
// 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.commands;
|
||||
package frc.robot.commands.requin;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Pince;
|
||||
import frc.robot.subsystems.Requin;
|
||||
|
||||
/* 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 PinceManuel2 extends Command {
|
||||
private Pince pince;
|
||||
//private DoubleSupplier doubleSupplier;
|
||||
/** Creates a new PinceManuel. */
|
||||
public PinceManuel2(Pince pince
|
||||
|
||||
//,DoubleSupplier doubleSupplier
|
||||
) {
|
||||
this.pince = pince;
|
||||
// this.doubleSupplier = doubleSupplier;
|
||||
addRequirements(pince);
|
||||
public class BalayeuseHaut extends Command {
|
||||
private Requin requin;
|
||||
/** Creates a new Balayeuse. */
|
||||
public BalayeuseHaut(Requin requin) {
|
||||
this.requin = requin;
|
||||
addRequirements(requin);
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
}
|
||||
|
||||
@ -28,15 +24,19 @@ public class PinceManuel2 extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
pince.pivote(-0.2);
|
||||
|
||||
if(requin.enHaut()==true){
|
||||
requin.rotationer(0);
|
||||
requin.reset();
|
||||
}
|
||||
else{
|
||||
requin.rotationer(-0.5);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
pince.pivote(0);
|
||||
requin.rotationer(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
41
src/main/java/frc/robot/commands/requin/ExpireAlgue.java
Normal file
41
src/main/java/frc/robot/commands/requin/ExpireAlgue.java
Normal file
@ -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.commands.requin;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Requin;
|
||||
|
||||
/* 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 ExpireAlgue extends Command {
|
||||
private Requin requin;
|
||||
/** Creates a new ExpireAlgue. */
|
||||
public ExpireAlgue(Requin requin) {
|
||||
this.requin = requin;
|
||||
addRequirements(requin);
|
||||
// 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() {
|
||||
requin.balaye(0.5);
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
requin.balaye(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
65
src/main/java/frc/robot/commands/requin/L1Requin.java
Normal file
65
src/main/java/frc/robot/commands/requin/L1Requin.java
Normal file
@ -0,0 +1,65 @@
|
||||
// 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.commands.requin;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Bougie;
|
||||
import frc.robot.subsystems.Requin;
|
||||
|
||||
/* 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 L1Requin extends Command {
|
||||
private Requin requin;
|
||||
private Bougie bougie;
|
||||
/** Creates a new Balayeuse. */
|
||||
public L1Requin(Requin requin,Bougie bougie) {
|
||||
this.requin = requin;
|
||||
this.bougie = bougie;
|
||||
addRequirements(requin,bougie);
|
||||
// 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(requin.encodeur()>=800 && requin.encodeur()<=810){
|
||||
requin.rotationer(0);
|
||||
if(requin.amp()>8){
|
||||
requin.balaye(-0.5);
|
||||
}
|
||||
else{
|
||||
requin.balaye(0);
|
||||
bougie.Rouge();
|
||||
}
|
||||
}
|
||||
else if(requin.encodeur()>=810){
|
||||
requin.rotationer(0.5);
|
||||
}
|
||||
else{
|
||||
requin.rotationer(-0.5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
requin.rotationer(0);
|
||||
requin.balaye(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
41
src/main/java/frc/robot/commands/requin/aspire.java
Normal file
41
src/main/java/frc/robot/commands/requin/aspire.java
Normal file
@ -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.commands.requin;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Requin;
|
||||
|
||||
/* 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 aspire extends Command {
|
||||
/** Creates a new aspire. */
|
||||
private Requin requin;
|
||||
public aspire(Requin requin) {
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
this.requin = requin;
|
||||
addRequirements(requin);
|
||||
}
|
||||
|
||||
// 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() {
|
||||
requin.balaye(0.3);
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
requin.balaye(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
41
src/main/java/frc/robot/commands/requin/exspire.java
Normal file
41
src/main/java/frc/robot/commands/requin/exspire.java
Normal file
@ -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.commands.requin;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Requin;
|
||||
|
||||
/* 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 exspire extends Command {
|
||||
/** Creates a new aspire. */
|
||||
private Requin requin;
|
||||
public exspire(Requin requin) {
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
this.requin = requin;
|
||||
addRequirements(requin);
|
||||
}
|
||||
|
||||
// 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() {
|
||||
requin.balaye(-0.3);
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
requin.balaye(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
49
src/main/java/frc/robot/commands/requin/requin_manuel.java
Normal file
49
src/main/java/frc/robot/commands/requin/requin_manuel.java
Normal file
@ -0,0 +1,49 @@
|
||||
// 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.commands.requin;
|
||||
|
||||
import java.util.function.DoubleSupplier;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Requin;
|
||||
|
||||
/* 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 requin_manuel extends Command {
|
||||
/** Creates a new requin_manuel. */
|
||||
private Requin requin;
|
||||
private DoubleSupplier x;
|
||||
public requin_manuel(Requin requin) {
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
this.requin = requin;
|
||||
addRequirements(requin);
|
||||
}
|
||||
|
||||
// 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(requin.enHaut()){
|
||||
requin.rotationer(0);
|
||||
}
|
||||
else{
|
||||
requin.rotationer(x.getAsDouble());
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
requin.rotationer(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -43,8 +43,12 @@ public class Bougie extends SubsystemBase {
|
||||
candle.setLEDs(255, 215, 0,0,48,8);
|
||||
candle.setLEDs(255, 215, 0,0,64,8);
|
||||
}
|
||||
public void RainBow(){candle.animate(rainbowAnim);}
|
||||
public void RainBowStop(){candle.animate(null);}
|
||||
public void RainBow(){
|
||||
candle.animate(rainbowAnim);
|
||||
}
|
||||
public void RainBowStop(){
|
||||
candle.animate(null);
|
||||
}
|
||||
@Override
|
||||
public void periodic() {
|
||||
// This method will be called once per scheduler run
|
||||
|
40
src/main/java/frc/robot/subsystems/Grimpeur.java
Normal file
40
src/main/java/frc/robot/subsystems/Grimpeur.java
Normal file
@ -0,0 +1,40 @@
|
||||
// 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.subsystems;
|
||||
|
||||
import com.revrobotics.spark.SparkMax;
|
||||
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class Grimpeur extends SubsystemBase {
|
||||
/** Creates a new Grimpeur. */
|
||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||
public Grimpeur() {
|
||||
teb.addBoolean("limit grimpeur", this::stop);
|
||||
teb.addDouble("encodeur grimpeur", this::encodeur);
|
||||
}
|
||||
final SparkMax grimpeur = new SparkMax(21,MotorType.kBrushless);
|
||||
final DigitalInput limit1 = new DigitalInput(2);
|
||||
public void grimpe(double vitesse){
|
||||
grimpeur.set(vitesse);
|
||||
}
|
||||
public boolean stop(){
|
||||
return limit1.get();
|
||||
}
|
||||
public double encodeur(){
|
||||
return grimpeur.getEncoder().getPosition();
|
||||
}
|
||||
public void reset(){
|
||||
grimpeur.getEncoder().setPosition(0);
|
||||
}
|
||||
@Override
|
||||
public void periodic() {
|
||||
// This method will be called once per scheduler run
|
||||
}
|
||||
}
|
48
src/main/java/frc/robot/subsystems/Requin.java
Normal file
48
src/main/java/frc/robot/subsystems/Requin.java
Normal file
@ -0,0 +1,48 @@
|
||||
// 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.subsystems;
|
||||
|
||||
import com.revrobotics.spark.SparkFlex;
|
||||
import com.revrobotics.spark.SparkMax;
|
||||
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class Requin extends SubsystemBase {
|
||||
/** Creates a new Requin. */
|
||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||
public Requin() {
|
||||
teb.addBoolean("limit requin", this::enHaut);
|
||||
}
|
||||
|
||||
final SparkFlex balaye = new SparkFlex(15, MotorType.kBrushless);
|
||||
final SparkMax rotatione = new SparkMax(17, MotorType.kBrushless);
|
||||
final DigitalInput limit3 = new DigitalInput(1);
|
||||
|
||||
public void balaye(double vitesse){
|
||||
balaye.set(vitesse);
|
||||
}
|
||||
public void rotationer(double vitesse){
|
||||
rotatione.set(vitesse);
|
||||
}
|
||||
public boolean enHaut(){
|
||||
return limit3.get();
|
||||
}
|
||||
public double encodeur(){
|
||||
return rotatione.getEncoder().getPosition();
|
||||
}
|
||||
public void reset(){
|
||||
rotatione.getEncoder().setPosition(0);
|
||||
}
|
||||
public double amp(){
|
||||
return balaye.getOutputCurrent();
|
||||
}
|
||||
@Override
|
||||
public void periodic() {
|
||||
// This method will be called once per scheduler run
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user