Compare commits
No commits in common. "75c59ddbe5528cab4565a54537f7d77d46b02b51" and "1facdb07e5354ddbb305a058564278f8ff6760cf" have entirely different histories.
75c59ddbe5
...
1facdb07e5
@ -4,18 +4,14 @@
|
|||||||
|
|
||||||
package frc.robot.Commands;
|
package frc.robot.Commands;
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import edu.wpi.first.wpilibj2.command.WaitCommand;
|
|
||||||
import frc.robot.Subsystems.Accumulateur;
|
|
||||||
import frc.robot.Subsystems.Lanceur;
|
import frc.robot.Subsystems.Lanceur;
|
||||||
|
|
||||||
public class Lancer extends Command {
|
public class Lancer extends Command {
|
||||||
private Lanceur lanceur;
|
private Lanceur lanceur;
|
||||||
private Accumulateur accumulateur;
|
|
||||||
/** Creates a new Lancer. */
|
/** Creates a new Lancer. */
|
||||||
public Lancer(Lanceur lanceur,Accumulateur accumulateur) {
|
public Lancer(Lanceur lanceur) {
|
||||||
this.lanceur = lanceur;
|
this.lanceur = lanceur;
|
||||||
this.accumulateur = accumulateur;
|
addRequirements(lanceur);
|
||||||
addRequirements(lanceur, accumulateur);
|
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
}
|
}
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@ -26,10 +22,7 @@ public class Lancer extends Command {
|
|||||||
// Called every time the scheduler runs while the command is scheduled.
|
// Called every time the scheduler runs while the command is scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
lanceur.lance();
|
lanceur.lance(0.5);
|
||||||
accumulateur.desaccumule(0.2);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,12 +13,10 @@ import com.revrobotics.CANSparkMax;
|
|||||||
import com.revrobotics.CANSparkLowLevel.MotorType;
|
import com.revrobotics.CANSparkLowLevel.MotorType;
|
||||||
|
|
||||||
import edu.wpi.first.networktables.GenericEntry;
|
import edu.wpi.first.networktables.GenericEntry;
|
||||||
import edu.wpi.first.wpilibj.DigitalInput;
|
|
||||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
|
||||||
|
|
||||||
public class Lanceur extends SubsystemBase {
|
public class Lanceur extends SubsystemBase {
|
||||||
/** Creates a new Lanceur. */
|
/** Creates a new Lanceur. */
|
||||||
public Lanceur() {dashboard.add("rottourel", 0.2)
|
public Lanceur() {dashboard.add("rottourel", 0.2)
|
||||||
@ -29,8 +27,7 @@ public class Lanceur extends SubsystemBase {
|
|||||||
final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0);
|
final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0);
|
||||||
final WPI_TalonSRX lanceur2 = new WPI_TalonSRX(1);
|
final WPI_TalonSRX lanceur2 = new WPI_TalonSRX(1);
|
||||||
final CANSparkMax tourelle = new CANSparkMax(2, MotorType.kBrushed);
|
final CANSparkMax tourelle = new CANSparkMax(2, MotorType.kBrushed);
|
||||||
final DigitalInput limitswitch1 = new DigitalInput(0);
|
final
|
||||||
final DigitalInput limitswitch2 = new DigitalInput(1);
|
|
||||||
private GenericEntry vitesse =
|
private GenericEntry vitesse =
|
||||||
dashboard.add("vitesselanceur", 0.2)
|
dashboard.add("vitesselanceur", 0.2)
|
||||||
.withSize(0,0)
|
.withSize(0,0)
|
||||||
@ -42,13 +39,12 @@ public class Lanceur extends SubsystemBase {
|
|||||||
lanceur2.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
|
lanceur2.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
|
||||||
lanceur1.setStatusFramePeriod(StatusFrameEnhanced.Status_2_Feedback0, 1);
|
lanceur1.setStatusFramePeriod(StatusFrameEnhanced.Status_2_Feedback0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void masterslave(){
|
public void masterslave(){
|
||||||
lanceur2.follow(lanceur1);
|
lanceur2.follow(lanceur1);
|
||||||
lanceur2.setInverted(true);
|
lanceur2.setInverted(true);
|
||||||
}
|
}
|
||||||
public void lance(double vitesse){
|
public void lance(double vitesse){
|
||||||
lanceur1.set(vitesse);
|
lanceur1.set(vitesse);lanceur2.set(vitesse);
|
||||||
}
|
}
|
||||||
public void lance(){
|
public void lance(){
|
||||||
lance(vitesse.getDouble(0.2));
|
lance(vitesse.getDouble(0.2));
|
||||||
@ -68,12 +64,6 @@ public class Lanceur extends SubsystemBase {
|
|||||||
lanceur1.config_kI(0, i);
|
lanceur1.config_kI(0, i);
|
||||||
lanceur1.config_kD(0, d);
|
lanceur1.config_kD(0, d);
|
||||||
}
|
}
|
||||||
public boolean limitswitch1(){
|
|
||||||
return limitswitch1.get();
|
|
||||||
}
|
|
||||||
public boolean limitswitch2(){
|
|
||||||
return limitswitch2.get();
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public void periodic() {
|
public void periodic() {
|
||||||
// This method will be called oncehttps://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2024-latest.json per scheduler run
|
// This method will be called oncehttps://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2024-latest.json per scheduler run
|
||||||
|
Loading…
x
Reference in New Issue
Block a user