mode auto

This commit is contained in:
EdwardFaucher
2024-11-18 18:46:50 -05:00
parent a023213a18
commit 4599457e14
5 changed files with 175 additions and 74 deletions

View File

@ -27,13 +27,13 @@ public class FollowAprilTag extends Command {
@Override
public void execute() {
if (enlignement.getv()==1)
{
lanceur.tourelRotation(0,0, enlignement.getx()/30);
}
if (lanceur.limitswitch1() || lanceur.limitswitch2()){
lanceur.lance(0);}
else 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(4,3)
.withPosition(0,0);
@ -47,6 +54,6 @@ public class RobotContainer {
}
public Command getAutonomousCommand() {
return Commands.print("No autonomous command configured");
return autoChooser.getSelected();
}
}