gjnvb
This commit is contained in:
parent
1dc859cb74
commit
77b894194e
@ -4,12 +4,22 @@
|
|||||||
|
|
||||||
package frc.robot.commands.bras;
|
package frc.robot.commands.bras;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
|
import frc.robot.subsystems.bras.BrasTelescopique;
|
||||||
|
import frc.robot.subsystems.bras.Pivot;
|
||||||
|
|
||||||
public class PivoteBrasBas extends CommandBase {
|
public class PivoteBrasBas extends CommandBase {
|
||||||
|
private BrasTelescopique brasTelescopique;
|
||||||
|
private Pivot pivot;
|
||||||
/** Creates a new PivoteBrasBas. */
|
/** Creates a new PivoteBrasBas. */
|
||||||
public PivoteBrasBas() {
|
public PivoteBrasBas(BrasTelescopique brasTelescopique, Pivot pivot) {
|
||||||
|
this.brasTelescopique = brasTelescopique;
|
||||||
|
this.pivot = pivot;
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
|
addRequirements(brasTelescopique);
|
||||||
|
addRequirements(pivot);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@ -18,7 +28,28 @@ public class PivoteBrasBas 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() {
|
||||||
|
if(brasTelescopique.distance()<10){
|
||||||
|
brasTelescopique.AvanceRecule(0.5);
|
||||||
|
}
|
||||||
|
else if(brasTelescopique.distance()>11) {
|
||||||
|
brasTelescopique.AvanceRecule(-0.5);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
brasTelescopique.AvanceRecule(0);
|
||||||
|
}
|
||||||
|
if (pivot.distance()<10){
|
||||||
|
pivot.monteDescendre(0.5);
|
||||||
|
}
|
||||||
|
else if(pivot.distance()>11) {
|
||||||
|
pivot.monteDescendre(-0.5);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pivot.monteDescendre(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,11 +5,19 @@
|
|||||||
package frc.robot.commands.bras;
|
package frc.robot.commands.bras;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
|
import frc.robot.subsystems.bras.BrasTelescopique;
|
||||||
|
import frc.robot.subsystems.bras.Pivot;
|
||||||
|
|
||||||
public class PivoteBrasHaut extends CommandBase {
|
public class PivoteBrasHaut extends CommandBase {
|
||||||
|
private BrasTelescopique brasTelescopique;
|
||||||
|
private Pivot pivot;
|
||||||
/** Creates a new PivoteBrasHaut. */
|
/** Creates a new PivoteBrasHaut. */
|
||||||
public PivoteBrasHaut() {
|
public PivoteBrasHaut(BrasTelescopique brasTelescopique, Pivot pivot) {
|
||||||
|
this.brasTelescopique = brasTelescopique;
|
||||||
|
this.pivot = pivot;
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
|
addRequirements(brasTelescopique);
|
||||||
|
addRequirements(pivot);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@ -18,7 +26,26 @@ public class PivoteBrasHaut 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() {
|
||||||
|
if(brasTelescopique.distance()<10){
|
||||||
|
brasTelescopique.AvanceRecule(0.5);
|
||||||
|
}
|
||||||
|
else if(brasTelescopique.distance()>11) {
|
||||||
|
brasTelescopique.AvanceRecule(-0.5);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
brasTelescopique.AvanceRecule(0);
|
||||||
|
}
|
||||||
|
if (pivot.distance()<10){
|
||||||
|
pivot.monteDescendre(0.5);
|
||||||
|
}
|
||||||
|
else if(pivot.distance()>11) {
|
||||||
|
pivot.monteDescendre(-0.5);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pivot.monteDescendre(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,11 +5,19 @@
|
|||||||
package frc.robot.commands.bras;
|
package frc.robot.commands.bras;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
|
import frc.robot.subsystems.bras.BrasTelescopique;
|
||||||
|
import frc.robot.subsystems.bras.Pivot;
|
||||||
|
|
||||||
public class PivoteBrasMilieux extends CommandBase {
|
public class PivoteBrasMilieux extends CommandBase {
|
||||||
|
private BrasTelescopique brasTelescopique;
|
||||||
|
private Pivot pivot;
|
||||||
/** Creates a new PivoteBrasMilieux. */
|
/** Creates a new PivoteBrasMilieux. */
|
||||||
public PivoteBrasMilieux() {
|
public PivoteBrasMilieux(BrasTelescopique brasTelescopique, Pivot pivot) {
|
||||||
|
this.brasTelescopique = brasTelescopique;
|
||||||
|
this.pivot = pivot;
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
|
addRequirements(brasTelescopique);
|
||||||
|
addRequirements(pivot);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@ -18,7 +26,27 @@ public class PivoteBrasMilieux 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() {
|
||||||
|
if(brasTelescopique.distance()<10){
|
||||||
|
brasTelescopique.AvanceRecule(0.5);
|
||||||
|
}
|
||||||
|
else if(brasTelescopique.distance()>11) {
|
||||||
|
brasTelescopique.AvanceRecule(-0.5);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
brasTelescopique.AvanceRecule(0);
|
||||||
|
}
|
||||||
|
if (pivot.distance()<10){
|
||||||
|
pivot.monteDescendre(0.5);
|
||||||
|
}
|
||||||
|
else if(pivot.distance()>11) {
|
||||||
|
pivot.monteDescendre(-0.5);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pivot.monteDescendre(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user