This commit is contained in:
samuel desharnais 2023-12-05 19:26:37 -05:00
commit bfe69cdb13
5 changed files with 43 additions and 13 deletions

View File

@ -45,7 +45,8 @@ public class RobotContainer {
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
ShuffleboardLayout forces = Shuffleboard.getTab("Dashboard")
.getLayout("forces", BuiltInLayouts.kList)
.withSize(3, 7);
.withSize(1, 7)
.withPosition(1, 0);
GenericEntry force1 = forces.add("Force1", 2).getEntry();
GenericEntry force2 = forces.add("Force2", 4).getEntry();
@ -58,7 +59,7 @@ public class RobotContainer {
CommandXboxController manette = new CommandXboxController(0);
CommandJoystick joystick1 = new CommandJoystick(0);
public RobotContainer() {
CameraServer.startAutomaticCapture();
configureBindings();
drive.setDefaultCommand(new RunCommand(()->{
drive.drive(-joystick1.getY(), -joystick1.getX(), MathUtil.applyDeadband(-joystick1.getZ(), 0.2));

View File

@ -16,7 +16,8 @@ public class Avancer extends CommandBase {
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
ShuffleboardLayout avancer = Shuffleboard.getTab("Dashboard")
.getLayout("Avancer", BuiltInLayouts.kList)
.withSize(3, 3);
.withSize(1, 4)
.withPosition(4, 0);
/** Creates a new Avancer. */
public Avancer(Drive drive) {
//avancer.add("vitesse x", 1);

View File

@ -16,7 +16,8 @@ public class Reculer extends CommandBase {
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
ShuffleboardLayout reculer = Shuffleboard.getTab("Dashboard")
.getLayout("Reculer", BuiltInLayouts.kList)
.withSize(3, 3);
.withSize(1, 4)
.withPosition(6,0);
/** Creates a new Reculer. */
public Reculer(Drive drive) {
reculer.add("vitesse x", 1);

View File

@ -7,6 +7,13 @@ package frc.robot.subsystems;
import java.io.File;
import java.io.IOException;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.kinematics.SwerveModulePosition;
import edu.wpi.first.wpilibj.Filesystem;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
@ -23,6 +30,14 @@ import swervelib.parser.SwerveParser;
public class Drive extends SubsystemBase {
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
ShuffleboardLayout avancer = Shuffleboard.getTab("Dashboard")
.getLayout("Avancer", BuiltInLayouts.kList)
.withSize(1, 4)
.withPosition(4, 0);
ShuffleboardLayout reculer = Shuffleboard.getTab("Dashboard")
.getLayout("Reculer", BuiltInLayouts.kList)
.withSize(1, 4)
.withPosition(3,0);
SwerveDrive swerveDrive;
File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve");
/* final CanAndCoderSwerve avantdroitdrive = new CanAndCoderSwerve(Constants.avantdroitDrive);
@ -37,17 +52,26 @@ public class Drive extends SubsystemBase {
swerveDrive.drive(new Translation2d(x, y), zRotation, false, false);
}
/** Creates a new Drive. */
public Drive() {
reculer.add("vitesse x", 1);
reculer.add("vitesse y", 2);
reculer.add("vitesse z", 3);
reculer.add("distance", 4);
avancer.add("vitesse x", 1);
avancer.add("vitesse y", 2);
avancer.add("vitesse z", 3);
avancer.add("distance", 4);
try {
this.swerveDrive = new SwerveParser(swerveJsonDirectory).createSwerveDrive();
} catch (IOException e) {
e.printStackTrace();
}
}
public SwerveModulePosition[] distance(){
public SwerveModulePosition[] distance(){
return swerveDrive.getModulePositions();
}
public void reset(){

View File

@ -7,6 +7,7 @@ package frc.robot.subsystems;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
@ -18,14 +19,16 @@ public class Lanceur extends SubsystemBase {
ShuffleboardTab dash2 = Shuffleboard.getTab("Dashboard2.0");
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
//ShuffleboardLayout pid = Shuffleboard.getTab("Dashboard")
//.getLayout("Pid", BuiltInLayouts.kList)
//.withSize(3, 7);
ShuffleboardLayout pid = Shuffleboard.getTab("Dashboard")
.getLayout("Pid", BuiltInLayouts.kList)
.withSize(1, 3)
.withPosition(0, 0);
private GenericEntry p = pid.add("p", 1).getEntry();
public Lanceur(){
dash2.add("test", 1);
dashboard.add("p", 1);
dashboard.add("i", 2);
dashboard.add("d", 3);
double P = p.getDouble(1.0);
pid.add("i", 2).getEntry();
pid.add("d", 3).getEntry();
}
final CANSparkMax lanceur = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);