Compare commits
2 Commits
c6017d60b4
...
1facdb07e5
Author | SHA1 | Date | |
---|---|---|---|
1facdb07e5 | |||
ab36e8dadf |
@ -22,7 +22,7 @@ public class Desaccumuler extends Command {
|
|||||||
// Called every time the scheduler runs while the command is scheduled.
|
// Called every time the scheduler runs while the command is scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
if(accumulateur.photocell()){accumulateur.desaccumule(0.1);}
|
if(accumulateur.photocell() || accumulateur.photocell2()){accumulateur.desaccumule(0.1);}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
|
@ -28,11 +28,11 @@ public class RobotContainer {
|
|||||||
CommandXboxController manette = new CommandXboxController(0);
|
CommandXboxController manette = new CommandXboxController(0);
|
||||||
public RobotContainer() {
|
public RobotContainer() {
|
||||||
dashboard.addCamera("limelight3G", "limelight3G","limelight.local:5800")
|
dashboard.addCamera("limelight3G", "limelight3G","limelight.local:5800")
|
||||||
.withSize(3,4)
|
.withSize(4,3)
|
||||||
.withPosition(0,0);
|
.withPosition(0,0);
|
||||||
dashboard.addCamera("limelight3", "limelight3","limelight.local:5800")
|
dashboard.addCamera("limelight3", "limelight3","limelight.local:5800")
|
||||||
.withSize(3,4)
|
.withSize(4,3)
|
||||||
.withPosition(3,0);
|
.withPosition(4,0);
|
||||||
configureBindings();
|
configureBindings();
|
||||||
drive.setDefaultCommand(new RunCommand(()->{
|
drive.setDefaultCommand(new RunCommand(()->{
|
||||||
drive.drive(-MathUtil.applyDeadband(manette.getRightX(),0.2), MathUtil.applyDeadband(-manette.getRightY(),0.2), MathUtil.applyDeadband(-manette.getRightX(), 0.2));
|
drive.drive(-MathUtil.applyDeadband(manette.getRightX(),0.2), MathUtil.applyDeadband(-manette.getRightY(),0.2), MathUtil.applyDeadband(-manette.getRightX(), 0.2));
|
||||||
|
@ -12,8 +12,8 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
|||||||
public class Accumulateur extends SubsystemBase {
|
public class Accumulateur extends SubsystemBase {
|
||||||
|
|
||||||
/** Creates a new Accumulateur. */
|
/** Creates a new Accumulateur. */
|
||||||
public Accumulateur() {dashboard.addBoolean("photocellacc", this::photocell).withSize(1, 1).withPosition(0, 1);
|
public Accumulateur() {dashboard.addBoolean("photocell", this::photocell).withSize(1, 1).withPosition(0, 1);
|
||||||
dashboard.addBoolean("photocellacc2", this::photocell).withSize(1, 1).withPosition(0, 1);
|
dashboard.addBoolean("photocell2", this::photocell).withSize(1, 1).withPosition(0, 1);
|
||||||
}
|
}
|
||||||
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
|
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ public class Accumulateur extends SubsystemBase {
|
|||||||
.withPosition(0, 4)
|
.withPosition(0, 4)
|
||||||
.getEntry();
|
.getEntry();
|
||||||
|
|
||||||
final WPI_TalonSRX accumulateur1 = new WPI_TalonSRX(0);
|
final WPI_TalonSRX strap = new WPI_TalonSRX(0);
|
||||||
final WPI_TalonSRX accumulateur2 = new WPI_TalonSRX(10);
|
final WPI_TalonSRX roueRouge = new WPI_TalonSRX(10);
|
||||||
final DigitalInput photocell = new DigitalInput(20);
|
final DigitalInput photocell = new DigitalInput(20);
|
||||||
final DigitalInput photocell2 = new DigitalInput(21);
|
final DigitalInput photocell2 = new DigitalInput(21);
|
||||||
public void encodeur(){
|
public void encodeur(){
|
||||||
@ -32,10 +32,17 @@ public class Accumulateur extends SubsystemBase {
|
|||||||
public boolean photocell(){
|
public boolean photocell(){
|
||||||
return photocell.get();
|
return photocell.get();
|
||||||
}
|
}
|
||||||
public void desaccumule(double vitesse){
|
public boolean photocell2(){
|
||||||
accumulateur1.set(vitesse);
|
return photocell2.get();
|
||||||
accumulateur2.set(-vitesse);
|
|
||||||
}
|
}
|
||||||
|
public void desaccumule(double vitesse){
|
||||||
|
strap.set(vitesse);
|
||||||
|
|
||||||
|
}
|
||||||
|
public void Petitlanceur(double vitesse){
|
||||||
|
roueRouge.set(vitesse);
|
||||||
|
}
|
||||||
|
|
||||||
public void desaccumule(){
|
public void desaccumule(){
|
||||||
desaccumule(vitesse.getDouble(0.9));
|
desaccumule(vitesse.getDouble(0.9));
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,9 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
|||||||
|
|
||||||
public class Lanceur extends SubsystemBase {
|
public class Lanceur extends SubsystemBase {
|
||||||
/** Creates a new Lanceur. */
|
/** Creates a new Lanceur. */
|
||||||
public Lanceur() {}
|
public Lanceur() {dashboard.add("rottourel", 0.2)
|
||||||
|
.withSize(0,0)
|
||||||
|
.withPosition(1, 3);}
|
||||||
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
|
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
|
||||||
|
|
||||||
final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0);
|
final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0);
|
||||||
@ -29,13 +31,9 @@ public class Lanceur extends SubsystemBase {
|
|||||||
private GenericEntry vitesse =
|
private GenericEntry vitesse =
|
||||||
dashboard.add("vitesselanceur", 0.2)
|
dashboard.add("vitesselanceur", 0.2)
|
||||||
.withSize(0,0)
|
.withSize(0,0)
|
||||||
.withPosition(1, 4)
|
.withPosition(0, 3)
|
||||||
.getEntry();
|
|
||||||
private GenericEntry rotation =
|
|
||||||
dashboard.add("rottourel", 0.2)
|
|
||||||
.withSize(0,0)
|
|
||||||
.withPosition(1, 5)
|
|
||||||
.getEntry();
|
.getEntry();
|
||||||
|
|
||||||
public void encodeur(double distance){
|
public void encodeur(double distance){
|
||||||
lanceur1.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
|
lanceur1.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
|
||||||
lanceur2.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
|
lanceur2.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
|
||||||
@ -54,9 +52,7 @@ public class Lanceur extends SubsystemBase {
|
|||||||
public void tourelRotation(double x, double y, double rotation){
|
public void tourelRotation(double x, double y, double rotation){
|
||||||
tourelle.set(rotation);
|
tourelle.set(rotation);
|
||||||
}
|
}
|
||||||
public void tourelRotation(){
|
|
||||||
tourelle.set(rotation.getDouble(0.1));
|
|
||||||
}
|
|
||||||
public double vitessetourel(){
|
public double vitessetourel(){
|
||||||
return(tourelle.getEncoder().getVelocity());
|
return(tourelle.getEncoder().getVelocity());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user