This commit is contained in:
2024-11-25 18:35:18 -05:00
6 changed files with 334 additions and 37 deletions

View File

@ -27,16 +27,12 @@ public class FollowAprilTag extends Command {
@Override
public void execute() {
if (lanceur.limitswitch1()){
}
else if(lanceur.limitswitch2()){
}
else if (enlignement.getv()==1)
{
lanceur.tourelRotation(0,0, enlignement.getx()/30);
}
if (enlignement.getv()==1)
{
lanceur.tourelRotation(0,0, enlignement.getx()/30);
}
else
{
lanceur.tourelRotation(0, 0, 0);

View File

@ -4,9 +4,13 @@
package frc.robot;
import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.auto.NamedCommands;
import edu.wpi.first.math.MathUtil;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.RunCommand;
@ -20,6 +24,7 @@ import frc.robot.Subsystems.Lanceur;
import frc.robot.Subsystems.Limelight3G;
public class RobotContainer {
private final SendableChooser<Command> autoChooser;
Lanceur lanceur= new Lanceur();
Accumulateur accumulateur = new Accumulateur();
Limelight3G limelight3G = new Limelight3G();
@ -27,6 +32,8 @@ public class RobotContainer {
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
CommandXboxController manette = new CommandXboxController(0);
public RobotContainer() {
NamedCommands.registerCommand("lancer", new Lancer(lanceur, accumulateur));
autoChooser = AutoBuilder.buildAutoChooser();
dashboard.addCamera("limelight3G", "limelight3G","limelight.local:5800")
.withSize(3,3)
.withPosition(5,0);
@ -37,6 +44,9 @@ public class RobotContainer {
drive.setDefaultCommand(new RunCommand(()->{
drive.drive(-MathUtil.applyDeadband(manette.getRightX(),0.2), MathUtil.applyDeadband(-manette.getRightY(),0.2), MathUtil.applyDeadband(-manette.getRightX(), 0.2));
},drive));
dashboard.add("autochooser",autoChooser)
.withSize(1,1)
.withPosition(6,0);
}
private void configureBindings() {
@ -47,6 +57,6 @@ public class RobotContainer {
}
public Command getAutonomousCommand() {
return Commands.print("No autonomous command configured");
return autoChooser.getSelected();
}
}