tehgfhcg
This commit is contained in:
parent
4a648fff25
commit
8a9a331e66
@ -10,11 +10,8 @@ public class Constants {
|
|||||||
|
|
||||||
//moteur
|
//moteur
|
||||||
public static int leverGratte = 0;
|
public static int leverGratte = 0;
|
||||||
<<<<<<< HEAD
|
|
||||||
public static int baiserGratte = 1;
|
public static int baiserGratte = 1;
|
||||||
=======
|
|
||||||
public static int baisserGratte = 1;
|
public static int baisserGratte = 1;
|
||||||
>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0
|
|
||||||
|
|
||||||
// pneumatique
|
// pneumatique
|
||||||
public static int pistonpinceouvre = 0;
|
public static int pistonpinceouvre = 0;
|
||||||
|
@ -3,7 +3,13 @@
|
|||||||
// 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;
|
package frc.robot;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import edu.wpi.first.cameraserver.CameraServer;
|
import edu.wpi.first.cameraserver.CameraServer;
|
||||||
|
import edu.wpi.first.networktables.GenericEntry;
|
||||||
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||||
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
|
||||||
|
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import edu.wpi.first.wpilibj2.command.Commands;
|
import edu.wpi.first.wpilibj2.command.Commands;
|
||||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||||
@ -34,7 +40,7 @@ import frc.robot.commands.bras.PivoteBrasMilieux;
|
|||||||
|
|
||||||
|
|
||||||
public class RobotContainer {
|
public class RobotContainer {
|
||||||
CameraServer.startAutomaticCapture();
|
|
||||||
CommandXboxController manette1 = new CommandXboxController(0);
|
CommandXboxController manette1 = new CommandXboxController(0);
|
||||||
CommandXboxController manette2 = new CommandXboxController(1);
|
CommandXboxController manette2 = new CommandXboxController(1);
|
||||||
// subsystems
|
// subsystems
|
||||||
@ -57,7 +63,24 @@ PivoteBrasBas pivoteBrasBas = new PivoteBrasBas(brasTelescopique, pivot);
|
|||||||
PivoteBrasMilieux pivoteBrasMilieux = new PivoteBrasMilieux(brasTelescopique, pivot);
|
PivoteBrasMilieux pivoteBrasMilieux = new PivoteBrasMilieux(brasTelescopique, pivot);
|
||||||
PivoteBrasHaut pivoteBrasHaut = new PivoteBrasHaut(brasTelescopique, pivot);
|
PivoteBrasHaut pivoteBrasHaut = new PivoteBrasHaut(brasTelescopique, pivot);
|
||||||
Cone cone = new Cone(limelight, basePilotable, ()->-manette1.getLeftY());
|
Cone cone = new Cone(limelight, basePilotable, ()->-manette1.getLeftY());
|
||||||
|
Reculer reculer = new Reculer(basePilotable);
|
||||||
|
|
||||||
|
SendableChooser<String> chooser = new SendableChooser<>();
|
||||||
|
String enhaut = "en bas";
|
||||||
|
String aumilieux = "au milieux";
|
||||||
|
String enbas = "en bas";
|
||||||
|
String nulpart = "nul part";
|
||||||
|
ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto");
|
||||||
|
GenericEntry autobalance = layoutauto.add("choix balance",true).getEntry();
|
||||||
|
GenericEntry autosortir = layoutauto.add("choix sorit",false).getEntry();
|
||||||
public RobotContainer() {
|
public RobotContainer() {
|
||||||
|
chooser.setDefaultOption(enhaut, enhaut);
|
||||||
|
chooser.addOption(enbas, enbas);
|
||||||
|
chooser.addOption(aumilieux, aumilieux);
|
||||||
|
chooser.addOption(nulpart, nulpart);
|
||||||
|
layoutauto.add("choix hauteur",chooser);
|
||||||
|
|
||||||
|
|
||||||
configureBindings();
|
configureBindings();
|
||||||
|
|
||||||
basePilotable.setDefaultCommand(new RunCommand(() -> {
|
basePilotable.setDefaultCommand(new RunCommand(() -> {
|
||||||
@ -79,20 +102,25 @@ public RobotContainer() {
|
|||||||
manette2.povRight().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheBas, brasTelescopique::PivotChercheBas, brasTelescopique));
|
manette2.povRight().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheBas, brasTelescopique::PivotChercheBas, brasTelescopique));
|
||||||
manette2.povLeft().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheHaut, brasTelescopique::PivotChercheHaut, brasTelescopique));
|
manette2.povLeft().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheHaut, brasTelescopique::PivotChercheHaut, brasTelescopique));
|
||||||
manette2.rightBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
manette2.rightBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
||||||
<<<<<<< HEAD
|
|
||||||
manette2.leftBumper().toggleOnTrue(Commands.startEnd(null, null, null));**/
|
manette2.leftBumper().toggleOnTrue(Commands.startEnd(null, null, null));**/
|
||||||
=======
|
|
||||||
manette2.leftBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
manette2.leftBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
||||||
|
|
||||||
>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command getAutonomousCommand() {
|
public Command getAutonomousCommand() {
|
||||||
|
chooser.getSelected();
|
||||||
|
autobalance.getBoolean(true);
|
||||||
return new SequentialCommandGroup(
|
return new SequentialCommandGroup(
|
||||||
new PivoteBrasMilieux(brasTelescopique, pivot),
|
Commands.either(gyro, Commands.none(),()-> autobalance.getBoolean(true)),
|
||||||
new OuvrePince(pince),
|
Commands.either(reculer, Commands.none(),()-> autosortir.getBoolean(true)),
|
||||||
new PivotBrasRentre(brasTelescopique, pivot).alongWith(new Reculer(basePilotable)),
|
Commands.select(Map.ofEntries(
|
||||||
new Gyro(basePilotable)
|
Map.entry(enhaut,pivoteBrasHaut),
|
||||||
|
Map.entry(aumilieux,null),
|
||||||
|
Map.entry(enbas,null),
|
||||||
|
Map.entry(nulpart,null)
|
||||||
|
), chooser::getSelected)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,11 @@ public class Gyro 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(basePilotable.getpitch()>4)
|
if(basePilotable.getpitch()>10)
|
||||||
{
|
{
|
||||||
basePilotable.drive(0.3*basePilotable.getpitch()/15, 0);
|
basePilotable.drive(0.3*basePilotable.getpitch()/15, 0);
|
||||||
}
|
}
|
||||||
else if(basePilotable.getpitch()<-4)
|
else if(basePilotable.getpitch()<-10)
|
||||||
{
|
{
|
||||||
basePilotable.drive(0.3*basePilotable.getpitch()/15, 0);
|
basePilotable.drive(0.3*basePilotable.getpitch()/15, 0);
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,7 @@ import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
|||||||
import frc.robot.Constants;
|
import frc.robot.Constants;
|
||||||
|
|
||||||
public class Gratte extends SubsystemBase {
|
public class Gratte extends SubsystemBase {
|
||||||
<<<<<<< HEAD
|
|
||||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
|
||||||
=======
|
|
||||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||||
>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0
|
|
||||||
ShuffleboardLayout limitswitchgratte = Shuffleboard.getTab("teb")
|
ShuffleboardLayout limitswitchgratte = Shuffleboard.getTab("teb")
|
||||||
.getLayout("limitswitchsgratte", BuiltInLayouts.kList)
|
.getLayout("limitswitchsgratte", BuiltInLayouts.kList)
|
||||||
.withSize(2, 2);
|
.withSize(2, 2);
|
||||||
|
@ -24,16 +24,10 @@ public class BrasTelescopique extends SubsystemBase {
|
|||||||
ShuffleboardLayout layout = Shuffleboard.getTab("teb")
|
ShuffleboardLayout layout = Shuffleboard.getTab("teb")
|
||||||
.getLayout("layout", BuiltInLayouts.kList)
|
.getLayout("layout", BuiltInLayouts.kList)
|
||||||
.withSize(2, 2);
|
.withSize(2, 2);
|
||||||
<<<<<<< HEAD
|
|
||||||
ShuffleboardLayout bras = Shuffleboard.getTab("teb")
|
|
||||||
.getLayout("bras", BuiltInLayouts.kList)
|
|
||||||
.withSize(2, 2);
|
|
||||||
=======
|
|
||||||
|
|
||||||
ShuffleboardLayout bras = Shuffleboard.getTab("teb")
|
ShuffleboardLayout bras = Shuffleboard.getTab("teb")
|
||||||
.getLayout("bras", BuiltInLayouts.kList)
|
.getLayout("bras", BuiltInLayouts.kList)
|
||||||
.withSize(2, 2);
|
.withSize(2, 2);
|
||||||
>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0
|
|
||||||
/** 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);
|
||||||
|
@ -14,11 +14,7 @@ import com.revrobotics.CANSparkMax;
|
|||||||
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
||||||
|
|
||||||
public class Pivot extends SubsystemBase {
|
public class Pivot extends SubsystemBase {
|
||||||
<<<<<<< HEAD
|
|
||||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
|
||||||
=======
|
|
||||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||||
>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0
|
|
||||||
// moteur
|
// moteur
|
||||||
private CANSparkMax pivot = new CANSparkMax(Constants.pivot,MotorType.kBrushless);
|
private CANSparkMax pivot = new CANSparkMax(Constants.pivot,MotorType.kBrushless);
|
||||||
private DigitalInput limitpivot = new DigitalInput(Constants.limitpivot);
|
private DigitalInput limitpivot = new DigitalInput(Constants.limitpivot);
|
||||||
@ -43,14 +39,11 @@ ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
|||||||
teb .add("encodeur", 0.1);
|
teb .add("encodeur", 0.1);
|
||||||
teb .add ("encodeur pivot",0.1);
|
teb .add ("encodeur pivot",0.1);
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=======
|
|
||||||
{
|
{
|
||||||
teb.add ("encodeur pivot",0.1);
|
teb.add ("encodeur pivot",0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user