Compare commits

..

45 Commits

Author SHA1 Message Date
Antoine PerreaultE
a11f31a2a8 Merge branch 'pince' of https://git.demerso.net/PLS5618/Reefscape-2025 2025-02-24 19:57:40 -05:00
Antoine PerreaultE
9f83b61c46 manuel 2025-02-24 19:52:02 -05:00
Antoine PerreaultE
5d84d83f7d k 2025-02-24 19:13:12 -05:00
Antoine PerreaultE
87c3abcb65 encodeurs 2025-02-24 18:18:14 -05:00
Antoine PerreaultE
93e5bb0b46 pince mieux 2025-02-24 18:15:32 -05:00
Antoine PerreaultE
7be5f8c2fc pince 2025-02-22 14:46:41 -05:00
Antoine PerreaultE
26d32e3707 amperage 2025-02-22 12:48:56 -05:00
Antoine PerreaultE
1f4111ef6d id 2025-02-22 11:41:37 -05:00
Antoine PerreaultE
bb9d5a5550 touche 2025-02-22 10:30:20 -05:00
Antoine PerreaultE
69ef6b6982 pince mieux 2025-02-22 09:55:55 -05:00
Antoine PerreaultE
0be9356fa9 code mieux 2025-02-20 20:25:59 -05:00
Antoine PerreaultE
1627770572 code mieux 2025-02-20 20:17:00 -05:00
Antoine PerreaultE
c1bdf0aab7 modif 2025-02-12 16:54:47 -05:00
Antoine PerreaultE
0e04704942 leds pince 2025-02-11 19:22:25 -05:00
Antoine PerreaultE
53adcf5701 Bougie finie 2025-02-10 19:53:34 -05:00
Antoine PerreaultE
319c370c6e Bougie(pas fini) 2025-02-10 19:49:13 -05:00
Antoine PerreaultE
451d3c6e20 command -> commands 2025-02-06 17:50:24 -05:00
Antoine PerreaultE
2260580c81 marche mieux 2025-02-03 18:37:36 -05:00
Antoine PerreaultE
9cd08cf07c 2025-02-03 18:32:34 -05:00
Antoine PerreaultE
8aca411a23 id 2025-02-03 18:26:54 -05:00
Antoine PerreaultE
44f6030e99 simulation fait 2025-02-03 18:19:29 -05:00
Antoine PerreaultE
6f75b9cc42 id 2025-02-03 17:51:57 -05:00
Antoine PerreaultE
210d219793 simulation 2025-02-03 17:49:34 -05:00
Antoine PerreaultE
06abfa4dbb Named Commands 2025-01-30 20:18:15 -05:00
Antoine PerreaultE
26a4b9f9a3 touche 2025-01-29 20:15:07 -05:00
Antoine PerreaultE
b384585224 pince mieux 2025-01-29 20:13:38 -05:00
Antoine PerreaultE
ee2c9ff4b2 manette 2025-01-29 19:37:35 -05:00
Antoine PerreaultE
20c95efe93 2025-01-29 19:35:13 -05:00
Antoine PerreaultE
4869632d6d manette pince elevateur 2025-01-29 19:29:01 -05:00
Antoine PerreaultE
afaec61f6d touche pince+elevateur 2025-01-29 19:19:14 -05:00
Antoine PerreaultE
126058e9d4 touche 2025-01-29 19:01:51 -05:00
Antoine PerreaultE
1f17aaf4de pince+elevateur 2025-01-29 18:55:06 -05:00
Antoine PerreaultE
eece0f47fa pince et elevateur 2025-01-29 18:43:31 -05:00
Antoine PerreaultE
c81f118058 Merge branch 'elevateur' into pince 2025-01-29 18:42:45 -05:00
Antoine PerreaultE
7848c4aaf2 debug 2025-01-29 18:12:14 -05:00
Antoine PerreaultE
1d1d6e962d pince 2025-01-28 19:19:34 -05:00
Antoine PerreaultE
d6420659e9 2025-01-28 19:10:42 -05:00
Antoine PerreaultE
aafb2a62b5 Algue 2025-01-28 19:09:16 -05:00
Antoine PerreaultE
0fdfa4269d elevateurise mieux 2025-01-28 18:54:42 -05:00
Antoine PerreaultE
017f168b3c Pince 2025-01-28 18:46:42 -05:00
Antoine PerreaultE
5ffa28596c aspire 2025-01-28 18:24:21 -05:00
Antoine PerreaultE
e7b4b47928 elevateur 2025-01-27 19:51:46 -05:00
Antoine PerreaultE
0577ce368a positon 2025-01-27 19:26:11 -05:00
Antoine PerreaultE
7521c0d94e elevateur 2025-01-27 19:15:16 -05:00
Antoine PerreaultE
b16d11b70a elevateur 2025-01-27 19:11:22 -05:00
23 changed files with 979 additions and 32 deletions

View File

@ -1,4 +1,9 @@
{
"Joysticks": {
"window": {
"visible": false
}
},
"System Joysticks": {
"window": {
"enabled": false

View File

@ -102,4 +102,4 @@ public class RobotContainer {
}),autoChooser.getSelected(), new RainBow(bougie));
}
}
}

View 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.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 Algue1Test extends Command {
private Pince pince;
/** Creates a new AlgueTest. */
public Algue1Test(Pince pince) {
this.pince = pince;
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.algue1Test(0.2);
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
pince.algue1Test(0);
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View 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.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 Algue2Test extends Command {
private Pince pince;
/** Creates a new AlgueTest. */
public Algue2Test(Pince pince) {
this.pince = pince;
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.algue2Test(0.2);
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
pince.algue2Test(0);
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View 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;
}
}

View File

@ -0,0 +1,42 @@
// 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 CorailAspir extends Command {
/** Creates a new CorailAspir. */
private Pince pince;
public CorailAspir(Pince pince) {
// Use addRequirements() here to declare subsystem dependencies.
this.pince = pince;
addRequirements(pince);
}
// 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(0.5);
}
// 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;
}
}

View 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.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 CorailTest extends Command {
private Pince pince;
/** Creates a new AlgueTest. */
public CorailTest(Pince pince) {
this.pince = pince;
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.aspirecoral(0.2);
}
// 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;
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}

View 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 DepartPince extends Command {
private Pince pince;
/** Creates a new DepartPince. */
public DepartPince(Pince pince) {
this.pince = pince;
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() {
if(pince.position()==true){
pince.pivote(0);
pince.reset();
}
else{
pince.pivote(.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;
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}

View 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 L4 extends Command {
private Elevateur elevateur;
private Pince pince;
/** Creates a new L2. */
public L4(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()>=800 && elevateur.position()<=809){
elevateur.vitesse(0);
}
else if(elevateur.position()>=810){
elevateur.vitesse(0.5);
}
else{
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.
@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;
}
}

View 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 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 PinceManuel extends Command {
private Pince pince;
/** Creates a new PinceManuel. */
public PinceManuel(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() {
// if(pince.position()){
// pince.pivote(0);
// }
// else{
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;
}
}

View 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;
}
}

View File

@ -0,0 +1,64 @@
// 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 StationPince extends Command {
private Pince pince;
private Elevateur elevateur;
/** Creates a new L2Pince. */
public StationPince(Pince pince,Elevateur elevateur) {
this.elevateur = elevateur;
this.pince = pince;
addRequirements(pince,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() {
pince.aspirecoral(0.5);
if(pince.encodeurpivot()>=900 && pince.encodeurpivot()<=910){
pince.pivote(0);
}
else if(pince.encodeurpivot()>=910){
pince.pivote(0.2);
}
else{
pince.pivote(-0.2);
}
if(elevateur.position()>=400 && elevateur.position()<=410){
elevateur.vitesse(0);
}
else if(elevateur.position()>=410){
elevateur.vitesse(0.3);
}
else{
elevateur.vitesse(-.3);
}
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
pince.pivote(0);
pince.aspirecoral(0);
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View 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;
}
}

View File

@ -11,7 +11,7 @@ import com.ctre.phoenix.led.RainbowAnimation;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Bougie extends SubsystemBase {
CANdle candle = new CANdle(5);
CANdle candle = new CANdle(23);
CANdleConfiguration config = new CANdleConfiguration();
RainbowAnimation rainbowAnim = new RainbowAnimation(1, 0.5, 64);
/** Creates a new Bougie. */
@ -20,14 +20,29 @@ public class Bougie extends SubsystemBase {
candle.configAllSettings(config);
}
public void Rouge() {
candle.setLEDs(255, 0, 0);
candle.setLEDs(255, 0, 0,0,8,8);
candle.setLEDs(255, 0, 0,0,24,8);
candle.setLEDs(255, 0, 0,0,40,8);
candle.setLEDs(255, 0, 0,0,56,8);
}
public void Vert() {
candle.setLEDs(0, 255, 0);
candle.setLEDs(0, 255, 0,0,8,8);
candle.setLEDs(0, 255, 0,0,24,8);
candle.setLEDs(0, 255, 0,0,40,8);
candle.setLEDs(0, 255, 0,0,56,8);
}
public void Bleu() {
candle.setLEDs(0, 0, 255);
candle.setLEDs(0, 0, 255,0,16,8);
candle.setLEDs(0, 0, 255,0,32,8);
candle.setLEDs(0, 0, 255,0,48,8);
candle.setLEDs(0, 0, 255,0,64,8);
}
public void Jaune() {
candle.setLEDs(255, 215, 0,0,16,8);
candle.setLEDs(255, 215, 0,0,32,8);
candle.setLEDs(255, 215, 0,0,48,8);
candle.setLEDs(255, 215, 0,0,64,8);
}
public void RainBow(){candle.animate(rainbowAnim);}
public void RainBowStop(){candle.animate(null);}
@Override
@ -35,4 +50,3 @@ public class Bougie extends SubsystemBase {
// This method will be called once per scheduler run
}
}

View 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
}
}

View File

@ -1,26 +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 edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.motorcontrol.Spark;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Grimpeur extends SubsystemBase {
/** Creates a new Grimpeur. */
public Grimpeur() {}
final Spark grimpeur = new Spark(0);
final DigitalInput limit1 = new DigitalInput(0);
public void grimpe(double vitesse){
grimpeur.set(vitesse);
}
final void stop(){
limit1.get();
}
@Override
public void periodic() {
// This method will be called once per scheduler run
}
}

View 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
}
}