diff --git a/simgui-ds.json b/simgui-ds.json index 73cc713..46c45d8 100644 --- a/simgui-ds.json +++ b/simgui-ds.json @@ -88,5 +88,10 @@ "buttonCount": 0, "povCount": 0 } + ], + "robotJoysticks": [ + { + "guid": "030000006d04000015c2000000000000" + } ] } diff --git a/simgui.json b/simgui.json index 449f4b1..be49c52 100644 --- a/simgui.json +++ b/simgui.json @@ -1,7 +1,16 @@ { "NTProvider": { "types": { - "/FMSInfo": "FMSInfo" + "/FMSInfo": "FMSInfo", + "/SmartDashboard/Field": "Field2d", + "/SmartDashboard/navX-Sensor[1]": "Gyro" + }, + "windows": { + "/SmartDashboard/Field": { + "window": { + "visible": true + } + } } } } diff --git a/src/main/deploy/swerve/modules/backleft.json b/src/main/deploy/swerve/modules/backleft.json index 3ae3fdd..9eecec3 100644 --- a/src/main/deploy/swerve/modules/backleft.json +++ b/src/main/deploy/swerve/modules/backleft.json @@ -6,17 +6,17 @@ "absoluteEncoderOffset": 0, "drive": { "type": "sparkmax", - "id": 0, + "id": 8, "canbus": null }, "angle": { "type": "sparkmax", - "id": 0, + "id": 9, "canbus": null }, "encoder": { "type": "cancoder", - "id": 0, + "id": 22, "canbus": null }, "inverted": { diff --git a/src/main/deploy/swerve/modules/backright.json b/src/main/deploy/swerve/modules/backright.json index c896a6e..4d87807 100644 --- a/src/main/deploy/swerve/modules/backright.json +++ b/src/main/deploy/swerve/modules/backright.json @@ -6,17 +6,17 @@ "absoluteEncoderOffset": 0, "drive": { "type": "sparkmax", - "id": 0, + "id": 11, "canbus": null }, "angle": { "type": "sparkmax", - "id": 0, + "id": 12, "canbus": null }, "encoder": { "type": "cancoder", - "id": 0, + "id": 22, "canbus": null }, "inverted": { diff --git a/src/main/deploy/swerve/modules/frontleft.json b/src/main/deploy/swerve/modules/frontleft.json index 018c523..e0168dc 100644 --- a/src/main/deploy/swerve/modules/frontleft.json +++ b/src/main/deploy/swerve/modules/frontleft.json @@ -11,12 +11,12 @@ }, "angle": { "type": "sparkmax", - "id": 0, + "id": 1, "canbus": null }, "encoder": { "type": "cancoder", - "id": 0, + "id": 22, "canbus": null }, "inverted": { diff --git a/src/main/deploy/swerve/modules/frontright.json b/src/main/deploy/swerve/modules/frontright.json index d3ccba2..b0dd13b 100644 --- a/src/main/deploy/swerve/modules/frontright.json +++ b/src/main/deploy/swerve/modules/frontright.json @@ -6,17 +6,17 @@ "absoluteEncoderOffset": 0, "drive": { "type": "sparkmax", - "id": 0, + "id": 17, "canbus": null }, "angle": { "type": "sparkmax", - "id": 0, + "id": 18, "canbus": null }, "encoder": { "type": "cancoder", - "id": 0, + "id": 22, "canbus": null }, "inverted": { diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index e34918e..ed090c1 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -3,26 +3,32 @@ // the WPILib BSD license file in the root directory of this project. package frc.robot; - +import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.XboxController; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; +import edu.wpi.first.wpilibj2.command.button.JoystickButton; import frc.robot.subsystems.Drive; public class RobotContainer { - CommandXboxController manette1 = new CommandXboxController(0); - CommandXboxController manette2 = new CommandXboxController(0); + CommandXboxController manette = new CommandXboxController(0); + Joystick joystick1 = new Joystick(0); Drive drive = new Drive(); public RobotContainer() { configureBindings(); + // drive.setDefaultCommand(new RunCommand(()->{ + // drive.drive(manette.getLeftX(), manette.getLeftY(), manette.getRightX()); + //},drive)); drive.setDefaultCommand(new RunCommand(()->{ - drive.drive(manette1.getLeftX(), manette1.getLeftY(), manette1.getRightX()); + drive.drive(joystick1.getX(), -joystick1.getY(), -joystick1.getZ()); },drive)); } - private void configureBindings() {} + private void configureBindings() { + JoystickButton button =new JoystickButton(joystick1, 1); + } public Command getAutonomousCommand() { return Commands.print("No autonomous command configured"); diff --git a/src/main/java/frc/robot/commands/Accumuler.java b/src/main/java/frc/robot/commands/Accumuler.java new file mode 100644 index 0000000..89a90e7 --- /dev/null +++ b/src/main/java/frc/robot/commands/Accumuler.java @@ -0,0 +1,23 @@ +// 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.SequentialCommandGroup; +import frc.robot.subsystems.Accumulateur; +import frc.robot.subsystems.Lanceur; + + +// NOTE: Consider using this command inline, rather than writing a subclass. For more +// information, see: +// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html +public class Accumuler extends SequentialCommandGroup { + + public void Accumuler(Accumulateur accumulateur) { + // Add your commands in the addCommands() call, e.g. + // addCommands(new FooCommand(), new BarCommand()); + addCommands(new Deaccumuler(accumulateur), new Reaccumuler(accumulateur)); + + } +} \ No newline at end of file diff --git a/src/main/java/frc/robot/commands/Lancer.java b/src/main/java/frc/robot/commands/Lancer.java index 784b73d..efecd99 100644 --- a/src/main/java/frc/robot/commands/Lancer.java +++ b/src/main/java/frc/robot/commands/Lancer.java @@ -39,6 +39,6 @@ public class Lancer extends CommandBase { // Returns true when the command should end. @Override public boolean isFinished() { - return false; + return lanceur.distance()>1; } } diff --git a/src/main/java/frc/robot/subsystems/Drive.java b/src/main/java/frc/robot/subsystems/Drive.java index 7337a17..637b22c 100644 --- a/src/main/java/frc/robot/subsystems/Drive.java +++ b/src/main/java/frc/robot/subsystems/Drive.java @@ -18,7 +18,7 @@ public class Drive extends SubsystemBase { File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve"); public void drive(double x, double y, double zRotation){ - swerveDrive.drive(new Translation2d(x, y), zRotation, true, true); + swerveDrive.drive(new Translation2d(x, y), zRotation, true, false); } diff --git a/src/main/java/frc/robot/subsystems/Lanceur.java b/src/main/java/frc/robot/subsystems/Lanceur.java index c611a4b..4c1bbfa 100644 --- a/src/main/java/frc/robot/subsystems/Lanceur.java +++ b/src/main/java/frc/robot/subsystems/Lanceur.java @@ -20,7 +20,7 @@ public class Lanceur extends SubsystemBase { } // encodeur - public double vitesse() { + public double distance() { return(lanceur.getEncoder().getPosition()); }