Merge branch 'main' of https://demerso.net/pls5618/2023/robot
This commit is contained in:
commit
f086158608
1
networktables.json
Normal file
1
networktables.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
59
src/main/java/frc/robot/commands/bras/PivotChercheBas.java
Normal file
59
src/main/java/frc/robot/commands/bras/PivotChercheBas.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// 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.bras;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
|
import frc.robot.subsystems.bras.BrasTelescopique;
|
||||||
|
import frc.robot.subsystems.bras.Pivot;
|
||||||
|
|
||||||
|
public class PivotChercheBas extends CommandBase {
|
||||||
|
private BrasTelescopique brasTelescopique;
|
||||||
|
private Pivot pivot;
|
||||||
|
/** Creates a new PivotChercheBas. */
|
||||||
|
public PivotChercheBas(BrasTelescopique brasTelescopique, Pivot pivot) {
|
||||||
|
this.brasTelescopique = brasTelescopique;
|
||||||
|
this.pivot = pivot;
|
||||||
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
|
addRequirements(brasTelescopique);
|
||||||
|
addRequirements(pivot);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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(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.
|
||||||
|
@Override
|
||||||
|
public void end(boolean interrupted) {}
|
||||||
|
|
||||||
|
// Returns true when the command should end.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
59
src/main/java/frc/robot/commands/bras/PivotChercheHaut.java
Normal file
59
src/main/java/frc/robot/commands/bras/PivotChercheHaut.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// 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.bras;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
|
import frc.robot.subsystems.bras.BrasTelescopique;
|
||||||
|
import frc.robot.subsystems.bras.Pivot;
|
||||||
|
|
||||||
|
public class PivotChercheHaut extends CommandBase {
|
||||||
|
private BrasTelescopique brasTelescopique;
|
||||||
|
private Pivot pivot;
|
||||||
|
/** Creates a new PivotChercheHaut. */
|
||||||
|
public PivotChercheHaut(BrasTelescopique brasTelescopique, Pivot pivot) {
|
||||||
|
this.brasTelescopique = brasTelescopique;
|
||||||
|
this.pivot = pivot;
|
||||||
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
|
addRequirements(brasTelescopique);
|
||||||
|
addRequirements(pivot);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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(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.
|
||||||
|
@Override
|
||||||
|
public void end(boolean interrupted) {}
|
||||||
|
|
||||||
|
// Returns true when the command should end.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ import edu.wpi.first.wpilibj.PneumaticsModuleType;
|
|||||||
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
|
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
|
||||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||||
import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup;
|
import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup;
|
||||||
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||||
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
import frc.robot.Constants;
|
import frc.robot.Constants;
|
||||||
|
|
||||||
@ -24,10 +26,12 @@ public class BasePilotable extends SubsystemBase {
|
|||||||
final MotorControllerGroup droit = new MotorControllerGroup(avantdroit, arrieredroit);
|
final MotorControllerGroup droit = new MotorControllerGroup(avantdroit, arrieredroit);
|
||||||
final MotorControllerGroup gauche = new MotorControllerGroup(avantgauche, arrieregauche);
|
final MotorControllerGroup gauche = new MotorControllerGroup(avantgauche, arrieregauche);
|
||||||
final DifferentialDrive drive = new DifferentialDrive(gauche, droit);
|
final DifferentialDrive drive = new DifferentialDrive(gauche, droit);
|
||||||
|
|
||||||
//piston
|
//piston
|
||||||
private DoubleSolenoid brakedroit = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakedroit, Constants.brakedroit);
|
private DoubleSolenoid brakedroit = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakedroit, Constants.brakedroit);
|
||||||
private DoubleSolenoid brakegauche = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakegauche, Constants.brakegauche);
|
private DoubleSolenoid brakegauche = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakegauche, Constants.brakegauche);
|
||||||
//gyro
|
//gyro
|
||||||
|
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||||
private AHRS gyroscope = new AHRS();public double getangle() {return gyroscope.getAngle();}
|
private AHRS gyroscope = new AHRS();public double getangle() {return gyroscope.getAngle();}
|
||||||
public double getpitch() {
|
public double getpitch() {
|
||||||
return gyroscope.getPitch();
|
return gyroscope.getPitch();
|
||||||
@ -67,7 +71,10 @@ public void resetGyro(){
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void periodic() {
|
public void periodic() {
|
||||||
// This method will be called once per scheduler run
|
teb .add("encodeuravantdroit",0.1);
|
||||||
|
teb .add("encodeurarrieregauche",0.1);
|
||||||
|
teb .add("encodeurarrieredroit",0.1);
|
||||||
|
teb .add("encodeuravantgauche",0.1);
|
||||||
|
teb .add("distance",0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,5 +33,6 @@ public class BrasTelescopique extends SubsystemBase {
|
|||||||
@Override
|
@Override
|
||||||
public void periodic() {
|
public void periodic() {
|
||||||
Shuffleboard.getTab("SmartDashBoard") .add("photocell",0.1);
|
Shuffleboard.getTab("SmartDashBoard") .add("photocell",0.1);
|
||||||
|
Shuffleboard.getTab("SmartDashBoard") .add("winch",0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,4 +36,6 @@ public class Pivot extends SubsystemBase {
|
|||||||
public void periodic() {
|
public void periodic() {
|
||||||
Shuffleboard.getTab("SmartDashBoard") .add("limitpivot",0.1);
|
Shuffleboard.getTab("SmartDashBoard") .add("limitpivot",0.1);
|
||||||
}
|
}
|
||||||
|
Shuffleboard.getTab("SmartDashBoard") .add("pivot encodeur",0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user