Merge branch 'master' of https://git.demerso.net/pls5618/2024/betabot-2024
This commit is contained in:
commit
bfe69cdb13
@ -45,7 +45,8 @@ public class RobotContainer {
|
|||||||
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
|
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
|
||||||
ShuffleboardLayout forces = Shuffleboard.getTab("Dashboard")
|
ShuffleboardLayout forces = Shuffleboard.getTab("Dashboard")
|
||||||
.getLayout("forces", BuiltInLayouts.kList)
|
.getLayout("forces", BuiltInLayouts.kList)
|
||||||
.withSize(3, 7);
|
.withSize(1, 7)
|
||||||
|
.withPosition(1, 0);
|
||||||
|
|
||||||
GenericEntry force1 = forces.add("Force1", 2).getEntry();
|
GenericEntry force1 = forces.add("Force1", 2).getEntry();
|
||||||
GenericEntry force2 = forces.add("Force2", 4).getEntry();
|
GenericEntry force2 = forces.add("Force2", 4).getEntry();
|
||||||
@ -58,7 +59,7 @@ public class RobotContainer {
|
|||||||
CommandXboxController manette = new CommandXboxController(0);
|
CommandXboxController manette = new CommandXboxController(0);
|
||||||
CommandJoystick joystick1 = new CommandJoystick(0);
|
CommandJoystick joystick1 = new CommandJoystick(0);
|
||||||
public RobotContainer() {
|
public RobotContainer() {
|
||||||
|
CameraServer.startAutomaticCapture();
|
||||||
configureBindings();
|
configureBindings();
|
||||||
drive.setDefaultCommand(new RunCommand(()->{
|
drive.setDefaultCommand(new RunCommand(()->{
|
||||||
drive.drive(-joystick1.getY(), -joystick1.getX(), MathUtil.applyDeadband(-joystick1.getZ(), 0.2));
|
drive.drive(-joystick1.getY(), -joystick1.getX(), MathUtil.applyDeadband(-joystick1.getZ(), 0.2));
|
||||||
|
@ -16,7 +16,8 @@ public class Avancer extends CommandBase {
|
|||||||
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
|
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
|
||||||
ShuffleboardLayout avancer = Shuffleboard.getTab("Dashboard")
|
ShuffleboardLayout avancer = Shuffleboard.getTab("Dashboard")
|
||||||
.getLayout("Avancer", BuiltInLayouts.kList)
|
.getLayout("Avancer", BuiltInLayouts.kList)
|
||||||
.withSize(3, 3);
|
.withSize(1, 4)
|
||||||
|
.withPosition(4, 0);
|
||||||
/** Creates a new Avancer. */
|
/** Creates a new Avancer. */
|
||||||
public Avancer(Drive drive) {
|
public Avancer(Drive drive) {
|
||||||
//avancer.add("vitesse x", 1);
|
//avancer.add("vitesse x", 1);
|
||||||
|
@ -16,7 +16,8 @@ public class Reculer extends CommandBase {
|
|||||||
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
|
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
|
||||||
ShuffleboardLayout reculer = Shuffleboard.getTab("Dashboard")
|
ShuffleboardLayout reculer = Shuffleboard.getTab("Dashboard")
|
||||||
.getLayout("Reculer", BuiltInLayouts.kList)
|
.getLayout("Reculer", BuiltInLayouts.kList)
|
||||||
.withSize(3, 3);
|
.withSize(1, 4)
|
||||||
|
.withPosition(6,0);
|
||||||
/** Creates a new Reculer. */
|
/** Creates a new Reculer. */
|
||||||
public Reculer(Drive drive) {
|
public Reculer(Drive drive) {
|
||||||
reculer.add("vitesse x", 1);
|
reculer.add("vitesse x", 1);
|
||||||
|
@ -7,6 +7,13 @@ package frc.robot.subsystems;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
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.CANSparkMax;
|
||||||
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
||||||
|
|
||||||
@ -23,6 +30,14 @@ import swervelib.parser.SwerveParser;
|
|||||||
|
|
||||||
public class Drive extends SubsystemBase {
|
public class Drive extends SubsystemBase {
|
||||||
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
|
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;
|
SwerveDrive swerveDrive;
|
||||||
File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve");
|
File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve");
|
||||||
/* final CanAndCoderSwerve avantdroitdrive = new CanAndCoderSwerve(Constants.avantdroitDrive);
|
/* 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);
|
swerveDrive.drive(new Translation2d(x, y), zRotation, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Creates a new Drive. */
|
/** Creates a new Drive. */
|
||||||
public 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 {
|
try {
|
||||||
this.swerveDrive = new SwerveParser(swerveJsonDirectory).createSwerveDrive();
|
this.swerveDrive = new SwerveParser(swerveJsonDirectory).createSwerveDrive();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public SwerveModulePosition[] distance(){
|
|
||||||
|
public SwerveModulePosition[] distance(){
|
||||||
return swerveDrive.getModulePositions();
|
return swerveDrive.getModulePositions();
|
||||||
}
|
}
|
||||||
public void reset(){
|
public void reset(){
|
||||||
|
@ -7,6 +7,7 @@ package frc.robot.subsystems;
|
|||||||
import com.revrobotics.CANSparkMax;
|
import com.revrobotics.CANSparkMax;
|
||||||
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
||||||
|
|
||||||
|
import edu.wpi.first.networktables.GenericEntry;
|
||||||
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
|
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
|
||||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
|
||||||
@ -18,14 +19,16 @@ public class Lanceur extends SubsystemBase {
|
|||||||
ShuffleboardTab dash2 = Shuffleboard.getTab("Dashboard2.0");
|
ShuffleboardTab dash2 = Shuffleboard.getTab("Dashboard2.0");
|
||||||
|
|
||||||
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
|
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
|
||||||
//ShuffleboardLayout pid = Shuffleboard.getTab("Dashboard")
|
ShuffleboardLayout pid = Shuffleboard.getTab("Dashboard")
|
||||||
//.getLayout("Pid", BuiltInLayouts.kList)
|
.getLayout("Pid", BuiltInLayouts.kList)
|
||||||
//.withSize(3, 7);
|
.withSize(1, 3)
|
||||||
|
.withPosition(0, 0);
|
||||||
|
private GenericEntry p = pid.add("p", 1).getEntry();
|
||||||
|
|
||||||
public Lanceur(){
|
public Lanceur(){
|
||||||
dash2.add("test", 1);
|
double P = p.getDouble(1.0);
|
||||||
dashboard.add("p", 1);
|
pid.add("i", 2).getEntry();
|
||||||
dashboard.add("i", 2);
|
pid.add("d", 3).getEntry();
|
||||||
dashboard.add("d", 3);
|
|
||||||
}
|
}
|
||||||
final CANSparkMax lanceur = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);
|
final CANSparkMax lanceur = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user