Compare commits
24 Commits
710e216b91
...
main
Author | SHA1 | Date | |
---|---|---|---|
172d3c92ab | |||
80e1f22ea3 | |||
792d780d89 | |||
398ea4ac82 | |||
59a44ada9a | |||
0878a276dd | |||
bb9870732c | |||
c4704210b9 | |||
63313b3b7a | |||
7de77db146 | |||
c0e7985ab7 | |||
004890fd7b | |||
0d63654df8 | |||
28d5118c1f | |||
5009a1c928 | |||
41e7d89919 | |||
b3c699ccf9 | |||
8852d0a1b6 | |||
9ce0d79903 | |||
a420d3ff2f | |||
b1124bd3f0 | |||
9f4142d7aa | |||
263caa4d85 | |||
e462e83f0e |
@ -17,21 +17,41 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "named",
|
||||
"type": "deadline",
|
||||
"data": {
|
||||
"name": "baleeuse"
|
||||
"commands": [
|
||||
{
|
||||
"type": "wait",
|
||||
"data": {
|
||||
"waitTime": 2.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "named",
|
||||
"data": {
|
||||
"name": "baleeuse"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "wait",
|
||||
"type": "deadline",
|
||||
"data": {
|
||||
"waitTime": 2.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "named",
|
||||
"data": {
|
||||
"name": "baleeuse sort"
|
||||
"commands": [
|
||||
{
|
||||
"type": "wait",
|
||||
"data": {
|
||||
"waitTime": 2.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "named",
|
||||
"data": {
|
||||
"name": "baleeuse sort"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
File diff suppressed because one or more lines are too long
@ -35,8 +35,8 @@
|
||||
"globalConstraints": {
|
||||
"maxVelocity": 3.0,
|
||||
"maxAcceleration": 3.0,
|
||||
"maxAngularVelocity": 540.0,
|
||||
"maxAngularAcceleration": 720.0,
|
||||
"maxAngularVelocity": 0.1,
|
||||
"maxAngularAcceleration": 0.1,
|
||||
"nominalVoltage": 12.0,
|
||||
"unlimited": false
|
||||
},
|
||||
|
@ -5,21 +5,21 @@
|
||||
package frc.robot;
|
||||
|
||||
import static edu.wpi.first.units.Units.*;
|
||||
|
||||
import java.util.Map;
|
||||
import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType;
|
||||
import com.ctre.phoenix6.hardware.Pigeon2;
|
||||
import com.ctre.phoenix6.swerve.SwerveRequest;
|
||||
import com.pathplanner.lib.auto.AutoBuilder;
|
||||
import com.pathplanner.lib.auto.NamedCommands;
|
||||
import com.pathplanner.lib.commands.PathPlannerAuto;
|
||||
import com.pathplanner.lib.util.FlippingUtil;
|
||||
import edu.wpi.first.cameraserver.CameraServer;
|
||||
import edu.wpi.first.math.MathUtil;
|
||||
import edu.wpi.first.math.geometry.Pose2d;
|
||||
import edu.wpi.first.wpilibj.DriverStation;
|
||||
import edu.wpi.first.wpilibj.DriverStation.Alliance;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
import edu.wpi.first.networktables.GenericEntry;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import edu.wpi.first.wpilibj2.command.Commands;
|
||||
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
|
||||
import edu.wpi.first.wpilibj2.command.RunCommand;
|
||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||
@ -41,9 +41,6 @@ import frc.robot.commands.Pince.CorailAspir;
|
||||
import frc.robot.commands.Pince.CoralAlgueInspire;
|
||||
import frc.robot.commands.Pince.CoralExpire;
|
||||
import frc.robot.commands.Pince.PinceManuel;
|
||||
import frc.robot.commands.grimpeur.GrimperHaut;
|
||||
import frc.robot.commands.grimpeur.GrimpeurBas;
|
||||
import frc.robot.commands.grimpeur.GrimpeurManuelhaut;
|
||||
import frc.robot.commands.requin.BalayeuseAlgue;
|
||||
import frc.robot.commands.requin.BalayeuseCoral;
|
||||
import frc.robot.commands.requin.BalayeuseHaut;
|
||||
@ -52,7 +49,6 @@ import frc.robot.commands.requin.L1Requin;
|
||||
import frc.robot.subsystems.Bougie;
|
||||
import frc.robot.subsystems.CommandSwerveDrivetrain;
|
||||
import frc.robot.subsystems.Elevateur;
|
||||
import frc.robot.subsystems.Grimpeur;
|
||||
import frc.robot.subsystems.Limelight3;
|
||||
import frc.robot.subsystems.Limelight3G;
|
||||
import frc.robot.subsystems.Pince;
|
||||
@ -63,11 +59,18 @@ import frc.robot.commands.Elevateur.balonL2;
|
||||
import frc.robot.commands.Elevateur.balonL3;
|
||||
|
||||
public class RobotContainer {
|
||||
ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto", BuiltInLayouts.kList)
|
||||
.withSize(2, 2).withProperties(Map.of("Label position", "LEFT"));
|
||||
GenericEntry L1 = layoutauto.add("choix L1",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||
GenericEntry sortirAngle = layoutauto.add("Cote?",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||
GenericEntry ReculerB = layoutauto.add("ReculerB",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||
GenericEntry ReculerR = layoutauto.add("ReculerR",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||
GenericEntry L4 = layoutauto.add("L4",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed
|
||||
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity
|
||||
|
||||
/* Setting up bindings for necessary control of the swerve drive platform */
|
||||
private final SwerveRequest.RobotCentric drive = new SwerveRequest.RobotCentric()
|
||||
private final SwerveRequest.FieldCentric drive = new SwerveRequest.FieldCentric()
|
||||
.withDeadband(MaxSpeed * 0.1).withRotationalDeadband(MaxAngularRate * 0.1) // Add a 10% deadband
|
||||
.withDriveRequestType(DriveRequestType.OpenLoopVoltage
|
||||
); // Use open-loop control for drive motors
|
||||
@ -77,11 +80,10 @@ public class RobotContainer {
|
||||
private final CommandXboxController manette2 = new CommandXboxController(1);
|
||||
private final Pigeon2 gyro = new Pigeon2(13); // ID du Pigeon 2
|
||||
public final CommandSwerveDrivetrain drivetrain = TunerConstants.createDrivetrain();
|
||||
private final SendableChooser<Command> autoChooser;
|
||||
public double getAngle() {
|
||||
return gyro.getYaw().getValueAsDouble(); // Retourne l'angle actuel du robot
|
||||
}
|
||||
|
||||
|
||||
Elevateur elevateur = new Elevateur();
|
||||
Pince pince = new Pince();
|
||||
ElevateurManuel elevateurManuel = new ElevateurManuel(elevateur, manette2::getLeftY);
|
||||
@ -90,48 +92,42 @@ public class RobotContainer {
|
||||
Limelight3G limelight3g = new Limelight3G();
|
||||
Limelight3 limelight3 = new Limelight3();
|
||||
Pose2d pose = new Pose2d();
|
||||
Grimpeur Grimpeur = new Grimpeur();
|
||||
Requin requin = new Requin();
|
||||
CorailAspir corailAspir = new CorailAspir(pince, bougie);
|
||||
public RobotContainer() {
|
||||
autoChooser = AutoBuilder.buildAutoChooser("New Auto");
|
||||
SmartDashboard.putData("Auto Mode", autoChooser);
|
||||
configureBindings();
|
||||
NamedCommands.registerCommand("AprilTag", new AprilTag3G(limelight3g, drivetrain, null, null));
|
||||
NamedCommands.registerCommand("Station",new StationPince(pince, elevateur,bougie));
|
||||
NamedCommands.registerCommand("L4", new L4(elevateur, pince));
|
||||
NamedCommands.registerCommand("L3", new L3(elevateur, pince));
|
||||
NamedCommands.registerCommand("CoralExpire",new CoralExpire(pince,bougie));
|
||||
NamedCommands.registerCommand("CoraletAlgue", new CoralAlgueInspire(pince,bougie));
|
||||
NamedCommands.registerCommand("baleeuse",new L1Requin(requin, bougie));
|
||||
NamedCommands.registerCommand("baleeuse sort", new ExpireCorail(requin, bougie));
|
||||
}
|
||||
CameraServer.startAutomaticCapture();
|
||||
configureBindings();
|
||||
}
|
||||
|
||||
private void configureBindings() {
|
||||
drivetrain.registerTelemetry(logger::telemeterize);
|
||||
drivetrain.setDefaultCommand(
|
||||
drivetrain.setDefaultCommand(
|
||||
// Drivetrain will execute this command periodically
|
||||
drivetrain.applyRequest(() ->
|
||||
drive.withVelocityY(MathUtil.applyDeadband(-manette1.getLeftX()*-manette1.getLeftX()*-manette1.getLeftX()*MaxSpeed, 0.05)) // Drive forward with negative Y (forward)
|
||||
.withVelocityX(MathUtil.applyDeadband(-manette1.getLeftY()*-manette1.getLeftY()*-manette1.getLeftY()*MaxSpeed, 0.05)) // Drive left with negative X (left)
|
||||
.withRotationalRate(MathUtil.applyDeadband(-manette1.getRightX()*-manette1.getRightX()*-manette1.getRightX()*MaxAngularRate, 0.05)) // Drive counterclockwise with negative X (left)
|
||||
.withRotationalRate(MathUtil.applyDeadband(-manette1.getRightX()*-manette1.getRightX()*-manette1.getRightX()*MaxAngularRate, 0.05)) // Drive counterclockwise with negative X (left)
|
||||
)
|
||||
);
|
||||
|
||||
/* Manette 1 */
|
||||
//pince
|
||||
manette1.rightTrigger().whileTrue(new CoralAlgueInspire(pince, bougie));
|
||||
manette1.rightBumper().whileTrue(new StationPince(pince, elevateur,bougie));
|
||||
manette1.rightBumper().toggleOnTrue(new StationPince(pince, elevateur,bougie));
|
||||
manette1.povLeft().whileTrue(new AlgueExpire(pince, bougie));
|
||||
manette1.leftBumper().whileTrue(new AprilTag3G(limelight3g,drivetrain,manette1::getLeftX,manette1::getLeftY));
|
||||
manette1.povRight().whileTrue(new CoralExpire(pince, bougie));
|
||||
manette1.leftTrigger().whileTrue(new DepartPince(pince));
|
||||
manette1.povDown().whileTrue(new Algue_inspire(pince,bougie));
|
||||
manette1.leftStick().whileTrue(new CorailAspir(pince, bougie));
|
||||
//elevateur
|
||||
manette1.a().whileTrue(new Depart(elevateur, pince));
|
||||
manette1.b().whileTrue(new L2(elevateur,pince));
|
||||
manette1.x().whileTrue(new L3(elevateur, pince));
|
||||
manette1.y().whileTrue(new L4(elevateur, pince));
|
||||
manette1.povUp().whileTrue(new balonL2(elevateur));
|
||||
manette1.start().whileTrue(new balonL3(elevateur));
|
||||
manette1.a().toggleOnTrue(new Depart(elevateur, pince));
|
||||
manette1.b().toggleOnTrue(new L2(elevateur,pince));
|
||||
manette1.x().toggleOnTrue(new L3(elevateur, pince));
|
||||
manette1.y().toggleOnTrue(new L4(elevateur, pince));
|
||||
manette1.povUp().toggleOnTrue(new balonL2(elevateur));
|
||||
manette1.start().toggleOnTrue(new balonL3(elevateur));
|
||||
|
||||
|
||||
/* Manette 2 */
|
||||
//requin
|
||||
@ -144,35 +140,51 @@ public class RobotContainer {
|
||||
|
||||
//limelight
|
||||
manette2.a().whileTrue(new Forme3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY));
|
||||
|
||||
//grimpeur
|
||||
manette2.povDown().whileTrue(new GrimpeurManuelhaut(Grimpeur, bougie));
|
||||
manette2.povLeft().whileTrue(new GrimperHaut(Grimpeur, bougie));
|
||||
manette2.povRight().whileTrue(new GrimpeurBas(Grimpeur));
|
||||
manette2.b().whileTrue(new AprilTag3(limelight3, drivetrain, manette1::getLeftX, manette1::getLeftY));
|
||||
|
||||
//Pince manuel
|
||||
pince.setDefaultCommand(new RunCommand(()->{
|
||||
pince.pivote(MathUtil.applyDeadband((manette2.getRightY()*manette2.getRightY()*manette2.getRightY())/3, 0.05));
|
||||
//Pince manuel
|
||||
pince.setDefaultCommand(new RunCommand(()->{
|
||||
pince.pivote(MathUtil.applyDeadband((manette2.getRightY()*manette2.getRightY()*manette2.getRightY())/3, 0.05));
|
||||
}, pince));
|
||||
|
||||
//Elevateur manuel
|
||||
elevateur.setDefaultCommand(new RunCommand(()->{
|
||||
elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftY()*manette2.getLeftY()*manette2.getLeftY(), 0.05));
|
||||
elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftY()*manette2.getLeftY()*manette2.getLeftY(), 0.05));
|
||||
}, elevateur));
|
||||
|
||||
//Reset encodeur
|
||||
manette2.start().whileTrue(new reset(elevateur, pince));
|
||||
manette2.start().whileTrue(new reset(elevateur, pince, requin));
|
||||
}
|
||||
|
||||
public Command getAutonomousCommand() {
|
||||
return new SequentialCommandGroup(Commands.runOnce(()->{
|
||||
boolean flip = DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Red;
|
||||
if(flip){
|
||||
drivetrain.resetPose(FlippingUtil.flipFieldPose(((PathPlannerAuto)autoChooser.getSelected()).getStartingPose()));
|
||||
}
|
||||
else{
|
||||
drivetrain.resetPose(((PathPlannerAuto)autoChooser.getSelected()).getStartingPose());
|
||||
}
|
||||
}),autoChooser.getSelected(), new RainBow(bougie));
|
||||
return new SequentialCommandGroup(
|
||||
drivetrain.applyRequest(()->
|
||||
drive.withVelocityX(0.1*MaxSpeed)
|
||||
.withVelocityY(0)
|
||||
.withRotationalRate(0)).unless(()->!ReculerR.getBoolean(true)).withTimeout(3.5),
|
||||
drivetrain.applyRequest(()->
|
||||
drive.withVelocityX(-0.1*MaxSpeed)
|
||||
.withVelocityY(0)
|
||||
.withRotationalRate(0)).unless(()->!ReculerB.getBoolean(true)).withTimeout(3.5),
|
||||
drivetrain.applyRequest(()->
|
||||
drive.withVelocityX(-0.1*MaxSpeed)
|
||||
.withVelocityY(0)
|
||||
.withRotationalRate(0)).unless(()->!L4.getBoolean(true)).withTimeout(2.35),
|
||||
drivetrain.applyRequest(()->
|
||||
drive.withVelocityX(0.1*MaxSpeed)
|
||||
.withVelocityY(0)
|
||||
.withRotationalRate(0)).unless(()->!sortirAngle.getBoolean(true)|| !ReculerR.getBoolean(true)).withTimeout(3),
|
||||
drivetrain.applyRequest(()->
|
||||
drive.withVelocityX(-0.1*MaxSpeed)
|
||||
.withVelocityY(0)
|
||||
.withRotationalRate(0)).unless(()->!sortirAngle.getBoolean(true)|| !ReculerB.getBoolean(true)).withTimeout(3),
|
||||
drivetrain.applyRequest(()->
|
||||
drive.withVelocityX(0)
|
||||
.withVelocityY(0)
|
||||
.withRotationalRate(0)).withTimeout(0.1),
|
||||
new L4(elevateur, pince).unless(()->!L4.getBoolean(true)).withTimeout(4),
|
||||
new L1Requin(requin, bougie).unless(()-> !L1.getBoolean(true)).withTimeout(2),
|
||||
new ExpireCorail(requin, bougie).unless(()->!L1.getBoolean(true)).withTimeout(2),
|
||||
new RainBow(bougie));
|
||||
}
|
||||
}
|
@ -78,7 +78,7 @@ public class TunerConstants {
|
||||
|
||||
// Theoretical free speed (m/s) at 12 V applied output;
|
||||
// This needs to be tuned to your individual robot
|
||||
public static final LinearVelocity kSpeedAt12Volts = MetersPerSecond.of(5.21);
|
||||
public static final LinearVelocity kSpeedAt12Volts = MetersPerSecond.of(6);
|
||||
|
||||
// Every 1 rotation of the azimuth results in kCoupleRatio drive motor turns;
|
||||
// This may need to be tuned to your individual robot
|
||||
|
54
src/main/java/frc/robot/commands/AvancerAuto.java
Normal file
54
src/main/java/frc/robot/commands/AvancerAuto.java
Normal file
@ -0,0 +1,54 @@
|
||||
// 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 static edu.wpi.first.units.Units.*;
|
||||
|
||||
import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType;
|
||||
import com.ctre.phoenix6.swerve.SwerveRequest;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.TunerConstants.TunerConstants;
|
||||
import frc.robot.subsystems.CommandSwerveDrivetrain;
|
||||
|
||||
/* 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 AvancerAuto extends Command {
|
||||
private CommandSwerveDrivetrain commandSwerveDrivetrain = TunerConstants.createDrivetrain();
|
||||
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed
|
||||
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of
|
||||
private final SwerveRequest.RobotCentric drive = new SwerveRequest.RobotCentric()
|
||||
.withDeadband(MaxSpeed * 0.1).withRotationalDeadband(MaxAngularRate * 0.1)
|
||||
.withDriveRequestType(DriveRequestType.OpenLoopVoltage);
|
||||
/** Creates a new AvancerAuto. */
|
||||
public AvancerAuto(SwerveRequest.RobotCentric drive, CommandSwerveDrivetrain commandSwerveDrivetrain) {
|
||||
// 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() {
|
||||
commandSwerveDrivetrain.applyRequest(()->
|
||||
drive.withVelocityY(0.5*MaxSpeed)
|
||||
.withVelocityX(0)
|
||||
.withRotationalRate(0));
|
||||
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
drive.withVelocityY(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -26,12 +26,11 @@ public class L2 extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(pince.encodeurpivot()>=16 && pince.encodeurpivot()<=17){
|
||||
if(pince.encodeurpivot()>=15 && pince.encodeurpivot()<=16.5){
|
||||
pince.pivote(0);
|
||||
|
||||
}
|
||||
else if(pince.encodeurpivot()>=17){
|
||||
pince.pivote(-0.1);
|
||||
else if(pince.encodeurpivot()>=15){
|
||||
pince.pivote(-0.2);
|
||||
}
|
||||
else{
|
||||
pince.pivote(0.1);
|
||||
|
@ -28,26 +28,26 @@ public class L3 extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(elevateur.position()<=elevateur.encodeurelevateurL3bas() && elevateur.position()>=elevateur.encodeurelevateurL3haut()){
|
||||
elevateur.vitesse(0);
|
||||
pince.pivote(-0.15);
|
||||
if(pince.encodeurpivot()>=20 && pince.encodeurpivot()<=21){
|
||||
pince.pivote(0);
|
||||
}
|
||||
else if(pince.encodeurpivot()>=20){
|
||||
pince.pivote(-0.15);
|
||||
}
|
||||
else{
|
||||
pince.pivote(0.15);
|
||||
}
|
||||
}
|
||||
else if(elevateur.position()>=elevateur.encodeurelevateurL3bas()){
|
||||
elevateur.vitesse(-0.7);
|
||||
if(elevateur.position()<=elevateur.encodeurelevateurL3bas() && elevateur.position()>=elevateur.encodeurelevateurL3haut()){
|
||||
elevateur.vitesse(0);
|
||||
pince.pivote(-0.15);
|
||||
if(pince.encodeurpivot()>=20 && pince.encodeurpivot()<=21){
|
||||
pince.pivote(0);
|
||||
}
|
||||
else if(pince.encodeurpivot()>=20){
|
||||
pince.pivote(-0.15);
|
||||
}
|
||||
else{
|
||||
elevateur.vitesse(0.25);
|
||||
pince.pivote(0.15);
|
||||
}
|
||||
}
|
||||
else if(elevateur.position()>=elevateur.encodeurelevateurL3bas()){
|
||||
elevateur.vitesse(-0.7);
|
||||
}
|
||||
else{
|
||||
elevateur.vitesse(0.25);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
|
@ -29,11 +29,11 @@ public class L4 extends Command {
|
||||
public void execute() {
|
||||
if(elevateur.position()<=elevateur.encodeurelevateurL4bas() && elevateur.position()>=elevateur.encodeurelevateurL4haut()){
|
||||
elevateur.vitesse(0);
|
||||
pince.pivote(-0.1);
|
||||
if(pince.encodeurpivot()>=22 && pince.encodeurpivot()<=23){
|
||||
pince.pivote(-0.15);
|
||||
if(pince.encodeurpivot()>=20 && pince.encodeurpivot()<=21){
|
||||
pince.pivote(0);
|
||||
}
|
||||
else if(pince.encodeurpivot()>=22){
|
||||
else if(pince.encodeurpivot()>=20){
|
||||
pince.pivote(-0.15);
|
||||
}
|
||||
else{
|
||||
|
@ -22,7 +22,7 @@ public class StationPince extends Command {
|
||||
this.elevateur = elevateur;
|
||||
this.pince = pince;
|
||||
this.bougie = bougie;
|
||||
addRequirements(pince,elevateur, bougie);
|
||||
addRequirements(pince, elevateur, bougie);
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
}
|
||||
|
||||
@ -35,9 +35,18 @@ public class StationPince extends Command {
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
if(pince.emperagecoral() >= 12){
|
||||
if(pince.emperagecoral() >= 18){
|
||||
pince.x = true;
|
||||
}
|
||||
if(elevateur.position()<=-0.4 && elevateur.position()>= -0.5){
|
||||
elevateur.vitesse(0);
|
||||
}
|
||||
else if(elevateur.position()>=-0.4){
|
||||
elevateur.vitesse(-0.7);
|
||||
}
|
||||
else{
|
||||
elevateur.vitesse(0.25);
|
||||
}
|
||||
if(pince.x){
|
||||
pince.aspirecoral(0);
|
||||
bougie.Bleu();
|
||||
@ -45,21 +54,23 @@ public class StationPince extends Command {
|
||||
if(pince.position()){
|
||||
pince.pivote(0);
|
||||
}
|
||||
}
|
||||
else{
|
||||
pince.aspirecoral(0.1);
|
||||
}
|
||||
else{
|
||||
pince.aspirecoral(0.25);
|
||||
|
||||
}
|
||||
if (!pince.x){
|
||||
if(pince.encodeurpivot()>=10.5 && pince.encodeurpivot()<=11.5){
|
||||
pince.pivote(-0.15);
|
||||
if(pince.encodeurpivot()>=10 && pince.encodeurpivot()<=11){
|
||||
pince.pivote(0);
|
||||
}
|
||||
else if(pince.encodeurpivot()>=11){
|
||||
pince.pivote(-0.1);
|
||||
else if(pince.encodeurpivot()>=10.5){
|
||||
pince.pivote(-0.15);
|
||||
}
|
||||
else{
|
||||
pince.pivote(0.1);
|
||||
pince.pivote(0.15);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@ -67,6 +78,7 @@ public class StationPince extends Command {
|
||||
public void end(boolean interrupted) {
|
||||
pince.pivote(0);
|
||||
pince.aspirecoral(0);
|
||||
elevateur.vitesse(0);
|
||||
pince.x =false;
|
||||
}
|
||||
|
||||
|
@ -26,13 +26,13 @@ public class CoralExpire extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
/* je crois que ce nest pas necessaire
|
||||
if(pince.emperagecoral() > 60){
|
||||
pince.aspirecoral(0);
|
||||
}
|
||||
else{
|
||||
*/
|
||||
pince.aspirecoral(-.5);
|
||||
bougie.Jaune();
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
|
@ -1,56 +0,0 @@
|
||||
// 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.grimpeur;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Bougie;
|
||||
import frc.robot.subsystems.Grimpeur;
|
||||
|
||||
/* 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 GrimperHaut extends Command {
|
||||
private Grimpeur grimpeur;
|
||||
private Bougie bougie;
|
||||
/** Creates a new Grimper. */
|
||||
public GrimperHaut(Grimpeur grimpeur, Bougie bougie) {
|
||||
this.grimpeur = grimpeur;
|
||||
this.bougie = bougie;
|
||||
addRequirements(grimpeur,bougie);
|
||||
// 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() {
|
||||
if(grimpeur.stop()==true){
|
||||
grimpeur.grimpe(0);
|
||||
grimpeur.reset();
|
||||
bougie.RainBow();
|
||||
}
|
||||
else{
|
||||
grimpeur.grimpe(0.5);
|
||||
bougie.RainBowStop();
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
grimpeur.grimpe(0);
|
||||
if(grimpeur.stop()){
|
||||
bougie.RainBow();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return grimpeur.stop()==true;
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
// 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.grimpeur;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Grimpeur;
|
||||
/* 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 GrimpeurBas extends Command {
|
||||
private Grimpeur grimpeur;
|
||||
/** Creates a new GrimpeurBas. */
|
||||
public GrimpeurBas(Grimpeur grimpeur) {
|
||||
this.grimpeur = grimpeur;
|
||||
addRequirements(grimpeur);
|
||||
// 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() {
|
||||
if(grimpeur.encodeur()>=-43.3 && grimpeur.encodeur()<=-42.5){
|
||||
grimpeur.grimpe(0);
|
||||
}
|
||||
else if(grimpeur.encodeur()>=-43.3){
|
||||
grimpeur.grimpe(-0.5);
|
||||
}
|
||||
else{grimpeur.grimpe(0.5);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
grimpeur.grimpe(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
// 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.grimpeur;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Bougie;
|
||||
import frc.robot.subsystems.Grimpeur;
|
||||
|
||||
/* 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 GrimpeurManuelhaut extends Command {
|
||||
private Grimpeur grimpeur;
|
||||
|
||||
private Bougie bougie;
|
||||
/** Creates a new GrimpeurManuel. */
|
||||
public GrimpeurManuelhaut(Grimpeur grimpeur,Bougie bougie) {
|
||||
this.grimpeur = grimpeur;
|
||||
|
||||
this.bougie = bougie;
|
||||
addRequirements(grimpeur, bougie);
|
||||
// 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() {
|
||||
if(grimpeur.stop()){
|
||||
bougie.RainBow();
|
||||
grimpeur.grimpe(-0.5);
|
||||
}
|
||||
|
||||
else{
|
||||
bougie.RainBowStop();
|
||||
grimpeur.grimpe(-0.5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
grimpeur.grimpe(0);
|
||||
if(grimpeur.stop()){
|
||||
bougie.RainBow();
|
||||
}
|
||||
else{bougie.RainBowStop();}
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
// 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.grimpeur;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Grimpeur;
|
||||
|
||||
/* 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 ResetGrimpeur extends Command {
|
||||
private Grimpeur grimpeur;
|
||||
/** Creates a new ResetGrimpeur. */
|
||||
public ResetGrimpeur(Grimpeur grimpeur) {
|
||||
this.grimpeur = grimpeur;
|
||||
addRequirements(grimpeur);
|
||||
// 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() {
|
||||
grimpeur.reset();
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
@ -27,25 +27,28 @@ public class BalayeuseAlgue extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(requin.encodeur()<=715 && requin.encodeur()>=670)
|
||||
{
|
||||
requin.rotationer(0);
|
||||
if(requin.amp()> 60){
|
||||
requin.balaye(0);
|
||||
bougie.Vert();
|
||||
}
|
||||
else
|
||||
{
|
||||
requin.balaye(-0.5);
|
||||
double cibleMin = 550;
|
||||
double cibleMax = 650;
|
||||
|
||||
if(requin.amp()>=78.2){
|
||||
requin.xRequin = true;
|
||||
}
|
||||
if(requin.xRequin){
|
||||
bougie.Vert();
|
||||
requin.balaye(0);
|
||||
}
|
||||
if(!requin.xRequin){
|
||||
if(requin.encodeur()<=cibleMax && requin.encodeur()>=cibleMin){
|
||||
requin.rotationer(0);
|
||||
requin.balaye(-0.4);
|
||||
}
|
||||
else if(requin.encodeur()>=cibleMax){
|
||||
requin.rotationer(-0.1);
|
||||
}
|
||||
else{
|
||||
requin.rotationer(0.3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(requin.encodeur()>=700){
|
||||
requin.rotationer(-0.5);
|
||||
}
|
||||
else{
|
||||
requin.rotationer(0.5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@ -53,6 +56,7 @@ public class BalayeuseAlgue extends Command {
|
||||
public void end(boolean interrupted) {
|
||||
requin.rotationer(0);
|
||||
requin.balaye(0);
|
||||
requin.xRequin = false;
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
|
@ -27,27 +27,27 @@ public class BalayeuseCoral extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(requin.encodeur()<=1200 && requin.encodeur()>=1025){
|
||||
requin.rotationer(0);
|
||||
if(requin.amp()>=12){
|
||||
double cibleMax = 1100;
|
||||
double cibleMin = 900;
|
||||
if(requin.amp()>=78.2){
|
||||
requin.xRequin = true;
|
||||
}
|
||||
if(requin.xRequin){
|
||||
requin.balaye(0);
|
||||
bougie.Vert();
|
||||
}
|
||||
if (!requin.xRequin) {
|
||||
if(requin.encodeur()<=cibleMax && requin.encodeur()>=cibleMin){
|
||||
requin.rotationer(0);
|
||||
requin.balaye(0.7);
|
||||
}
|
||||
else if(requin.encodeur()>=cibleMax){
|
||||
requin.rotationer(-0.5);
|
||||
}
|
||||
else{
|
||||
requin.balaye(0.5);
|
||||
requin.rotationer(0.5);
|
||||
}
|
||||
}
|
||||
if (!requin.xRequin) {
|
||||
if(requin.encodeur()>=1200){
|
||||
requin.rotationer(-0.5);
|
||||
}
|
||||
else{
|
||||
requin.rotationer(0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@ -55,6 +55,7 @@ public class BalayeuseCoral extends Command {
|
||||
public void end(boolean interrupted) {
|
||||
requin.rotationer(0);
|
||||
requin.balaye(0);
|
||||
requin.xRequin = false;
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
|
@ -28,14 +28,14 @@ public class ExpireCorail extends Command {
|
||||
@Override
|
||||
public void execute() {
|
||||
if(requin.amp()> 60){
|
||||
requin.balaye(-0.5);
|
||||
requin.balaye(-0.1);
|
||||
}
|
||||
else
|
||||
{
|
||||
bougie.Rouge();
|
||||
requin.balaye(-0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
bougie.Rouge();
|
||||
requin.balaye(-0.1);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
|
@ -27,11 +27,10 @@ public class L1Requin extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
if(requin.encodeur()<=645 && requin.encodeur()>=600){
|
||||
if(requin.encodeur()<=485 && requin.encodeur()>=385){
|
||||
requin.rotationer(0);
|
||||
}
|
||||
else if(requin.encodeur()>=645){
|
||||
else if(requin.encodeur()>=485){
|
||||
requin.rotationer(-0.5);
|
||||
}
|
||||
else{
|
||||
|
@ -31,11 +31,11 @@ public class exspire extends Command {
|
||||
public void execute() {
|
||||
if(requin.amp()> 15)
|
||||
{
|
||||
requin.balaye(0.5);
|
||||
requin.balaye(0.2);
|
||||
}
|
||||
else{
|
||||
bougie.Rouge();
|
||||
requin.balaye(0.5);
|
||||
requin.balaye(0.2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,19 +7,20 @@ package frc.robot.commands;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystems.Elevateur;
|
||||
import frc.robot.subsystems.Pince;
|
||||
|
||||
|
||||
import frc.robot.subsystems.Requin;
|
||||
|
||||
/* 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 reset extends Command {
|
||||
/** Creates a new reset. */
|
||||
private Elevateur elevateur;
|
||||
private Pince pince;
|
||||
public reset(Elevateur elevateur, Pince pince) {
|
||||
private Requin requin;
|
||||
public reset(Elevateur elevateur, Pince pince, Requin requin) {
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
this.elevateur = elevateur;
|
||||
this.pince = pince;
|
||||
addRequirements(elevateur,pince);
|
||||
this.requin = requin;
|
||||
addRequirements(elevateur,pince, requin);
|
||||
}
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@ -31,6 +32,7 @@ public class reset extends Command {
|
||||
public void execute() {
|
||||
elevateur.reset();
|
||||
pince.reset();
|
||||
requin.reset();
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
|
@ -6,14 +6,22 @@ package frc.robot.subsystems;
|
||||
|
||||
import com.ctre.phoenix.led.CANdle;
|
||||
import com.ctre.phoenix.led.CANdleConfiguration;
|
||||
import com.ctre.phoenix.led.FireAnimation;
|
||||
import com.ctre.phoenix.led.LarsonAnimation;
|
||||
import com.ctre.phoenix.led.RainbowAnimation;
|
||||
import com.ctre.phoenix.led.TwinkleAnimation;
|
||||
import com.ctre.phoenix.led.TwinkleOffAnimation;
|
||||
import com.ctre.phoenix.led.TwinkleOffAnimation.TwinkleOffPercent;
|
||||
import com.ctre.phoenix.led.LarsonAnimation.BounceMode;
|
||||
import com.ctre.phoenix.led.TwinkleAnimation.TwinklePercent;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class Bougie extends SubsystemBase {
|
||||
CANdle candle = new CANdle(23);
|
||||
CANdleConfiguration config = new CANdleConfiguration();
|
||||
RainbowAnimation rainbowAnim = new RainbowAnimation(1, 0.5, 64);
|
||||
LarsonAnimation rainbowAnim = new LarsonAnimation(256,0,0,0,0.1,68,BounceMode.Front,10,8);
|
||||
//TwinkleOffAnimation rainbowAnim = new TwinkleOffAnimation(256, 0, 0,0,0.5,68,TwinkleOffPercent.Percent88,8);
|
||||
/** Creates a new Bougie. */
|
||||
public Bougie() {
|
||||
config.brightnessScalar = 0.5;
|
||||
|
@ -41,38 +41,46 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
|
||||
private final SwerveRequest.ApplyRobotSpeeds m_pathApplyRobotSpeeds = new SwerveRequest.ApplyRobotSpeeds();
|
||||
|
||||
/* SysId routine for characterizing translation. This is used to find PID gains for the drive motors. */
|
||||
private final SwerveRequest.SysIdSwerveTranslation m_translationCharacterization = new SwerveRequest.SysIdSwerveTranslation();
|
||||
private final SwerveRequest.SysIdSwerveSteerGains m_steerCharacterization = new SwerveRequest.SysIdSwerveSteerGains();
|
||||
private final SwerveRequest.SysIdSwerveRotation m_rotationCharacterization = new SwerveRequest.SysIdSwerveRotation();
|
||||
|
||||
private void configureAutoBuilder() {
|
||||
try {
|
||||
var config = RobotConfig.fromGUISettings();
|
||||
AutoBuilder.configure(
|
||||
() -> getState().Pose, // Supplier of current robot pose
|
||||
this::resetPose, // Consumer for seeding pose against auto
|
||||
() -> getState().Speeds, // Supplier of current robot speeds
|
||||
// Consumer of ChassisSpeeds and feedforwards to drive the robot
|
||||
(speeds, feedforwards) -> setControl(
|
||||
m_pathApplyRobotSpeeds.withSpeeds(speeds)
|
||||
.withWheelForceFeedforwardsX(feedforwards.robotRelativeForcesXNewtons())
|
||||
.withWheelForceFeedforwardsY(feedforwards.robotRelativeForcesYNewtons())
|
||||
),
|
||||
new PPHolonomicDriveController(
|
||||
// PID constants for translation
|
||||
new PIDConstants(63.167, 0, 0.54521),
|
||||
// PID constants for rotation
|
||||
new PIDConstants(7.9735, 0, 0.038499)
|
||||
),
|
||||
config,
|
||||
// Assume the path needs to be flipped for Red vs Blue, this is normally the case
|
||||
() -> DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Red,
|
||||
this // Subsystem for requirements
|
||||
);
|
||||
} catch (Exception ex) {
|
||||
DriverStation.reportError("Failed to load PathPlanner config and configure AutoBuilder", ex.getStackTrace());
|
||||
}
|
||||
PPHolonomicDriveController.overrideRotationFeedback(()->{
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
// private void configureAutoBuilder() {
|
||||
// try {
|
||||
// var config = RobotConfig.fromGUISettings();
|
||||
// AutoBuilder.configure(
|
||||
|
||||
// () -> getState().Pose, // Supplier of current robot pose
|
||||
// this::resetPose, // Consumer for seeding pose against auto
|
||||
// () -> getState().Speeds, // Supplier of current robot speeds
|
||||
|
||||
// // Consumer of ChassisSpeeds and feedforwards to drive the robot
|
||||
// (speeds, feedforwards) -> setControl(
|
||||
// m_pathApplyRobotSpeeds.withSpeeds(speeds)
|
||||
// .withWheelForceFeedforwardsY(feedforwards.robotRelativeForcesXNewtons())
|
||||
// .withWheelForceFeedforwardsX(feedforwards.robotRelativeForcesYNewtons())
|
||||
// ),
|
||||
// new PPHolonomicDriveController(
|
||||
// // PID constants for translation
|
||||
// new PIDConstants(63.167, 0, 0.54521),
|
||||
// // // PID constants for rotation
|
||||
// // new PIDConstants(7.9735, 0, 0.038499)
|
||||
// // PID constants for rotation
|
||||
// new PIDConstants(43.502,0,2.7353)
|
||||
// ),
|
||||
// config,
|
||||
// // Assume the path needs to be flipped for Red vs Blue, this is normally the case
|
||||
// () -> DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Red,
|
||||
// this // Subsystem for requirements
|
||||
|
||||
// );
|
||||
// } catch (Exception ex) {
|
||||
// DriverStation.reportError("Failed to load PathPlanner config and configure AutoBuilder", ex.getStackTrace());
|
||||
// }
|
||||
// PPHolonomicDriveController.overrideRotationFeedback(()->{
|
||||
// return 0;
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* Constructs a CTRE SwerveDrivetrain using the specified constants.
|
||||
@ -92,7 +100,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
|
||||
if (Utils.isSimulation()) {
|
||||
startSimThread();
|
||||
}
|
||||
configureAutoBuilder();
|
||||
//configureAutoBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,7 +125,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
|
||||
if (Utils.isSimulation()) {
|
||||
startSimThread();
|
||||
}
|
||||
configureAutoBuilder();
|
||||
// configureAutoBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,7 +158,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
|
||||
if (Utils.isSimulation()) {
|
||||
startSimThread();
|
||||
}
|
||||
configureAutoBuilder();
|
||||
//configureAutoBuilder();
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,6 +29,8 @@ public class Elevateur extends SubsystemBase {
|
||||
teb.add("encodeurelevateursationbas", -0.5).getEntry();
|
||||
private GenericEntry encodeurelevateurstationhaut =
|
||||
teb.add("encodeurelevateursationhaut", -0.4).getEntry();
|
||||
private GenericEntry distanceDeploiePince =
|
||||
teb.add("encodeurDeploiePince", 0.2).getEntry();
|
||||
|
||||
public Elevateur() {
|
||||
teb.addDouble("encodeur elevateur",this::position);
|
||||
@ -84,6 +86,10 @@ public class Elevateur extends SubsystemBase {
|
||||
public double encodeurelevateurstationhaut(){
|
||||
return encodeurelevateurstationhaut.getDouble(-0.4);
|
||||
}
|
||||
public double distanceDeploiePince(){
|
||||
return distanceDeploiePince.getDouble(0.2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
|
@ -1,40 +0,0 @@
|
||||
// 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.subsystems;
|
||||
|
||||
import com.revrobotics.spark.SparkMax;
|
||||
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class Grimpeur extends SubsystemBase {
|
||||
/** Creates a new Grimpeur. */
|
||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||
public Grimpeur() {
|
||||
teb.addBoolean("limit grimpeur", this::stop);
|
||||
teb.addDouble("encodeur grimpeur", this::encodeur);
|
||||
}
|
||||
final SparkMax grimpeur = new SparkMax(21,MotorType.kBrushless);
|
||||
final DigitalInput limit1 = new DigitalInput(2);
|
||||
public void grimpe(double vitesse){
|
||||
grimpeur.set(vitesse);
|
||||
}
|
||||
public boolean stop(){
|
||||
return limit1.get();
|
||||
}
|
||||
public double encodeur(){
|
||||
return grimpeur.getEncoder().getPosition();
|
||||
}
|
||||
public void reset(){
|
||||
grimpeur.getEncoder().setPosition(135.11);
|
||||
}
|
||||
@Override
|
||||
public void periodic() {
|
||||
// This method will be called once per scheduler run
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user