This commit is contained in:
Olivier Dubois 2023-11-01 19:01:13 -04:00
commit 6fab163a72
11 changed files with 63 additions and 20 deletions

View File

@ -88,5 +88,10 @@
"buttonCount": 0, "buttonCount": 0,
"povCount": 0 "povCount": 0
} }
],
"robotJoysticks": [
{
"guid": "030000006d04000015c2000000000000"
}
] ]
} }

View File

@ -1,7 +1,16 @@
{ {
"NTProvider": { "NTProvider": {
"types": { "types": {
"/FMSInfo": "FMSInfo" "/FMSInfo": "FMSInfo",
"/SmartDashboard/Field": "Field2d",
"/SmartDashboard/navX-Sensor[1]": "Gyro"
},
"windows": {
"/SmartDashboard/Field": {
"window": {
"visible": true
}
}
} }
} }
} }

View File

@ -6,17 +6,17 @@
"absoluteEncoderOffset": 0, "absoluteEncoderOffset": 0,
"drive": { "drive": {
"type": "sparkmax", "type": "sparkmax",
"id": 0, "id": 8,
"canbus": null "canbus": null
}, },
"angle": { "angle": {
"type": "sparkmax", "type": "sparkmax",
"id": 0, "id": 9,
"canbus": null "canbus": null
}, },
"encoder": { "encoder": {
"type": "cancoder", "type": "cancoder",
"id": 0, "id": 22,
"canbus": null "canbus": null
}, },
"inverted": { "inverted": {

View File

@ -6,17 +6,17 @@
"absoluteEncoderOffset": 0, "absoluteEncoderOffset": 0,
"drive": { "drive": {
"type": "sparkmax", "type": "sparkmax",
"id": 0, "id": 11,
"canbus": null "canbus": null
}, },
"angle": { "angle": {
"type": "sparkmax", "type": "sparkmax",
"id": 0, "id": 12,
"canbus": null "canbus": null
}, },
"encoder": { "encoder": {
"type": "cancoder", "type": "cancoder",
"id": 0, "id": 22,
"canbus": null "canbus": null
}, },
"inverted": { "inverted": {

View File

@ -11,12 +11,12 @@
}, },
"angle": { "angle": {
"type": "sparkmax", "type": "sparkmax",
"id": 0, "id": 1,
"canbus": null "canbus": null
}, },
"encoder": { "encoder": {
"type": "cancoder", "type": "cancoder",
"id": 0, "id": 22,
"canbus": null "canbus": null
}, },
"inverted": { "inverted": {

View File

@ -6,17 +6,17 @@
"absoluteEncoderOffset": 0, "absoluteEncoderOffset": 0,
"drive": { "drive": {
"type": "sparkmax", "type": "sparkmax",
"id": 0, "id": 17,
"canbus": null "canbus": null
}, },
"angle": { "angle": {
"type": "sparkmax", "type": "sparkmax",
"id": 0, "id": 18,
"canbus": null "canbus": null
}, },
"encoder": { "encoder": {
"type": "cancoder", "type": "cancoder",
"id": 0, "id": 22,
"canbus": null "canbus": null
}, },
"inverted": { "inverted": {

View File

@ -3,26 +3,32 @@
// the WPILib BSD license file in the root directory of this project. // the WPILib BSD license file in the root directory of this project.
package frc.robot; package frc.robot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.XboxController; import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import frc.robot.subsystems.Drive; import frc.robot.subsystems.Drive;
public class RobotContainer { public class RobotContainer {
CommandXboxController manette1 = new CommandXboxController(0); CommandXboxController manette = new CommandXboxController(0);
CommandXboxController manette2 = new CommandXboxController(0); Joystick joystick1 = new Joystick(0);
Drive drive = new Drive(); Drive drive = new Drive();
public RobotContainer() { public RobotContainer() {
configureBindings(); configureBindings();
// drive.setDefaultCommand(new RunCommand(()->{
// drive.drive(manette.getLeftX(), manette.getLeftY(), manette.getRightX());
//},drive));
drive.setDefaultCommand(new RunCommand(()->{ drive.setDefaultCommand(new RunCommand(()->{
drive.drive(manette1.getLeftX(), manette1.getLeftY(), manette1.getRightX()); drive.drive(joystick1.getX(), -joystick1.getY(), -joystick1.getZ());
},drive)); },drive));
} }
private void configureBindings() {} private void configureBindings() {
JoystickButton button =new JoystickButton(joystick1, 1);
}
public Command getAutonomousCommand() { public Command getAutonomousCommand() {
return Commands.print("No autonomous command configured"); return Commands.print("No autonomous command configured");

View File

@ -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));
}
}

View File

@ -39,6 +39,6 @@ public class Lancer extends CommandBase {
// Returns true when the command should end. // Returns true when the command should end.
@Override @Override
public boolean isFinished() { public boolean isFinished() {
return false; return lanceur.distance()>1;
} }
} }

View File

@ -18,7 +18,7 @@ public class Drive extends SubsystemBase {
File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve"); File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve");
public void drive(double x, double y, double zRotation){ 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);
} }

View File

@ -20,7 +20,7 @@ public class Lanceur extends SubsystemBase {
} }
// encodeur // encodeur
public double vitesse() { public double distance() {
return(lanceur.getEncoder().getPosition()); return(lanceur.getEncoder().getPosition());
} }