led
This commit is contained in:
@@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "2025.0",
|
|
||||||
"command": {
|
|
||||||
"type": "sequential",
|
|
||||||
"data": {
|
|
||||||
"commands": [
|
|
||||||
{
|
|
||||||
"type": "path",
|
|
||||||
"data": {
|
|
||||||
"pathName": "TirerSimple"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "named",
|
|
||||||
"data": {
|
|
||||||
"name": "DescendreBalayeuse"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "named",
|
|
||||||
"data": {
|
|
||||||
"name": "Limelighter"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "named",
|
|
||||||
"data": {
|
|
||||||
"name": "Lancer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"resetOdom": true,
|
|
||||||
"folder": null,
|
|
||||||
"choreoAuto": false
|
|
||||||
}
|
|
||||||
@@ -4,49 +4,18 @@
|
|||||||
"type": "sequential",
|
"type": "sequential",
|
||||||
"data": {
|
"data": {
|
||||||
"commands": [
|
"commands": [
|
||||||
|
{
|
||||||
|
"type": "path",
|
||||||
|
"data": {
|
||||||
|
"pathName": "tirgrimpe1"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "named",
|
"type": "named",
|
||||||
"data": {
|
"data": {
|
||||||
"name": "DescendreBalayeuse"
|
"name": "DescendreBalayeuse"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "deadline",
|
|
||||||
"data": {
|
|
||||||
"commands": [
|
|
||||||
{
|
|
||||||
"type": "wait",
|
|
||||||
"data": {
|
|
||||||
"waitTime": 3.0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "path",
|
|
||||||
"data": {
|
|
||||||
"pathName": "Depot"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "named",
|
|
||||||
"data": {
|
|
||||||
"name": "Aspirer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "path",
|
|
||||||
"data": {
|
|
||||||
"pathName": "Tir"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "named",
|
|
||||||
"data": {
|
|
||||||
"name": "Limelighter"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "deadline",
|
"type": "deadline",
|
||||||
"data": {
|
"data": {
|
||||||
@@ -66,12 +35,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "path",
|
|
||||||
"data": {
|
|
||||||
"pathName": "GrimperReservoir"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "named",
|
"type": "named",
|
||||||
"data": {
|
"data": {
|
||||||
54
src/main/deploy/pathplanner/paths/tirgrimpe1.path
Normal file
54
src/main/deploy/pathplanner/paths/tirgrimpe1.path
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"version": "2025.0",
|
||||||
|
"waypoints": [
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 3.5991440798858774,
|
||||||
|
"y": 2.3465049928673327
|
||||||
|
},
|
||||||
|
"prevControl": null,
|
||||||
|
"nextControl": {
|
||||||
|
"x": 2.589928673323822,
|
||||||
|
"y": 1.7513266761768898
|
||||||
|
},
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 1.8783024251069897,
|
||||||
|
"y": 2.3465049928673327
|
||||||
|
},
|
||||||
|
"prevControl": {
|
||||||
|
"x": 2.706376604850214,
|
||||||
|
"y": 1.7125106990014274
|
||||||
|
},
|
||||||
|
"nextControl": null,
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rotationTargets": [],
|
||||||
|
"constraintZones": [],
|
||||||
|
"pointTowardsZones": [],
|
||||||
|
"eventMarkers": [],
|
||||||
|
"globalConstraints": {
|
||||||
|
"maxVelocity": 3.0,
|
||||||
|
"maxAcceleration": 3.0,
|
||||||
|
"maxAngularVelocity": 540.0,
|
||||||
|
"maxAngularAcceleration": 720.0,
|
||||||
|
"nominalVoltage": 12.0,
|
||||||
|
"unlimited": false
|
||||||
|
},
|
||||||
|
"goalEndState": {
|
||||||
|
"velocity": 0,
|
||||||
|
"rotation": 33.11134196037204
|
||||||
|
},
|
||||||
|
"reversed": false,
|
||||||
|
"folder": null,
|
||||||
|
"idealStartingState": {
|
||||||
|
"velocity": 0,
|
||||||
|
"rotation": 180.0
|
||||||
|
},
|
||||||
|
"useDefaultConstraints": true
|
||||||
|
}
|
||||||
@@ -24,18 +24,21 @@ public class DescendreGrimpeur extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
if(!grimpeur.Limit()){
|
if(!grimpeur.Limit()){
|
||||||
grimpeur.Grimper(-0.4);
|
grimpeur.GrimperGauche(-0.4);
|
||||||
|
grimpeur.GrimperDroit(-0.4);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
grimpeur.Reset();
|
grimpeur.Reset();
|
||||||
grimpeur.Grimper(0);
|
grimpeur.GrimperGauche(0);
|
||||||
|
grimpeur.GrimperDroit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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) {
|
||||||
grimpeur.Grimper(0);
|
grimpeur.GrimperGauche(0);
|
||||||
|
grimpeur.GrimperDroit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
||||||
|
|||||||
@@ -25,18 +25,21 @@ public class MonterGrimpeur extends Command {
|
|||||||
public void execute() {
|
public void execute() {
|
||||||
|
|
||||||
if(Math.abs(grimpeur.Position()) < grimpeur.PositionFinal()){
|
if(Math.abs(grimpeur.Position()) < grimpeur.PositionFinal()){
|
||||||
grimpeur.Grimper(0.5);
|
grimpeur.GrimperGauche(0.5);
|
||||||
|
grimpeur.GrimperDroit(0.5);
|
||||||
System.out.println("monte");
|
System.out.println("monte");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
grimpeur.Grimper(0);
|
grimpeur.GrimperGauche(0);
|
||||||
|
grimpeur.GrimperDroit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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) {
|
||||||
grimpeur.Grimper(0);
|
grimpeur.GrimperGauche(0);
|
||||||
|
grimpeur.GrimperDroit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
||||||
|
|||||||
@@ -22,9 +22,11 @@ public class Grimpeur extends SubsystemBase {
|
|||||||
DigitalInput limit = new DigitalInput(0);
|
DigitalInput limit = new DigitalInput(0);
|
||||||
private GenericEntry EncodeurGrimpeur =
|
private GenericEntry EncodeurGrimpeur =
|
||||||
teb.add("Position haut grimpeur", 100).getEntry();
|
teb.add("Position haut grimpeur", 100).getEntry();
|
||||||
public void Grimper(double vitesse){
|
public void GrimperDroit(double vitesse){
|
||||||
grimpeur1.set(vitesse);
|
|
||||||
grimpeur2.set(vitesse);
|
grimpeur2.set(vitesse);
|
||||||
|
}
|
||||||
|
public void GrimperGauche(double vitesse){
|
||||||
|
grimpeur1.set(vitesse);
|
||||||
}
|
}
|
||||||
public double Position(){
|
public double Position(){
|
||||||
return grimpeur1.getEncoder().getPosition();
|
return grimpeur1.getEncoder().getPosition();
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.ctre.phoenix6.signals.RGBWColor;
|
|||||||
*/
|
*/
|
||||||
public class LEDSubsystem extends SubsystemBase {
|
public class LEDSubsystem extends SubsystemBase {
|
||||||
Timer _timer;
|
Timer _timer;
|
||||||
|
boolean q = true;
|
||||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||||
private GenericEntry equipe =
|
private GenericEntry equipe =
|
||||||
teb.add("equipe commence (bleu = ouvert, rouge = fermé)", true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
teb.add("equipe commence (bleu = ouvert, rouge = fermé)", true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||||
@@ -39,7 +40,8 @@ public class LEDSubsystem extends SubsystemBase {
|
|||||||
m_candle.setControl(new SolidColor(0, 80).withColor(new RGBWColor(0, 0, 0, 0)));
|
m_candle.setControl(new SolidColor(0, 80).withColor(new RGBWColor(0, 0, 0, 0)));
|
||||||
}
|
}
|
||||||
public void Flash(boolean couleur){
|
public void Flash(boolean couleur){
|
||||||
if(_timer.get() <0.5){
|
Timer timer = new Timer();
|
||||||
|
if(timer.get() <0.5){
|
||||||
if(couleur){
|
if(couleur){
|
||||||
Bleu();
|
Bleu();
|
||||||
}
|
}
|
||||||
@@ -49,13 +51,12 @@ public class LEDSubsystem extends SubsystemBase {
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Noir();
|
Noir();
|
||||||
_timer.reset();
|
timer.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public LEDSubsystem() {
|
public LEDSubsystem() {
|
||||||
setDefaultCommand(updateLEDs());
|
setDefaultCommand(updateLEDs());
|
||||||
_timer = new Timer();
|
_timer = new Timer();
|
||||||
_timer.reset();
|
|
||||||
_timer.start();
|
_timer.start();
|
||||||
}
|
}
|
||||||
public boolean Equipe(){
|
public boolean Equipe(){
|
||||||
@@ -67,39 +68,43 @@ public class LEDSubsystem extends SubsystemBase {
|
|||||||
* @return Command to run
|
* @return Command to run
|
||||||
*/
|
*/
|
||||||
public Command updateLEDs() {
|
public Command updateLEDs() {
|
||||||
double temps = DriverStation.getMatchTime();
|
|
||||||
System.out.println(temps);
|
|
||||||
return run(() -> {
|
return run(() -> {
|
||||||
|
// if(q){
|
||||||
|
// _timer.reset();
|
||||||
|
// q = false;
|
||||||
|
// }
|
||||||
|
double temps = _timer.get();
|
||||||
|
System.out.println(temps);
|
||||||
if(Equipe()){
|
if(Equipe()){
|
||||||
if(temps > 110){
|
if(temps > 30){
|
||||||
Vert();
|
Vert();
|
||||||
}
|
}
|
||||||
else if(temps > 88){
|
else if(temps > 52){
|
||||||
|
|
||||||
Bleu();
|
Bleu();
|
||||||
}
|
}
|
||||||
else if(temps > 85){
|
else if(temps > 55){
|
||||||
Flash(true);
|
Flash(true);
|
||||||
}
|
}
|
||||||
else if(temps > 63){
|
else if(temps > 67){
|
||||||
Rouge();
|
Rouge();
|
||||||
}
|
}
|
||||||
else if(temps > 60){
|
else if(temps > 70){
|
||||||
Flash(false);
|
Flash(false);
|
||||||
}
|
}
|
||||||
else if(temps > 33){
|
else if(temps > 103){
|
||||||
Bleu();
|
Bleu();
|
||||||
}
|
}
|
||||||
else if(temps > 30){
|
else if(temps > 105){
|
||||||
Flash(true);
|
Flash(true);
|
||||||
}
|
}
|
||||||
else if(temps > 13){
|
else if(temps > 127){
|
||||||
Rouge();
|
Rouge();
|
||||||
}
|
}
|
||||||
else if(temps > 10){
|
else if(temps > 130){
|
||||||
Flash(false);
|
Flash(false);
|
||||||
}
|
}
|
||||||
else if(temps < 10){
|
else if(temps < 140){
|
||||||
Vert();
|
Vert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,6 +141,8 @@ public class LEDSubsystem extends SubsystemBase {
|
|||||||
Vert();
|
Vert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// _timer.stop();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user