touche, amperage, distance
This commit is contained in:
@ -11,10 +11,12 @@ import frc.robot.subsystems.Pince;
|
||||
/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */
|
||||
public class Depart extends Command {
|
||||
private Elevateur elevateur;
|
||||
private Pince pince;
|
||||
/** Creates a new L2. */
|
||||
public Depart(Elevateur elevateur, Pince pince) {
|
||||
this.elevateur = elevateur;
|
||||
addRequirements(elevateur);
|
||||
this.pince = pince;
|
||||
addRequirements(elevateur, pince);
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
}
|
||||
|
||||
@ -25,20 +27,27 @@ public class Depart extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(pince.position()){
|
||||
pince.pivote(0);
|
||||
pince.reset();
|
||||
}
|
||||
else{
|
||||
pince.pivote(-0.2);
|
||||
}
|
||||
if(elevateur.limit2()==true){
|
||||
elevateur.vitesse(0);
|
||||
elevateur.reset();
|
||||
}
|
||||
else{
|
||||
elevateur.vitesse(.3);
|
||||
elevateur.vitesse(.5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
elevateur.vitesse(0);
|
||||
pince.pivote(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
|
@ -26,11 +26,11 @@ public class L2 extends Command {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(pince.encodeurpivot()>=15.6 && pince.encodeurpivot()<=16){
|
||||
if(pince.encodeurpivot()>=16 && pince.encodeurpivot()<=17){
|
||||
pince.pivote(0);
|
||||
|
||||
}
|
||||
else if(pince.encodeurpivot()>=16){
|
||||
else if(pince.encodeurpivot()>=17){
|
||||
pince.pivote(-0.1);
|
||||
}
|
||||
else{
|
||||
|
@ -30,22 +30,23 @@ public class L3 extends Command {
|
||||
public void execute() {
|
||||
if(elevateur.position()<=elevateur.encodeurelevateurL3bas() && elevateur.position()>=elevateur.encodeurelevateurL3haut()){
|
||||
elevateur.vitesse(0);
|
||||
}
|
||||
pince.pivote(-0.15);
|
||||
if(pince.encodeurpivot()>=20 && pince.encodeurpivot()<=21){
|
||||
pince.pivote(0);
|
||||
}
|
||||
else if(pince.encodeurpivot()>=20){
|
||||
pince.pivote(-0.15);
|
||||
}
|
||||
else{
|
||||
pince.pivote(0.15);
|
||||
}
|
||||
}
|
||||
else if(elevateur.position()>=elevateur.encodeurelevateurL3bas()){
|
||||
elevateur.vitesse(-0.5);
|
||||
elevateur.vitesse(-0.7);
|
||||
}
|
||||
else{
|
||||
elevateur.vitesse(0.5);
|
||||
elevateur.vitesse(0.25);
|
||||
}
|
||||
if(pince.encodeurpivot()>=15.6 && pince.encodeurpivot()<=16){
|
||||
pince.pivote(0);
|
||||
}
|
||||
else if(pince.encodeurpivot()>=16){
|
||||
pince.pivote(-0.1);
|
||||
}
|
||||
else{
|
||||
pince.pivote(0.1);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
|
@ -28,24 +28,24 @@ public class L4 extends Command {
|
||||
@Override
|
||||
public void execute() {
|
||||
if(elevateur.position()<=elevateur.encodeurelevateurL4bas() && elevateur.position()>=elevateur.encodeurelevateurL4haut()){
|
||||
elevateur.vitesse(0);
|
||||
|
||||
elevateur.vitesse(0);
|
||||
pince.pivote(-0.1);
|
||||
if(pince.encodeurpivot()>=22 && pince.encodeurpivot()<=23){
|
||||
pince.pivote(0);
|
||||
}
|
||||
else if(pince.encodeurpivot()>=22){
|
||||
pince.pivote(-0.15);
|
||||
}
|
||||
else{
|
||||
pince.pivote(0.15);
|
||||
}
|
||||
}
|
||||
else if(elevateur.position()>=elevateur.encodeurelevateurL4bas()){
|
||||
elevateur.vitesse(-0.5);
|
||||
elevateur.vitesse(-0.7);
|
||||
}
|
||||
else{
|
||||
elevateur.vitesse(.5);
|
||||
elevateur.vitesse(.25);
|
||||
}
|
||||
if(pince.encodeurpivot()>=21.76 && pince.encodeurpivot()<=22.3){
|
||||
pince.pivote(0);
|
||||
}
|
||||
else if(pince.encodeurpivot()>=22.3){
|
||||
pince.pivote(-0.1);
|
||||
}
|
||||
else{
|
||||
pince.pivote(0.1);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
|
@ -28,26 +28,37 @@ public class StationPince extends Command {
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {}
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(pince.emperagecoral() > 60){
|
||||
pince.aspirecoral(0);bougie.Bleu();
|
||||
}
|
||||
else{
|
||||
pince.aspirecoral(0.5);
|
||||
}
|
||||
|
||||
if(pince.encodeurpivot()<=11 && pince.encodeurpivot()>=12.6){
|
||||
pince.pivote(0);
|
||||
}
|
||||
else if(pince.encodeurpivot()>=9.8){
|
||||
pince.pivote(-0.1);
|
||||
if(pince.emperagecoral() >= 12){
|
||||
pince.x = true;
|
||||
}
|
||||
if(pince.x){
|
||||
pince.aspirecoral(0);
|
||||
bougie.Bleu();
|
||||
pince.pivote(-0.2);
|
||||
if(pince.position()){
|
||||
pince.pivote(0);
|
||||
}
|
||||
}
|
||||
else{
|
||||
pince.pivote(0.1);
|
||||
pince.aspirecoral(0.1);
|
||||
}
|
||||
if (!pince.x){
|
||||
if(pince.encodeurpivot()>=10.5 && pince.encodeurpivot()<=11.5){
|
||||
pince.pivote(0);
|
||||
}
|
||||
else if(pince.encodeurpivot()>=11){
|
||||
pince.pivote(-0.1);
|
||||
}
|
||||
else{
|
||||
pince.pivote(0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,6 +67,7 @@ public class StationPince extends Command {
|
||||
public void end(boolean interrupted) {
|
||||
pince.pivote(0);
|
||||
pince.aspirecoral(0);
|
||||
pince.x =false;
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
|
49
src/main/java/frc/robot/commands/Elevateur/balonL2.java
Normal file
49
src/main/java/frc/robot/commands/Elevateur/balonL2.java
Normal file
@ -0,0 +1,49 @@
|
||||
// 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.Elevateur;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
|
||||
import frc.robot.subsystems.Elevateur;
|
||||
/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */
|
||||
public class balonL2 extends Command {
|
||||
private Elevateur elevateur;
|
||||
/** Creates a new L2. */
|
||||
public balonL2(Elevateur elevateur) {
|
||||
this.elevateur = elevateur;
|
||||
addRequirements(elevateur);
|
||||
// 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() {
|
||||
if(elevateur.position()<=-2 && elevateur.position()>=-2.2){
|
||||
elevateur.vitesse(0);
|
||||
}
|
||||
else if(elevateur.position()>= -1.95){
|
||||
elevateur.vitesse(-0.7);
|
||||
}
|
||||
else{
|
||||
elevateur.vitesse(0.25);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
elevateur.vitesse(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
49
src/main/java/frc/robot/commands/Elevateur/balonL3.java
Normal file
49
src/main/java/frc/robot/commands/Elevateur/balonL3.java
Normal file
@ -0,0 +1,49 @@
|
||||
// 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.Elevateur;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
|
||||
import frc.robot.subsystems.Elevateur;
|
||||
/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */
|
||||
public class balonL3 extends Command {
|
||||
private Elevateur elevateur;
|
||||
/** Creates a new L2. */
|
||||
public balonL3(Elevateur elevateur) {
|
||||
this.elevateur = elevateur;
|
||||
addRequirements(elevateur);
|
||||
// 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() {
|
||||
if(elevateur.position()<=-4 && elevateur.position()>=-4.1){
|
||||
elevateur.vitesse(0);
|
||||
}
|
||||
else if(elevateur.position()>= -4){
|
||||
elevateur.vitesse(-0.7);
|
||||
}
|
||||
else{
|
||||
elevateur.vitesse(0.25);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
elevateur.vitesse(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user