Compare commits
45 Commits
Author | SHA1 | Date | |
---|---|---|---|
e58cdf0b5b | |||
9f83b61c46 | |||
5d84d83f7d | |||
87c3abcb65 | |||
93e5bb0b46 | |||
7be5f8c2fc | |||
26d32e3707 | |||
1f4111ef6d | |||
bb9d5a5550 | |||
69ef6b6982 | |||
0be9356fa9 | |||
1627770572 | |||
c1bdf0aab7 | |||
0e04704942 | |||
53adcf5701 | |||
319c370c6e | |||
451d3c6e20 | |||
2260580c81 | |||
9cd08cf07c | |||
8aca411a23 | |||
44f6030e99 | |||
6f75b9cc42 | |||
210d219793 | |||
06abfa4dbb | |||
26a4b9f9a3 | |||
b384585224 | |||
ee2c9ff4b2 | |||
20c95efe93 | |||
4869632d6d | |||
afaec61f6d | |||
126058e9d4 | |||
1f17aaf4de | |||
eece0f47fa | |||
c81f118058 | |||
7848c4aaf2 | |||
1d1d6e962d | |||
d6420659e9 | |||
aafb2a62b5 | |||
0fdfa4269d | |||
017f168b3c | |||
5ffa28596c | |||
e7b4b47928 | |||
0577ce368a | |||
7521c0d94e | |||
b16d11b70a |
1
.SysId/sysid.json
Normal file
1
.SysId/sysid.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"FMS": {
|
"Joysticks": {
|
||||||
"window": {
|
"window": {
|
||||||
"visible": false
|
"visible": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Joysticks": {
|
"System Joysticks": {
|
||||||
"window": {
|
"window": {
|
||||||
"visible": false
|
"enabled": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"keyboardJoysticks": [
|
"keyboardJoysticks": [
|
||||||
@ -98,12 +98,5 @@
|
|||||||
"buttonCount": 0,
|
"buttonCount": 0,
|
||||||
"povCount": 0
|
"povCount": 0
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"robotJoysticks": [
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
"guid": "78696e70757401000000000000000000",
|
|
||||||
"useGamepad": true
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -4,43 +4,74 @@
|
|||||||
|
|
||||||
package frc.robot;
|
package frc.robot;
|
||||||
|
|
||||||
|
import com.pathplanner.lib.auto.NamedCommands;
|
||||||
import edu.wpi.first.math.MathUtil;
|
import edu.wpi.first.math.MathUtil;
|
||||||
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.RunCommand;
|
import edu.wpi.first.wpilibj2.command.RunCommand;
|
||||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||||
import frc.robot.commands.BalayeuseAlgue;
|
import frc.robot.commands.Algue1Test;
|
||||||
import frc.robot.commands.BalayeuseBas;
|
import frc.robot.commands.Algue2Test;
|
||||||
import frc.robot.commands.BalayeuseCoral;
|
import frc.robot.commands.AlgueExpire;
|
||||||
import frc.robot.commands.BalayeuseHaut;
|
import frc.robot.commands.CorailAspir;
|
||||||
import frc.robot.commands.L1Requin;
|
import frc.robot.commands.CorailTest;
|
||||||
import frc.robot.commands.aspire;
|
import frc.robot.commands.CoralAlgueInspire;
|
||||||
import frc.robot.commands.exspire;
|
import frc.robot.commands.CoralExpire;
|
||||||
import frc.robot.commands.requin_manuel;
|
import frc.robot.commands.Depart;
|
||||||
import frc.robot.subsystems.Requin;
|
import frc.robot.commands.DepartPince;
|
||||||
|
import frc.robot.commands.ElevateurManuel;
|
||||||
|
import frc.robot.commands.L2;
|
||||||
|
import frc.robot.commands.L3;
|
||||||
|
import frc.robot.commands.L4;
|
||||||
|
import frc.robot.commands.PinceManuel;
|
||||||
|
import frc.robot.commands.PinceManuel2;
|
||||||
|
import frc.robot.commands.StationPince;
|
||||||
|
import frc.robot.commands.reset;
|
||||||
|
import frc.robot.subsystems.Elevateur;
|
||||||
|
import frc.robot.subsystems.Pince;
|
||||||
import frc.robot.subsystems.Bougie;
|
import frc.robot.subsystems.Bougie;
|
||||||
import frc.robot.commands.aspire;
|
|
||||||
public class RobotContainer {
|
public class RobotContainer {
|
||||||
CommandXboxController manette1 = new CommandXboxController(0);
|
|
||||||
CommandXboxController manette2 = new CommandXboxController(1);
|
CommandXboxController manette1 = new CommandXboxController(0);
|
||||||
Requin requin = new Requin();
|
CommandXboxController manette2 = new CommandXboxController(1);
|
||||||
Bougie bougie = new Bougie();
|
Bougie bougie = new Bougie();
|
||||||
aspire aspire = new aspire(requin);
|
Pince pince = new Pince();
|
||||||
requin_manuel requin_manuel = new requin_manuel(requin);
|
Elevateur elevateur = new Elevateur();
|
||||||
|
ElevateurManuel elevateurManuel = new ElevateurManuel(elevateur, manette2::getLeftY);
|
||||||
|
PinceManuel pinceManuel = new PinceManuel(pince,manette2::getRightY);
|
||||||
|
PinceManuel2 pinceManuel2 = new PinceManuel2(pince);
|
||||||
public RobotContainer() {
|
public RobotContainer() {
|
||||||
configureBindings();
|
configureBindings();
|
||||||
requin.setDefaultCommand(new RunCommand(()->{
|
elevateur.setDefaultCommand(new RunCommand(()->{
|
||||||
requin.rotationer(MathUtil.applyDeadband(manette2.getRightY(), 0.2));
|
elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftY(), 0.2));
|
||||||
}, requin));
|
}, elevateur));
|
||||||
|
pince.setDefaultCommand(new RunCommand(()->{
|
||||||
|
pince.pivote(MathUtil.applyDeadband(manette2.getRightY()/5, 0.2));
|
||||||
|
}, pince));
|
||||||
|
NamedCommands.registerCommand("Station",new StationPince(pince, elevateur));
|
||||||
|
NamedCommands.registerCommand("L4", new L4(elevateur, pince));
|
||||||
|
NamedCommands.registerCommand("L3", new L3(elevateur, pince));
|
||||||
|
NamedCommands.registerCommand("CoralExpire",new CoralExpire(pince,bougie));
|
||||||
|
NamedCommands.registerCommand("CoraletAlgue", new CoralAlgueInspire(pince,bougie));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureBindings() {
|
private void configureBindings() {
|
||||||
manette2.a().whileTrue(new aspire(requin));
|
// manette1
|
||||||
manette2.rightTrigger().whileTrue(new exspire(requin));
|
manette1.a().whileTrue(new Depart(elevateur, pince));
|
||||||
manette2.b().whileTrue(new BalayeuseAlgue(requin, bougie));
|
manette1.b().whileTrue(new L2(elevateur,pince));
|
||||||
manette2.x().whileTrue(new BalayeuseCoral(requin, bougie));
|
manette1.x().whileTrue(new L3(elevateur, pince));
|
||||||
manette2.y().whileTrue(new L1Requin(requin,bougie));
|
manette1.y().whileTrue(new L4(elevateur, pince));
|
||||||
manette2.rightBumper().whileTrue(new BalayeuseHaut(requin));
|
manette1.rightTrigger().whileTrue(new CoralAlgueInspire(pince, bougie));
|
||||||
|
manette1.rightBumper().whileTrue(new StationPince(pince, elevateur));
|
||||||
|
//manette2
|
||||||
|
manette2.leftTrigger().whileTrue(new AlgueExpire(pince, bougie));
|
||||||
|
manette2.a().whileTrue(new CorailAspir(pince));
|
||||||
|
manette2.b().whileTrue(new CoralExpire(pince, bougie));
|
||||||
|
manette2.povLeft().whileTrue(new Algue1Test(pince));
|
||||||
|
manette2.povRight().whileTrue(new Algue2Test(pince));
|
||||||
|
manette2.x().whileTrue(new CorailTest(pince));
|
||||||
|
manette2.start().whileTrue(new reset(elevateur));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command getAutonomousCommand() {
|
public Command getAutonomousCommand() {
|
||||||
|
@ -5,16 +5,16 @@
|
|||||||
package frc.robot.commands;
|
package frc.robot.commands;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import frc.robot.subsystems.Requin;
|
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 */
|
/* 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 aspire extends Command {
|
public class Algue1Test extends Command {
|
||||||
/** Creates a new aspire. */
|
private Pince pince;
|
||||||
private Requin requin;
|
/** Creates a new AlgueTest. */
|
||||||
public aspire(Requin requin) {
|
public Algue1Test(Pince pince) {
|
||||||
|
this.pince = pince;
|
||||||
|
addRequirements(pince);
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
this.requin = requin;
|
|
||||||
addRequirements(requin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@ -24,13 +24,13 @@ public class aspire extends Command {
|
|||||||
// 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() {
|
||||||
requin.balaye(0.3);
|
pince.algue1Test(0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
requin.balaye(0);
|
pince.algue1Test(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
@ -5,16 +5,16 @@
|
|||||||
package frc.robot.commands;
|
package frc.robot.commands;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import frc.robot.subsystems.Requin;
|
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 */
|
/* 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 exspire extends Command {
|
public class Algue2Test extends Command {
|
||||||
/** Creates a new aspire. */
|
private Pince pince;
|
||||||
private Requin requin;
|
/** Creates a new AlgueTest. */
|
||||||
public exspire(Requin requin) {
|
public Algue2Test(Pince pince) {
|
||||||
|
this.pince = pince;
|
||||||
|
addRequirements(pince);
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
this.requin = requin;
|
|
||||||
addRequirements(requin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@ -24,13 +24,13 @@ public class exspire extends Command {
|
|||||||
// 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() {
|
||||||
requin.balaye(-0.3);
|
pince.algue2Test(0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
requin.balaye(0);
|
pince.algue2Test(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
51
src/main/java/frc/robot/commands/AlgueExpire.java
Normal file
51
src/main/java/frc/robot/commands/AlgueExpire.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// 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;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import frc.robot.subsystems.Bougie;
|
||||||
|
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 AlgueExpire extends Command {
|
||||||
|
private Pince pince;
|
||||||
|
private Bougie bougie;
|
||||||
|
/** Creates a new CoralAlgue. */
|
||||||
|
public AlgueExpire(Pince pince,Bougie bougie) {
|
||||||
|
this.pince = pince;
|
||||||
|
this.bougie = bougie;
|
||||||
|
addRequirements(pince,bougie);
|
||||||
|
// 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(pince.emperagealgue()>60){
|
||||||
|
pince.aspirealgue(-0.5);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pince.aspirealgue(-0.5);
|
||||||
|
bougie.Jaune();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called once the command ends or is interrupted.
|
||||||
|
@Override
|
||||||
|
public void end(boolean interrupted) {
|
||||||
|
pince.aspirealgue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true when the command should end.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,63 +0,0 @@
|
|||||||
// 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;
|
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
|
||||||
import frc.robot.subsystems.Bougie;
|
|
||||||
import frc.robot.subsystems.Requin;
|
|
||||||
|
|
||||||
/* 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 BalayeuseAlgue extends Command {
|
|
||||||
private Requin requin;
|
|
||||||
private Bougie bougie;
|
|
||||||
/** Creates a new Balayeuse. */
|
|
||||||
public BalayeuseAlgue(Requin requin, Bougie bougie) {
|
|
||||||
this.requin = requin;
|
|
||||||
this.bougie =bougie;
|
|
||||||
addRequirements(requin,bougie);
|
|
||||||
// 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(requin.encodeur()>=500 && requin.encodeur()<=510)
|
|
||||||
{
|
|
||||||
requin.rotationer(0);
|
|
||||||
if(requin.amp()> 60){
|
|
||||||
requin.balaye(0);
|
|
||||||
bougie.Vert();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
requin.balaye(0.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(requin.encodeur()>=510){
|
|
||||||
requin.rotationer(0.5);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
requin.rotationer(-0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
|
||||||
@Override
|
|
||||||
public void end(boolean interrupted) {
|
|
||||||
requin.rotationer(0);
|
|
||||||
requin.balaye(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true when the command should end.
|
|
||||||
@Override
|
|
||||||
public boolean isFinished() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,16 +5,16 @@
|
|||||||
package frc.robot.commands;
|
package frc.robot.commands;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import frc.robot.subsystems.Requin;
|
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 */
|
/* 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 BalayeuseBas extends Command {
|
public class CorailAspir extends Command {
|
||||||
private Requin requin;
|
/** Creates a new CorailAspir. */
|
||||||
/** Creates a new Balayeuse. */
|
private Pince pince;
|
||||||
public BalayeuseBas(Requin requin) {
|
public CorailAspir(Pince pince) {
|
||||||
this.requin = requin;
|
|
||||||
addRequirements(requin);
|
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
|
this.pince = pince;
|
||||||
|
addRequirements(pince);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@ -24,12 +24,14 @@ public class BalayeuseBas extends Command {
|
|||||||
// 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() {
|
||||||
requin.rotationer(-0.5);
|
|
||||||
|
pince.aspirecoral(0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
requin.rotationer(0);
|
pince.aspirecoral(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
@ -5,15 +5,15 @@
|
|||||||
package frc.robot.commands;
|
package frc.robot.commands;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import frc.robot.subsystems.Requin;
|
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 */
|
/* 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 ExpireAlgue extends Command {
|
public class CorailTest extends Command {
|
||||||
private Requin requin;
|
private Pince pince;
|
||||||
/** Creates a new ExpireAlgue. */
|
/** Creates a new AlgueTest. */
|
||||||
public ExpireAlgue(Requin requin) {
|
public CorailTest(Pince pince) {
|
||||||
this.requin = requin;
|
this.pince = pince;
|
||||||
addRequirements(requin);
|
addRequirements(pince);
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,13 +24,13 @@ public class ExpireAlgue extends Command {
|
|||||||
// 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() {
|
||||||
requin.balaye(0.5);
|
pince.aspirecoral(0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
requin.balaye(0);
|
pince.aspirecoral(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
53
src/main/java/frc/robot/commands/CoralAlgueInspire.java
Normal file
53
src/main/java/frc/robot/commands/CoralAlgueInspire.java
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// 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;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import frc.robot.subsystems.Bougie;
|
||||||
|
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 CoralAlgueInspire extends Command {
|
||||||
|
private Pince pince;
|
||||||
|
private Bougie bougie;
|
||||||
|
/** Creates a new CoralAlgue. */
|
||||||
|
public CoralAlgueInspire(Pince pince, Bougie bougie) {
|
||||||
|
this.pince = pince;
|
||||||
|
this.bougie = bougie;
|
||||||
|
addRequirements(pince,bougie);
|
||||||
|
// 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() {
|
||||||
|
pince.aspirecoral(-.5);
|
||||||
|
if(pince.emperagealgue()>60){
|
||||||
|
pince.aspirealgue(0);
|
||||||
|
bougie.Bleu();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pince.aspirealgue(0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called once the command ends or is interrupted.
|
||||||
|
@Override
|
||||||
|
public void end(boolean interrupted) {
|
||||||
|
pince.aspirecoral(0);
|
||||||
|
pince.aspirealgue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true when the command should end.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
49
src/main/java/frc/robot/commands/CoralExpire.java
Normal file
49
src/main/java/frc/robot/commands/CoralExpire.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;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import frc.robot.subsystems.Pince;
|
||||||
|
import frc.robot.subsystems.Bougie;
|
||||||
|
/* 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 CoralExpire extends Command {
|
||||||
|
private Pince pince;
|
||||||
|
Bougie bougie;
|
||||||
|
/** Creates a new CoralAlgue. */
|
||||||
|
public CoralExpire(Pince pince, Bougie bougie) {
|
||||||
|
this.pince = pince;
|
||||||
|
this.bougie = bougie;
|
||||||
|
addRequirements(pince,bougie);
|
||||||
|
// 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(pince.emperagecoral() > 60){
|
||||||
|
// pince.aspirecoral(0);
|
||||||
|
//}
|
||||||
|
//else{
|
||||||
|
pince.aspirecoral(-.5);
|
||||||
|
//bougie.Jaune();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called once the command ends or is interrupted.
|
||||||
|
@Override
|
||||||
|
public void end(boolean interrupted) {
|
||||||
|
pince.aspirecoral(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true when the command should end.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
52
src/main/java/frc/robot/commands/Depart.java
Normal file
52
src/main/java/frc/robot/commands/Depart.java
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// 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;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import frc.robot.subsystems.Elevateur;
|
||||||
|
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.pince = pince;
|
||||||
|
this.elevateur = elevateur;
|
||||||
|
addRequirements(elevateur,pince);
|
||||||
|
// 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.limit2()==true){
|
||||||
|
elevateur.vitesse(0);
|
||||||
|
elevateur.reset();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
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.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return elevateur.limit2()==true;
|
||||||
|
}
|
||||||
|
}
|
@ -5,15 +5,15 @@
|
|||||||
package frc.robot.commands;
|
package frc.robot.commands;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import frc.robot.subsystems.Requin;
|
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 */
|
/* 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 BalayeuseHaut extends Command {
|
public class DepartPince extends Command {
|
||||||
private Requin requin;
|
private Pince pince;
|
||||||
/** Creates a new Balayeuse. */
|
/** Creates a new DepartPince. */
|
||||||
public BalayeuseHaut(Requin requin) {
|
public DepartPince(Pince pince) {
|
||||||
this.requin = requin;
|
this.pince = pince;
|
||||||
addRequirements(requin);
|
addRequirements(pince);
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,19 +24,19 @@ public class BalayeuseHaut extends Command {
|
|||||||
// 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(requin.enHaut()==true){
|
if(pince.position()==true){
|
||||||
requin.rotationer(0);
|
pince.pivote(0);
|
||||||
requin.reset();
|
pince.reset();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
requin.rotationer(-0.5);
|
pince.pivote(.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
requin.rotationer(0);
|
pince.pivote(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
48
src/main/java/frc/robot/commands/ElevateurManuel.java
Normal file
48
src/main/java/frc/robot/commands/ElevateurManuel.java
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// 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;
|
||||||
|
|
||||||
|
import java.util.function.DoubleSupplier;
|
||||||
|
|
||||||
|
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 ElevateurManuel extends Command {
|
||||||
|
private DoubleSupplier doubleSupplier;
|
||||||
|
private Elevateur elevateur;
|
||||||
|
/** Creates a new ElevateurManuel. */
|
||||||
|
public ElevateurManuel(Elevateur elevateur,DoubleSupplier doubleSupplier) {
|
||||||
|
this.doubleSupplier = doubleSupplier;
|
||||||
|
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.limit2()==true){
|
||||||
|
elevateur.vitesse(0);
|
||||||
|
}
|
||||||
|
elevateur.vitesse(doubleSupplier.getAsDouble()/7);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
65
src/main/java/frc/robot/commands/L2.java
Normal file
65
src/main/java/frc/robot/commands/L2.java
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
// 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;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
|
||||||
|
import frc.robot.subsystems.Elevateur;
|
||||||
|
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 L2 extends Command {
|
||||||
|
private Elevateur elevateur;
|
||||||
|
private Pince pince;
|
||||||
|
/** Creates a new L2. */
|
||||||
|
public L2(Elevateur elevateur,Pince pince) {
|
||||||
|
this.elevateur = elevateur;
|
||||||
|
this.pince = pince;
|
||||||
|
addRequirements(elevateur,pince);
|
||||||
|
// 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()>=500 && elevateur.position()<=510){
|
||||||
|
elevateur.vitesse(0);
|
||||||
|
}
|
||||||
|
else if(elevateur.position()>=510){
|
||||||
|
elevateur.vitesse(0.3);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
elevateur.vitesse(.3);
|
||||||
|
}
|
||||||
|
if(pince.encodeurpivot()>=500 && pince.encodeurpivot()<=510){
|
||||||
|
pince.pivote(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(pince.encodeurpivot()>=510){
|
||||||
|
pince.pivote(0.2);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pince.pivote(-0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
63
src/main/java/frc/robot/commands/L3.java
Normal file
63
src/main/java/frc/robot/commands/L3.java
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// 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;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
|
||||||
|
import frc.robot.subsystems.Elevateur;
|
||||||
|
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 L3 extends Command {
|
||||||
|
private Elevateur elevateur;
|
||||||
|
private Pince pince;
|
||||||
|
/** Creates a new L2. */
|
||||||
|
public L3(Elevateur elevateur,Pince pince) {
|
||||||
|
this.elevateur = elevateur;
|
||||||
|
this.pince = pince;
|
||||||
|
addRequirements(elevateur,pince);
|
||||||
|
// 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()>=700 && elevateur.position()<=710){
|
||||||
|
elevateur.vitesse(0);
|
||||||
|
}
|
||||||
|
else if(elevateur.position()>=510){
|
||||||
|
elevateur.vitesse(0.5);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
elevateur.vitesse(-.5);
|
||||||
|
}
|
||||||
|
if(pince.encodeurpivot()>=700 && pince.encodeurpivot()<=710){
|
||||||
|
pince.pivote(0);
|
||||||
|
}
|
||||||
|
else if(pince.encodeurpivot()>=710){
|
||||||
|
pince.pivote(0.2);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pince.pivote(-0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -5,18 +5,19 @@
|
|||||||
package frc.robot.commands;
|
package frc.robot.commands;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import frc.robot.subsystems.Bougie;
|
|
||||||
import frc.robot.subsystems.Requin;
|
import frc.robot.subsystems.Elevateur;
|
||||||
|
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 */
|
/* 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 L1Requin extends Command {
|
public class L4 extends Command {
|
||||||
private Requin requin;
|
private Elevateur elevateur;
|
||||||
private Bougie bougie;
|
private Pince pince;
|
||||||
/** Creates a new Balayeuse. */
|
/** Creates a new L2. */
|
||||||
public L1Requin(Requin requin,Bougie bougie) {
|
public L4(Elevateur elevateur,Pince pince) {
|
||||||
this.requin = requin;
|
this.elevateur = elevateur;
|
||||||
this.bougie = bougie;
|
this.pince = pince;
|
||||||
addRequirements(requin,bougie);
|
addRequirements(elevateur,pince);
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,34 +28,31 @@ public class L1Requin extends Command {
|
|||||||
// 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(elevateur.position()>=800 && elevateur.position()<=809){
|
||||||
if(requin.encodeur()>=800 && requin.encodeur()<=810){
|
elevateur.vitesse(0);
|
||||||
requin.rotationer(0);
|
|
||||||
if(requin.amp()>8){
|
|
||||||
requin.balaye(-0.5);
|
|
||||||
}
|
}
|
||||||
else{
|
else if(elevateur.position()>=810){
|
||||||
requin.balaye(0);
|
elevateur.vitesse(0.5);
|
||||||
bougie.Rouge();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(requin.encodeur()>=810){
|
|
||||||
requin.rotationer(0.5);
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
requin.rotationer(-0.5);
|
elevateur.vitesse(.5);
|
||||||
|
}
|
||||||
|
if(pince.encodeurpivot()>=800 && pince.encodeurpivot()<=809){
|
||||||
|
pince.pivote(0);
|
||||||
|
}
|
||||||
|
else if(pince.encodeurpivot()>=810){
|
||||||
|
pince.pivote(0.2);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pince.pivote(-0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
requin.rotationer(0);
|
elevateur.vitesse(0);
|
||||||
requin.balaye(0);
|
pince.pivote(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
@ -3,21 +3,22 @@
|
|||||||
// 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 java.util.function.DoubleSupplier;
|
import java.util.function.DoubleSupplier;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import frc.robot.subsystems.Requin;
|
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 */
|
/* 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 requin_manuel extends Command {
|
public class PinceManuel extends Command {
|
||||||
/** Creates a new requin_manuel. */
|
private Pince pince;
|
||||||
private Requin requin;
|
|
||||||
private DoubleSupplier x;
|
private DoubleSupplier x;
|
||||||
public requin_manuel(Requin requin) {
|
/** Creates a new PinceManuel. */
|
||||||
|
public PinceManuel(Pince pince, DoubleSupplier x) {
|
||||||
|
this.pince = pince;
|
||||||
|
this.x = x;
|
||||||
|
//this.doubleSupplier = doubleSupplier;
|
||||||
|
addRequirements(pince);
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
this.requin = requin;
|
|
||||||
addRequirements(requin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@ -27,18 +28,18 @@ public class requin_manuel extends Command {
|
|||||||
// 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(requin.enHaut()){
|
if(pince.position()){
|
||||||
requin.rotationer(0);
|
pince.pivote(0);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
requin.rotationer(x.getAsDouble());
|
pince.pivote(x.getAsDouble());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
requin.rotationer(0);
|
pince.pivote(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
47
src/main/java/frc/robot/commands/PinceManuel2.java
Normal file
47
src/main/java/frc/robot/commands/PinceManuel2.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// 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;
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
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 PinceManuel2 extends Command {
|
||||||
|
private Pince pince;
|
||||||
|
//private DoubleSupplier doubleSupplier;
|
||||||
|
/** Creates a new PinceManuel. */
|
||||||
|
public PinceManuel2(Pince pince
|
||||||
|
|
||||||
|
//,DoubleSupplier doubleSupplier
|
||||||
|
) {
|
||||||
|
this.pince = pince;
|
||||||
|
// this.doubleSupplier = doubleSupplier;
|
||||||
|
addRequirements(pince);
|
||||||
|
// 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() {
|
||||||
|
|
||||||
|
pince.pivote(-0.2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called once the command ends or is interrupted.
|
||||||
|
@Override
|
||||||
|
public void end(boolean interrupted) {
|
||||||
|
pince.pivote(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true when the command should end.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -5,18 +5,19 @@
|
|||||||
package frc.robot.commands;
|
package frc.robot.commands;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import frc.robot.subsystems.Bougie;
|
import frc.robot.subsystems.Elevateur;
|
||||||
import frc.robot.subsystems.Requin;
|
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 */
|
/* 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 BalayeuseCoral extends Command {
|
public class StationPince extends Command {
|
||||||
private Requin requin;
|
|
||||||
private Bougie bougie;
|
private Pince pince;
|
||||||
/** Creates a new Balayeuse. */
|
private Elevateur elevateur;
|
||||||
public BalayeuseCoral(Requin requin, Bougie bougie) {
|
/** Creates a new L2Pince. */
|
||||||
this.requin = requin;
|
public StationPince(Pince pince,Elevateur elevateur) {
|
||||||
this.bougie = bougie;
|
this.elevateur = elevateur;
|
||||||
addRequirements(requin,bougie);
|
this.pince = pince;
|
||||||
|
addRequirements(pince,elevateur);
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,36 +28,32 @@ public class BalayeuseCoral extends Command {
|
|||||||
// 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(requin.encodeur()>=100 && requin.encodeur()<=110){
|
pince.aspirecoral(0.5);
|
||||||
requin.rotationer(0);
|
if(pince.encodeurpivot()>=900 && pince.encodeurpivot()<=910){
|
||||||
if(requin.amp()>60){
|
pince.pivote(0);
|
||||||
requin.balaye(0);
|
}
|
||||||
bougie.Vert();
|
else if(pince.encodeurpivot()>=910){
|
||||||
if(requin.enHaut()){
|
pince.pivote(0.2);
|
||||||
requin.rotationer(0);
|
}
|
||||||
}
|
else{
|
||||||
else{
|
pince.pivote(-0.2);
|
||||||
requin.rotationer(0.5);
|
}
|
||||||
}
|
if(elevateur.position()>=400 && elevateur.position()<=410){
|
||||||
|
elevateur.vitesse(0);
|
||||||
|
}
|
||||||
|
else if(elevateur.position()>=410){
|
||||||
|
elevateur.vitesse(0.3);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
elevateur.vitesse(-.3);
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
requin.balaye(0.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(requin.encodeur()>=110){
|
|
||||||
requin.rotationer(0.5);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
requin.rotationer(-0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {
|
||||||
requin.rotationer(0);
|
pince.pivote(0);
|
||||||
requin.balaye(0);
|
pince.aspirecoral(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
41
src/main/java/frc/robot/commands/reset.java
Normal file
41
src/main/java/frc/robot/commands/reset.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// 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;
|
||||||
|
|
||||||
|
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 reset extends Command {
|
||||||
|
/** Creates a new reset. */
|
||||||
|
private Elevateur elevateur;
|
||||||
|
public reset(Elevateur elevateur) {
|
||||||
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
|
this.elevateur = elevateur;
|
||||||
|
addRequirements(elevateur);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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() {
|
||||||
|
elevateur.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
@ -43,8 +43,7 @@ public class Bougie extends SubsystemBase {
|
|||||||
candle.setLEDs(255, 215, 0,0,48,8);
|
candle.setLEDs(255, 215, 0,0,48,8);
|
||||||
candle.setLEDs(255, 215, 0,0,64,8);
|
candle.setLEDs(255, 215, 0,0,64,8);
|
||||||
}
|
}
|
||||||
public void RainBow(){
|
public void RainBow(){candle.animate(rainbowAnim);}
|
||||||
candle.animate(rainbowAnim);}
|
|
||||||
public void RainBowStop(){candle.animate(null);}
|
public void RainBowStop(){candle.animate(null);}
|
||||||
@Override
|
@Override
|
||||||
public void periodic() {
|
public void periodic() {
|
||||||
|
37
src/main/java/frc/robot/subsystems/Elevateur.java
Normal file
37
src/main/java/frc/robot/subsystems/Elevateur.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// 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.subsystems;
|
||||||
|
|
||||||
|
import edu.wpi.first.networktables.GenericEntry;
|
||||||
|
import edu.wpi.first.wpilibj.DigitalInput;
|
||||||
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
import com.revrobotics.spark.SparkMax;
|
||||||
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||||
|
public class Elevateur extends SubsystemBase {
|
||||||
|
/** Creates a new Elevateur. */
|
||||||
|
public Elevateur() {}
|
||||||
|
final SparkMax monte = new SparkMax(22, MotorType.kBrushless);
|
||||||
|
final DigitalInput limit2 = new DigitalInput(1);
|
||||||
|
GenericEntry teb = Shuffleboard.getTab("teb")
|
||||||
|
.add("elevateur encodeur",position())
|
||||||
|
.getEntry();
|
||||||
|
public double position(){
|
||||||
|
return monte.getEncoder().getPosition();
|
||||||
|
}
|
||||||
|
public void vitesse(double vitesse){
|
||||||
|
monte.set(vitesse);
|
||||||
|
}
|
||||||
|
public boolean limit2(){
|
||||||
|
return limit2.get();
|
||||||
|
}
|
||||||
|
public void reset(){
|
||||||
|
monte.getEncoder().setPosition(0);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void periodic() {
|
||||||
|
// This method will be called once per scheduler run
|
||||||
|
}
|
||||||
|
}
|
61
src/main/java/frc/robot/subsystems/Pince.java
Normal file
61
src/main/java/frc/robot/subsystems/Pince.java
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// 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.subsystems;
|
||||||
|
|
||||||
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||||
|
import com.revrobotics.spark.SparkMax;
|
||||||
|
|
||||||
|
import edu.wpi.first.networktables.GenericEntry;
|
||||||
|
import edu.wpi.first.wpilibj.DigitalInput;
|
||||||
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
|
||||||
|
public class Pince extends SubsystemBase {
|
||||||
|
/** Creates a new Pince. */
|
||||||
|
public Pince() {}
|
||||||
|
final SparkMax coral = new SparkMax(20, MotorType.kBrushless);
|
||||||
|
final SparkMax pivoti = new SparkMax(14, MotorType.kBrushless);
|
||||||
|
final SparkMax algue1 = new SparkMax(16, MotorType.kBrushless);
|
||||||
|
final SparkMax algue2 = new SparkMax(19, MotorType.kBrushless);
|
||||||
|
final DigitalInput limit6 = new DigitalInput(0);
|
||||||
|
GenericEntry teb = Shuffleboard.getTab("teb")
|
||||||
|
.add("pince encodeur",encodeurpivot())
|
||||||
|
.getEntry();
|
||||||
|
public void aspirecoral(double vitesse){
|
||||||
|
coral.set(vitesse);
|
||||||
|
}
|
||||||
|
public void pivote(double vitesse){
|
||||||
|
pivoti.set(vitesse);
|
||||||
|
}
|
||||||
|
public void aspirealgue(double vitesse){
|
||||||
|
algue2.set(vitesse);
|
||||||
|
algue1.set(-vitesse);
|
||||||
|
}
|
||||||
|
public double encodeurpivot(){
|
||||||
|
return pivoti.getEncoder().getPosition();
|
||||||
|
}
|
||||||
|
public boolean position(){
|
||||||
|
return limit6.get();
|
||||||
|
}
|
||||||
|
public void reset(){
|
||||||
|
pivoti.getEncoder().setPosition(0);
|
||||||
|
}
|
||||||
|
public double emperagecoral(){
|
||||||
|
return coral.getOutputCurrent();
|
||||||
|
}
|
||||||
|
public double emperagealgue(){
|
||||||
|
return algue1.getOutputCurrent();
|
||||||
|
}
|
||||||
|
public void algue1Test(double vitesse){
|
||||||
|
algue1.set(vitesse);
|
||||||
|
}
|
||||||
|
public void algue2Test(double vitesse){
|
||||||
|
algue2.set(vitesse);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void periodic() {
|
||||||
|
// This method will be called once per scheduler run
|
||||||
|
}
|
||||||
|
}
|
@ -1,48 +0,0 @@
|
|||||||
// 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.subsystems;
|
|
||||||
|
|
||||||
import com.revrobotics.spark.SparkFlex;
|
|
||||||
import com.revrobotics.spark.SparkMax;
|
|
||||||
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
|
||||||
import edu.wpi.first.wpilibj.DigitalInput;
|
|
||||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
|
||||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
|
||||||
|
|
||||||
public class Requin extends SubsystemBase {
|
|
||||||
/** Creates a new Requin. */
|
|
||||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
|
||||||
public Requin() {
|
|
||||||
teb.addBoolean("limit requin", this::enHaut);
|
|
||||||
}
|
|
||||||
|
|
||||||
final SparkFlex balaye = new SparkFlex(15, MotorType.kBrushless);
|
|
||||||
final SparkMax rotatione = new SparkMax(17, MotorType.kBrushless);
|
|
||||||
final DigitalInput limit3 = new DigitalInput(1);
|
|
||||||
|
|
||||||
public void balaye(double vitesse){
|
|
||||||
balaye.set(vitesse);
|
|
||||||
}
|
|
||||||
public void rotationer(double vitesse){
|
|
||||||
rotatione.set(vitesse);
|
|
||||||
}
|
|
||||||
public boolean enHaut(){
|
|
||||||
return limit3.get();
|
|
||||||
}
|
|
||||||
public double encodeur(){
|
|
||||||
return rotatione.getEncoder().getPosition();
|
|
||||||
}
|
|
||||||
public void reset(){
|
|
||||||
rotatione.getEncoder().setPosition(0);
|
|
||||||
}
|
|
||||||
public double amp(){
|
|
||||||
return balaye.getOutputCurrent();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void periodic() {
|
|
||||||
// This method will be called once per scheduler run
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user