Compare commits
2 Commits
9fa5624504
...
3f546b61d6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f546b61d6 | ||
|
|
5a8a499e05 |
@@ -19,34 +19,9 @@
|
|||||||
"data": {
|
"data": {
|
||||||
"name": "AprilTag"
|
"name": "AprilTag"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "sequential",
|
|
||||||
"data": {
|
|
||||||
"commands": [
|
|
||||||
{
|
|
||||||
"type": "wait",
|
|
||||||
"data": {
|
|
||||||
"waitTime": 0.5
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "named",
|
|
||||||
"data": {
|
|
||||||
"name": "L4"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "named",
|
|
||||||
"data": {
|
|
||||||
"name": "CoralExpire"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType;
|
|||||||
import com.ctre.phoenix6.hardware.Pigeon2;
|
import com.ctre.phoenix6.hardware.Pigeon2;
|
||||||
import com.ctre.phoenix6.swerve.SwerveRequest;
|
import com.ctre.phoenix6.swerve.SwerveRequest;
|
||||||
import com.pathplanner.lib.auto.AutoBuilder;
|
import com.pathplanner.lib.auto.AutoBuilder;
|
||||||
|
import com.pathplanner.lib.auto.NamedCommands;
|
||||||
|
|
||||||
import edu.wpi.first.cameraserver.CameraServer;
|
import edu.wpi.first.cameraserver.CameraServer;
|
||||||
import edu.wpi.first.math.MathUtil;
|
import edu.wpi.first.math.MathUtil;
|
||||||
@@ -84,7 +85,6 @@ public class RobotContainer {
|
|||||||
public double getAngle() {
|
public double getAngle() {
|
||||||
return gyro.getYaw().getValueAsDouble(); // Retourne l'angle actuel du robot
|
return gyro.getYaw().getValueAsDouble(); // Retourne l'angle actuel du robot
|
||||||
}
|
}
|
||||||
|
|
||||||
Elevateur elevateur = new Elevateur();
|
Elevateur elevateur = new Elevateur();
|
||||||
Pince pince = new Pince();
|
Pince pince = new Pince();
|
||||||
ElevateurManuel elevateurManuel = new ElevateurManuel(elevateur, manette2::getLeftY);
|
ElevateurManuel elevateurManuel = new ElevateurManuel(elevateur, manette2::getLeftY);
|
||||||
@@ -98,6 +98,7 @@ public class RobotContainer {
|
|||||||
autoChooser = AutoBuilder.buildAutoChooser();
|
autoChooser = AutoBuilder.buildAutoChooser();
|
||||||
CameraServer.startAutomaticCapture();
|
CameraServer.startAutomaticCapture();
|
||||||
SmartDashboard.putData("Auto Chooser", autoChooser);
|
SmartDashboard.putData("Auto Chooser", autoChooser);
|
||||||
|
//NamedCommands.registerCommand("AprilTag", new AprilTag3(limelight3, drivetrain,, null));
|
||||||
configureBindings();
|
configureBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +117,7 @@ public class RobotContainer {
|
|||||||
manette1.rightTrigger().whileTrue(new CoralAlgueInspire(pince, bougie));
|
manette1.rightTrigger().whileTrue(new CoralAlgueInspire(pince, bougie));
|
||||||
manette1.rightBumper().toggleOnTrue(new StationPince(pince, elevateur,bougie));
|
manette1.rightBumper().toggleOnTrue(new StationPince(pince, elevateur,bougie));
|
||||||
manette1.povLeft().whileTrue(new AlgueExpire(pince, bougie));
|
manette1.povLeft().whileTrue(new AlgueExpire(pince, bougie));
|
||||||
// manette1.leftBumper().whileTrue(new AprilTag3G(limelight3g,drivetrain1,manette1::getLeftX,manette1::getLeftY));
|
manette1.leftBumper().whileTrue(new AprilTag3G(limelight3g,drivetrain,manette1::getLeftX,manette1::getLeftY));
|
||||||
manette1.povRight().whileTrue(new CoralExpire(pince, bougie));
|
manette1.povRight().whileTrue(new CoralExpire(pince, bougie));
|
||||||
manette1.leftTrigger().whileTrue(new DepartPince(pince));
|
manette1.leftTrigger().whileTrue(new DepartPince(pince));
|
||||||
manette1.povDown().whileTrue(new Algue_inspire(pince,bougie));
|
manette1.povDown().whileTrue(new Algue_inspire(pince,bougie));
|
||||||
@@ -140,8 +141,8 @@ public class RobotContainer {
|
|||||||
manette2.x().whileTrue(new ExpireCorail(requin, bougie));
|
manette2.x().whileTrue(new ExpireCorail(requin, bougie));
|
||||||
|
|
||||||
//limelight
|
//limelight
|
||||||
// manette2.a().whileTrue(new Forme3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY));
|
manette2.a().whileTrue(new Forme3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY));
|
||||||
// manette2.b().whileTrue(new AprilTag3(limelight3, drivetrain, manette1::getLeftX, manette1::getLeftY));
|
manette2.b().whileTrue(new AprilTag3(limelight3, drivetrain, manette1::getLeftX, manette1::getLeftY));
|
||||||
|
|
||||||
//Pince manuel
|
//Pince manuel
|
||||||
pince.setDefaultCommand(new RunCommand(()->{
|
pince.setDefaultCommand(new RunCommand(()->{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import frc.robot.subsystems.Limelight3;
|
|||||||
/* 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 */
|
/* 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 AprilTag3 extends Command {
|
public class AprilTag3 extends Command {
|
||||||
private Limelight3 limelight3;
|
private Limelight3 limelight3;
|
||||||
private CommandSwerveDrivetrain drivetrain = TunerConstants.createDrivetrain();
|
private CommandSwerveDrivetrain drivetrain;
|
||||||
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond);
|
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond);
|
||||||
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity
|
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity
|
||||||
private DoubleSupplier x;
|
private DoubleSupplier x;
|
||||||
@@ -69,6 +69,7 @@ public class AprilTag3 extends Command {
|
|||||||
x2 = 4.1;
|
x2 = 4.1;
|
||||||
}
|
}
|
||||||
double botx = BotPose[0];
|
double botx = BotPose[0];
|
||||||
|
System.out.println(botx);
|
||||||
double boty = BotPose[1];
|
double boty = BotPose[1];
|
||||||
double tx = limelight3.getTx();
|
double tx = limelight3.getTx();
|
||||||
double tagId = limelight3.getTId();
|
double tagId = limelight3.getTId();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import frc.robot.subsystems.Limelight3G;
|
|||||||
/* 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 */
|
/* 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 AprilTag3G extends Command {
|
public class AprilTag3G extends Command {
|
||||||
private Limelight3G limelight3g;
|
private Limelight3G limelight3g;
|
||||||
private CommandSwerveDrivetrain drivetrain = TunerConstants.createDrivetrain();
|
private CommandSwerveDrivetrain drivetrain;
|
||||||
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond);
|
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond);
|
||||||
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity
|
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity
|
||||||
private DoubleSupplier x;
|
private DoubleSupplier x;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class Forme3 extends Command {
|
|||||||
private Limelight3 limelight3;
|
private Limelight3 limelight3;
|
||||||
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond);
|
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond);
|
||||||
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity
|
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity
|
||||||
private CommandSwerveDrivetrain drivetrain = TunerConstants.createDrivetrain();
|
private CommandSwerveDrivetrain drivetrain;
|
||||||
private DoubleSupplier x;
|
private DoubleSupplier x;
|
||||||
private DoubleSupplier y;
|
private DoubleSupplier y;
|
||||||
/* Setting up bindings for necessary control of the swerve drive platform */
|
/* Setting up bindings for necessary control of the swerve drive platform */
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ public class Limelight3 extends SubsystemBase {
|
|||||||
}
|
}
|
||||||
public double[] getBotPoseBlue(){
|
public double[] getBotPoseBlue(){
|
||||||
NetworkTable limelightTable = NetworkTableInstance.getDefault().getTable("limelight-balon");
|
NetworkTable limelightTable = NetworkTableInstance.getDefault().getTable("limelight-balon");
|
||||||
NetworkTableEntry BotPoseEntry = limelightTable.getEntry("botpose_wpiblue");
|
NetworkTableEntry BotPoseEntry = limelightTable.getEntry("botpose_orb_wpiblue");
|
||||||
double[] BotPose = BotPoseEntry.getDoubleArray(new double[7]);
|
double[] BotPose = BotPoseEntry.getDoubleArray(new double[7]);
|
||||||
return BotPose;
|
return BotPose;
|
||||||
}
|
}
|
||||||
public double[] getBotPoseRed(){
|
public double[] getBotPoseRed(){
|
||||||
NetworkTable limelightTable = NetworkTableInstance.getDefault().getTable("limelight-balon");
|
NetworkTable limelightTable = NetworkTableInstance.getDefault().getTable("limelight-balon");
|
||||||
NetworkTableEntry BotPoseEntry = limelightTable.getEntry("botpose_wpired");
|
NetworkTableEntry BotPoseEntry = limelightTable.getEntry("botpose_orb_wpired");
|
||||||
double[] BotPose = BotPoseEntry.getDoubleArray(new double[7]);
|
double[] BotPose = BotPoseEntry.getDoubleArray(new double[7]);
|
||||||
return BotPose;
|
return BotPose;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user