Changer Force 1 a 7
This commit is contained in:
parent
1efb3f77c5
commit
6d9373c990
@ -3,42 +3,52 @@
|
|||||||
// 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.commands;
|
package frc.robot.commands;
|
||||||
|
import frc.robot.subsystems.Accumulateur;
|
||||||
|
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.Lanceur;
|
import frc.robot.subsystems.Lanceur;
|
||||||
|
|
||||||
public class Force1 extends CommandBase {
|
public class Force1 extends CommandBase {
|
||||||
private Lanceur lanceur;
|
|
||||||
|
|
||||||
/** Creates a new Force1. */
|
private Lanceur lanceur;
|
||||||
public Force1(Lancer lancer) {
|
private Accumulateur accumulateur;
|
||||||
|
|
||||||
|
public void Lancer(Lanceur lanceur) {
|
||||||
this.lanceur = lanceur;
|
this.lanceur = lanceur;
|
||||||
addRequirements(lanceur);
|
this.accumulateur = accumulateur;
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
addRequirements(lanceur , accumulateur);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
lanceur.setPID(0,0,0);
|
lanceur.setPID(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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", 100);
|
||||||
|
lanceur.lancer(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.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
lanceur.lancer(0);
|
lanceur.stop();
|
||||||
|
accumulateur.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,42 +2,57 @@
|
|||||||
// Open Source Software; you can modify and/or share it under the terms of
|
// 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.
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
|
// 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;
|
package frc.robot.commands;
|
||||||
|
import frc.robot.subsystems.Accumulateur;
|
||||||
|
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.Lanceur;
|
import frc.robot.subsystems.Lanceur;
|
||||||
|
|
||||||
public class Force2 extends CommandBase {
|
public class Force2 extends CommandBase {
|
||||||
private Lanceur lanceur;
|
|
||||||
|
|
||||||
/** Creates a new Force1. */
|
private Lanceur lanceur;
|
||||||
public Force2(Lancer lancer) {
|
private Accumulateur accumulateur;
|
||||||
|
|
||||||
|
public void Lancer(Lanceur lanceur) {
|
||||||
this.lanceur = lanceur;
|
this.lanceur = lanceur;
|
||||||
addRequirements(lanceur);
|
this.accumulateur = accumulateur;
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
addRequirements(lanceur , accumulateur);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
lanceur.setPID(0,0,0);
|
lanceur.setPID(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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);
|
||||||
|
lanceur.lancer(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.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
lanceur.lancer(0);
|
lanceur.stop();
|
||||||
|
accumulateur.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,42 +2,57 @@
|
|||||||
// Open Source Software; you can modify and/or share it under the terms of
|
// 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.
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
|
// 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;
|
package frc.robot.commands;
|
||||||
|
import frc.robot.subsystems.Accumulateur;
|
||||||
|
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.Lanceur;
|
import frc.robot.subsystems.Lanceur;
|
||||||
|
|
||||||
public class Force3 extends CommandBase {
|
public class Force3 extends CommandBase {
|
||||||
private Lanceur lanceur;
|
|
||||||
|
|
||||||
/** Creates a new Force1. */
|
private Lanceur lanceur;
|
||||||
public Force3(Lancer lancer) {
|
private Accumulateur accumulateur;
|
||||||
|
|
||||||
|
public void Lancer(Lanceur lanceur) {
|
||||||
this.lanceur = lanceur;
|
this.lanceur = lanceur;
|
||||||
addRequirements(lanceur);
|
this.accumulateur = accumulateur;
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
addRequirements(lanceur , accumulateur);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
lanceur.setPID(0,0,0);
|
lanceur.setPID(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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", 300);
|
||||||
|
lanceur.lancer(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.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
lanceur.lancer(0);
|
lanceur.stop();
|
||||||
|
accumulateur.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,41 +3,52 @@
|
|||||||
// 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.commands;
|
package frc.robot.commands;
|
||||||
|
import frc.robot.subsystems.Accumulateur;
|
||||||
|
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.Lanceur;
|
import frc.robot.subsystems.Lanceur;
|
||||||
|
|
||||||
public class Force4 extends CommandBase {
|
public class Force4 extends CommandBase {
|
||||||
private Lanceur lanceur;
|
|
||||||
|
|
||||||
/** Creates a new Force1. */
|
private Lanceur lanceur;
|
||||||
public Force4(Lancer lancer) {
|
private Accumulateur accumulateur;
|
||||||
|
|
||||||
|
public void Lancer(Lanceur lanceur) {
|
||||||
this.lanceur = lanceur;
|
this.lanceur = lanceur;
|
||||||
addRequirements(lanceur);
|
this.accumulateur = accumulateur;
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
addRequirements(lanceur , accumulateur);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
lanceur.setPID(0,0,0);
|
lanceur.setPID(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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", 400);
|
||||||
|
lanceur.lancer(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.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
lanceur.lancer(0);
|
lanceur.stop();
|
||||||
|
accumulateur.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,41 +3,52 @@
|
|||||||
// 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.commands;
|
package frc.robot.commands;
|
||||||
|
import frc.robot.subsystems.Accumulateur;
|
||||||
|
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.Lanceur;
|
import frc.robot.subsystems.Lanceur;
|
||||||
|
|
||||||
public class Force5 extends CommandBase {
|
public class Force5 extends CommandBase {
|
||||||
private Lanceur lanceur;
|
|
||||||
|
|
||||||
/** Creates a new Force1. */
|
private Lanceur lanceur;
|
||||||
public Force5(Lancer lancer) {
|
private Accumulateur accumulateur;
|
||||||
|
|
||||||
|
public void Lancer(Lanceur lanceur) {
|
||||||
this.lanceur = lanceur;
|
this.lanceur = lanceur;
|
||||||
addRequirements(lanceur);
|
this.accumulateur = accumulateur;
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
addRequirements(lanceur , accumulateur);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
lanceur.setPID(0,0,0);
|
lanceur.setPID(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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", 500);
|
||||||
|
lanceur.lancer(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.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
lanceur.lancer(0);
|
lanceur.stop();
|
||||||
|
accumulateur.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,41 +3,52 @@
|
|||||||
// 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.commands;
|
package frc.robot.commands;
|
||||||
|
import frc.robot.subsystems.Accumulateur;
|
||||||
|
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.Lanceur;
|
import frc.robot.subsystems.Lanceur;
|
||||||
|
|
||||||
public class Force6 extends CommandBase {
|
public class Force6 extends CommandBase {
|
||||||
private Lanceur lanceur;
|
|
||||||
|
|
||||||
/** Creates a new Force1. */
|
private Lanceur lanceur;
|
||||||
public Force6(Lancer lancer) {
|
private Accumulateur accumulateur;
|
||||||
|
|
||||||
|
public void Lancer(Lanceur lanceur) {
|
||||||
this.lanceur = lanceur;
|
this.lanceur = lanceur;
|
||||||
addRequirements(lanceur);
|
this.accumulateur = accumulateur;
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
addRequirements(lanceur , accumulateur);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
lanceur.setPID(0,0,0);
|
lanceur.setPID(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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", 600);
|
||||||
|
lanceur.lancer(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.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
lanceur.lancer(0);
|
lanceur.stop();
|
||||||
|
accumulateur.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,41 +3,52 @@
|
|||||||
// 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.commands;
|
package frc.robot.commands;
|
||||||
|
import frc.robot.subsystems.Accumulateur;
|
||||||
|
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.Lanceur;
|
import frc.robot.subsystems.Lanceur;
|
||||||
|
|
||||||
public class Force7 extends CommandBase {
|
public class Force7 extends CommandBase {
|
||||||
private Lanceur lanceur;
|
|
||||||
|
|
||||||
/** Creates a new Force1. */
|
private Lanceur lanceur;
|
||||||
public Force7(Lancer lancer) {
|
private Accumulateur accumulateur;
|
||||||
|
|
||||||
|
public void Lancer(Lanceur lanceur) {
|
||||||
this.lanceur = lanceur;
|
this.lanceur = lanceur;
|
||||||
addRequirements(lanceur);
|
this.accumulateur = accumulateur;
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
addRequirements(lanceur , accumulateur);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
lanceur.setPID(0,0,0);
|
lanceur.setPID(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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", 700);
|
||||||
|
lanceur.lancer(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.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
lanceur.lancer(0);
|
lanceur.stop();
|
||||||
|
accumulateur.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,44 +0,0 @@
|
|||||||
// 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.Lanceur;
|
|
||||||
|
|
||||||
public class Lancer extends CommandBase {
|
|
||||||
|
|
||||||
private Lanceur lanceur;
|
|
||||||
|
|
||||||
/** Creates a new Lancer. */
|
|
||||||
public Lancer(Lanceur lanceur) {
|
|
||||||
this.lanceur = lanceur;
|
|
||||||
addRequirements(lanceur);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
|
||||||
@Override
|
|
||||||
public void initialize() {
|
|
||||||
|
|
||||||
lanceur.setPID(0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called every time the scheduler runs while the command is scheduled.
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
|
|
||||||
lanceur.lancer(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
|
||||||
@Override
|
|
||||||
public void end(boolean interrupted) {
|
|
||||||
lanceur.lancer(0); }
|
|
||||||
|
|
||||||
// Returns true when the command should end.
|
|
||||||
@Override
|
|
||||||
public boolean isFinished() {
|
|
||||||
return lanceur.distance()>1;
|
|
||||||
}
|
|
||||||
}
|
|
@ -22,8 +22,18 @@ public class Accumulateur extends SubsystemBase {
|
|||||||
moteuracc.set(0.5);
|
moteuracc.set(0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean limit(){
|
public double tourneavant(){
|
||||||
return limitacc.get();
|
moteuracc.set(0.5);
|
||||||
|
return(moteuracc.getSelectedSensorPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
public double tournearriere(){
|
||||||
|
moteuracc.set(-0.5);
|
||||||
|
return(moteuracc.getSelectedSensorPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop(){
|
||||||
|
moteuracc.set(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double distance() {
|
public double distance() {
|
||||||
|
@ -13,26 +13,24 @@ public class Lanceur extends SubsystemBase {
|
|||||||
|
|
||||||
final CANSparkMax lanceur = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);
|
final CANSparkMax lanceur = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);
|
||||||
|
|
||||||
public Lanceur() {}
|
public Lanceur(){}
|
||||||
|
|
||||||
public void lancer(double vitesse){
|
public void lancer(double vitesse){
|
||||||
lanceur.set(vitesse);
|
lanceur.set(vitesse);
|
||||||
}
|
}
|
||||||
|
public double vitesse(){
|
||||||
|
return(lanceur.getEncoder().getVelocity());
|
||||||
|
}
|
||||||
|
|
||||||
// encodeur
|
// encodeur
|
||||||
public double distance() {
|
public double distance() {
|
||||||
return(lanceur.getEncoder().getPosition());
|
return(lanceur.getEncoder().getPosition());
|
||||||
|
|
||||||
}
|
}
|
||||||
public void Reset() {
|
public void Reset() {
|
||||||
lanceur.getEncoder().setPosition(0);
|
lanceur.getEncoder().setPosition(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user