jgfhfcnh
This commit is contained in:
parent
3b6e00bd4b
commit
52539e1f4f
@ -17,11 +17,12 @@ public class Constants {
|
|||||||
public static int actuateur = 2;
|
public static int actuateur = 2;
|
||||||
public static int brakedroit = 3;
|
public static int brakedroit = 3;
|
||||||
public static int brakegauche = 4;
|
public static int brakegauche = 4;
|
||||||
// DIO Brando
|
// DIO
|
||||||
public static int limitbd = 0;
|
public static int limitbd = 0;
|
||||||
public static int limitbg = 2;
|
public static int limitbg = 2;
|
||||||
public static int limithd = 3;
|
public static int limithd = 3;
|
||||||
public static int limithg = 1;
|
public static int limithg = 1;
|
||||||
|
public static int photocell = 4;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
// 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 edu.wpi.first.wpilibj2.command.CommandBase;
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
import frc.robot.subsystems.Gratte;
|
import frc.robot.subsystems.Gratte;
|
||||||
|
|
||||||
|
|
||||||
public class GratteBaisser extends CommandBase {
|
public class GratteBaisser extends CommandBase {
|
||||||
private Gratte gratte;
|
private Gratte gratte;
|
||||||
/** Creates a new GratteBaisser. */
|
/** Creates a new GratteBaisser. */
|
||||||
@ -23,8 +23,21 @@ public class GratteBaisser 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(gratte.basd()){
|
||||||
|
gratte.baiser(0);
|
||||||
|
}
|
||||||
|
else{
|
||||||
gratte.baiser(0.5);
|
gratte.baiser(0.5);
|
||||||
}
|
}
|
||||||
|
if(gratte.basg()){
|
||||||
|
gratte.baiser(0);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
gratte.baiser(0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,8 +23,19 @@ public class GratteMonte 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(gratte.hautd()){
|
||||||
|
gratte.Lever(0);
|
||||||
|
}
|
||||||
|
else{
|
||||||
gratte.Lever(0.5);
|
gratte.Lever(0.5);
|
||||||
}
|
}
|
||||||
|
if(gratte.hautg()) {
|
||||||
|
gratte.Lever(0.5);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
gratte.Lever(0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,6 +33,9 @@ public class PivotBrasRentre extends CommandBase {
|
|||||||
if (pivot.distance()>1){
|
if (pivot.distance()>1){
|
||||||
pivot.monteDescendre(0.5);
|
pivot.monteDescendre(0.5);
|
||||||
}
|
}
|
||||||
|
else if(brasTelescopique.photocell()){
|
||||||
|
brasTelescopique.Reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
|
@ -8,6 +8,7 @@ package frc.robot.subsystems.bras;
|
|||||||
import com.revrobotics.CANSparkMax;
|
import com.revrobotics.CANSparkMax;
|
||||||
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.DigitalInput;
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
import frc.robot.Constants;
|
import frc.robot.Constants;
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ public class BrasTelescopique extends SubsystemBase {
|
|||||||
/** Creates a new BrasTelescopique. */
|
/** Creates a new BrasTelescopique. */
|
||||||
public BrasTelescopique() {}
|
public BrasTelescopique() {}
|
||||||
final CANSparkMax Winch = new CANSparkMax(Constants.BrasTelescopique,MotorType.kBrushless);
|
final CANSparkMax Winch = new CANSparkMax(Constants.BrasTelescopique,MotorType.kBrushless);
|
||||||
|
private DigitalInput photocell = new DigitalInput(Constants.photocell);
|
||||||
public void AvanceRecule(double vitesse) {
|
public void AvanceRecule(double vitesse) {
|
||||||
Winch.set(vitesse);
|
Winch.set(vitesse);
|
||||||
}
|
}
|
||||||
@ -24,7 +26,9 @@ public class BrasTelescopique extends SubsystemBase {
|
|||||||
public void Reset() {
|
public void Reset() {
|
||||||
Winch.getEncoder().setPosition(0);
|
Winch.getEncoder().setPosition(0);
|
||||||
}
|
}
|
||||||
|
public boolean photocell(){
|
||||||
|
return photocell.get();
|
||||||
|
}
|
||||||
@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