tesdrfhgjbn

This commit is contained in:
samuel desharnais 2023-11-20 16:16:55 -05:00
parent 8bee4280be
commit 426d7e9885
4 changed files with 53 additions and 3 deletions

View File

@ -14,6 +14,11 @@ import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import edu.wpi.first.wpilibj2.command.button.JoystickButton; import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import frc.robot.commands.Avancer;
import frc.robot.commands.Force1;
import frc.robot.commands.Force6;
import frc.robot.commands.Force7;
import frc.robot.commands.Reculer;
import frc.robot.subsystems.Accumulateur; import frc.robot.subsystems.Accumulateur;
import frc.robot.subsystems.Drive; import frc.robot.subsystems.Drive;
import frc.robot.subsystems.Lanceur; import frc.robot.subsystems.Lanceur;
@ -21,6 +26,9 @@ import frc.robot.subsystems.Lanceur;
public class RobotContainer { public class RobotContainer {
Lanceur lanceur = new Lanceur(); Lanceur lanceur = new Lanceur();
Accumulateur accumulateur = new Accumulateur(); Accumulateur accumulateur = new Accumulateur();
Force7 Force7 = new Force7(lanceur, null, accumulateur);
Force1 Force1 = new Force1(lanceur, accumulateur, null);
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard"); ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
ShuffleboardLayout forces = Shuffleboard.getTab("Dashboard") ShuffleboardLayout forces = Shuffleboard.getTab("Dashboard")
.getLayout("limitswitchsgratte", BuiltInLayouts.kList) .getLayout("limitswitchsgratte", BuiltInLayouts.kList)
@ -54,6 +62,7 @@ public class RobotContainer {
} }
public Command getAutonomousCommand() { public Command getAutonomousCommand() {
return new SequentialCommandGroup(null); return new SequentialCommandGroup(new Avancer(drive), new Force7(lanceur, force7, accumulateur)
, new Force1(lanceur, accumulateur, force1), new Reculer(drive));
} }
} }

View File

@ -11,6 +11,8 @@ public class Avancer extends CommandBase {
private Drive drive; private Drive drive;
/** Creates a new Avancer. */ /** Creates a new Avancer. */
public Avancer(Drive drive) { public Avancer(Drive drive) {
this.drive = drive;
addRequirements(drive);
// Use addRequirements() here to declare subsystem dependencies. // Use addRequirements() here to declare subsystem dependencies.
} }

View File

@ -0,0 +1,38 @@
// 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;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.subsystems.Drive;
public class Reculer extends CommandBase {
private Drive drive;
/** Creates a new Reculer. */
public Reculer(Drive drive) {
this.drive = drive;
addRequirements(drive);
// 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() {
drive.drive(-0.5, -0.2, 0);
}
// 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;
}
}

View File

@ -30,8 +30,9 @@ public class Drive extends SubsystemBase {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void reset(){ /* public double distance(){
} return
}*/
@Override @Override
public void periodic() { public void periodic() {
// This method will be called once per scheduler run // This method will be called once per scheduler run