rtdytyjhk
This commit is contained in:
parent
22e60fb27b
commit
977cbef11e
@ -5,18 +5,15 @@
|
|||||||
package frc.robot;
|
package frc.robot;
|
||||||
import edu.wpi.first.networktables.GenericEntry;
|
import edu.wpi.first.networktables.GenericEntry;
|
||||||
import edu.wpi.first.wpilibj.Joystick;
|
import edu.wpi.first.wpilibj.Joystick;
|
||||||
import edu.wpi.first.wpilibj.XboxController;
|
|
||||||
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;
|
||||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||||
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.RunCommand;
|
import edu.wpi.first.wpilibj2.command.RunCommand;
|
||||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||||
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 edu.wpi.first.wpilibj2.command.button.JoystickButton;
|
||||||
import frc.robot.commands.Force1;
|
|
||||||
import frc.robot.subsystems.Accumulateur;
|
import frc.robot.subsystems.Accumulateur;
|
||||||
import frc.robot.subsystems.Drive;
|
import frc.robot.subsystems.Drive;
|
||||||
import frc.robot.subsystems.Lanceur;
|
import frc.robot.subsystems.Lanceur;
|
||||||
|
36
src/main/java/frc/robot/commands/Avancer.java
Normal file
36
src/main/java/frc/robot/commands/Avancer.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// 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.CommandBase;
|
||||||
|
import frc.robot.subsystems.Drive;
|
||||||
|
|
||||||
|
public class Avancer extends CommandBase {
|
||||||
|
private Drive drive;
|
||||||
|
/** Creates a new Avancer. */
|
||||||
|
public Avancer(Drive drive) {
|
||||||
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the command is initially scheduled.
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called every time the scheduler runs while the command is scheduled.
|
||||||
|
@Override
|
||||||
|
public void execute() {}
|
||||||
|
|
||||||
|
// Called once the command ends or is interrupted.
|
||||||
|
@Override
|
||||||
|
public void end(boolean interrupted) {}
|
||||||
|
|
||||||
|
// Returns true when the command should end.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -6,16 +6,20 @@ package frc.robot.commands;
|
|||||||
|
|
||||||
|
|
||||||
import edu.wpi.first.networktables.GenericEntry;
|
import edu.wpi.first.networktables.GenericEntry;
|
||||||
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
|
import frc.robot.subsystems.Accumulateur;
|
||||||
import frc.robot.subsystems.Lanceur;
|
import frc.robot.subsystems.Lanceur;
|
||||||
|
|
||||||
public class Force1 extends CommandBase {
|
public class Force1 extends CommandBase {
|
||||||
private Lanceur lanceur;
|
private Lanceur lanceur;
|
||||||
|
private Accumulateur accumulateur;
|
||||||
GenericEntry force1;
|
GenericEntry force1;
|
||||||
|
|
||||||
/** Creates a new Force1. */
|
/** Creates a new Force1. */
|
||||||
public Force1(Lanceur lanceur, GenericEntry force1) {
|
public Force1(Lanceur lanceur,Accumulateur accumulateur, GenericEntry force1) {
|
||||||
this.lanceur = lanceur;
|
this.lanceur = lanceur;
|
||||||
|
this.accumulateur = accumulateur;
|
||||||
addRequirements(lanceur);
|
addRequirements(lanceur);
|
||||||
this.force1 = force1;
|
this.force1 = force1;
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
@ -31,8 +35,15 @@ public class Force1 extends CommandBase {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
lanceur.lancer(force1.getDouble(0));
|
lanceur.lancer(force1.getDouble(0));
|
||||||
|
double vitesse = SmartDashboard.getNumber("Force Lanceur", 100);
|
||||||
|
if (lanceur.vitesse() > vitesse ){
|
||||||
|
accumulateur.tourneavant();
|
||||||
|
accumulateur.tournearriere();
|
||||||
|
} else {
|
||||||
|
accumulateur.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,15 +4,19 @@
|
|||||||
|
|
||||||
package frc.robot.commands;
|
package frc.robot.commands;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
|
import frc.robot.subsystems.Accumulateur;
|
||||||
import frc.robot.subsystems.Lanceur;
|
import frc.robot.subsystems.Lanceur;
|
||||||
|
|
||||||
public class Force2 extends CommandBase {
|
public class Force2 extends CommandBase {
|
||||||
private Lanceur lanceur;
|
private Lanceur lanceur;
|
||||||
|
private Accumulateur accumulateur;
|
||||||
|
|
||||||
/** Creates a new Force1. */
|
/** Creates a new Force1. */
|
||||||
public Force2(Lanceur lancer) {
|
public Force2(Lanceur lancer,Accumulateur accumulateur) {
|
||||||
this.lanceur = lanceur;
|
this.lanceur = lanceur;
|
||||||
|
this.accumulateur = accumulateur;
|
||||||
addRequirements(lanceur);
|
addRequirements(lanceur);
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
}
|
}
|
||||||
@ -26,7 +30,13 @@ public class Force2 extends CommandBase {
|
|||||||
// 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() {
|
||||||
lanceur.lancer(500);
|
double vitesse = SmartDashboard.getNumber("Force Lanceur", 200);
|
||||||
|
if (lanceur.vitesse() > vitesse ){
|
||||||
|
accumulateur.tourneavant();
|
||||||
|
accumulateur.tournearriere();
|
||||||
|
} else {
|
||||||
|
accumulateur.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
|
@ -44,9 +44,12 @@ public class Force3 extends CommandBase {
|
|||||||
public void execute() {
|
public void execute() {
|
||||||
|
|
||||||
double vitesse = SmartDashboard.getNumber("Force Lanceur", 300);
|
double vitesse = SmartDashboard.getNumber("Force Lanceur", 300);
|
||||||
lanceur.lancer(200);
|
if (lanceur.vitesse() > vitesse ){
|
||||||
lanceur.lancer(force3.getDouble(0));}
|
accumulateur.tourneavant();
|
||||||
public void end(boolean interrupted) {
|
accumulateur.tournearriere();
|
||||||
|
} else {
|
||||||
|
accumulateur.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean isFinished() {
|
public boolean isFinished() {
|
||||||
|
@ -38,7 +38,7 @@ public class Force4 extends CommandBase {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
double vitesse = SmartDashboard.getNumber("Force Lanceur", 400);
|
double vitesse = SmartDashboard.getNumber("Force Lanceur", 400);
|
||||||
lanceur.lancer(200);
|
lanceur.lancer(400);
|
||||||
if (lanceur.vitesse() > vitesse ){
|
if (lanceur.vitesse() > vitesse ){
|
||||||
accumulateur.tourneavant();
|
accumulateur.tourneavant();
|
||||||
accumulateur.tournearriere();
|
accumulateur.tournearriere();
|
||||||
|
@ -38,7 +38,7 @@ public class Force5 extends CommandBase {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
double vitesse = SmartDashboard.getNumber("Force Lanceur", 500);
|
double vitesse = SmartDashboard.getNumber("Force Lanceur", 500);
|
||||||
lanceur.lancer(200);
|
lanceur.lancer(500);
|
||||||
if (lanceur.vitesse() > vitesse ){
|
if (lanceur.vitesse() > vitesse ){
|
||||||
accumulateur.tourneavant();
|
accumulateur.tourneavant();
|
||||||
accumulateur.tournearriere();
|
accumulateur.tournearriere();
|
||||||
|
@ -39,7 +39,7 @@ public class Force6 extends CommandBase {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
double vitesse = SmartDashboard.getNumber("Force Lanceur", 600);
|
double vitesse = SmartDashboard.getNumber("Force Lanceur", 600);
|
||||||
lanceur.lancer(200);
|
lanceur.lancer(600);
|
||||||
if (lanceur.vitesse() > vitesse ){
|
if (lanceur.vitesse() > vitesse ){
|
||||||
accumulateur.tourneavant();
|
accumulateur.tourneavant();
|
||||||
accumulateur.tournearriere();
|
accumulateur.tournearriere();
|
||||||
|
@ -38,7 +38,7 @@ public class Force7 extends CommandBase {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
double vitesse = SmartDashboard.getNumber("Force Lanceur", 700);
|
double vitesse = SmartDashboard.getNumber("Force Lanceur", 700);
|
||||||
lanceur.lancer(200);
|
lanceur.lancer(700);
|
||||||
if (lanceur.vitesse() > vitesse ){
|
if (lanceur.vitesse() > vitesse ){
|
||||||
accumulateur.tourneavant();
|
accumulateur.tourneavant();
|
||||||
accumulateur.tournearriere();
|
accumulateur.tournearriere();
|
||||||
|
@ -30,7 +30,9 @@ public class Drive extends SubsystemBase {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void reset(){
|
||||||
|
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void periodic() {
|
public void periodic() {
|
||||||
// This method will be called once per scheduler run
|
// This method will be called once per scheduler run
|
||||||
|
Loading…
x
Reference in New Issue
Block a user