Compare commits
2 Commits
098f16665a
...
ae9a6bd046
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae9a6bd046 | ||
|
|
10b0110315 |
@@ -0,0 +1,99 @@
|
|||||||
|
{
|
||||||
|
"version": "2025.0",
|
||||||
|
"command": {
|
||||||
|
"type": "sequential",
|
||||||
|
"data": {
|
||||||
|
"commands": [
|
||||||
|
{
|
||||||
|
"type": "named",
|
||||||
|
"data": {
|
||||||
|
"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": "deadline",
|
||||||
|
"data": {
|
||||||
|
"commands": [
|
||||||
|
{
|
||||||
|
"type": "named",
|
||||||
|
"data": {
|
||||||
|
"name": "Lancer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "named",
|
||||||
|
"data": {
|
||||||
|
"name": "Aspirer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "path",
|
||||||
|
"data": {
|
||||||
|
"pathName": "GrimperReservoir"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "named",
|
||||||
|
"data": {
|
||||||
|
"name": "GrimperReservoir"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "named",
|
||||||
|
"data": {
|
||||||
|
"name": "MonterGrimpeur"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "path",
|
||||||
|
"data": {
|
||||||
|
"pathName": "MonterReservoir"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "named",
|
||||||
|
"data": {
|
||||||
|
"name": "DescendreGrimpeur"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resetOdom": true,
|
||||||
|
"folder": null,
|
||||||
|
"choreoAuto": false
|
||||||
|
}
|
||||||
@@ -14,6 +14,12 @@
|
|||||||
"type": "deadline",
|
"type": "deadline",
|
||||||
"data": {
|
"data": {
|
||||||
"commands": [
|
"commands": [
|
||||||
|
{
|
||||||
|
"type": "wait",
|
||||||
|
"data": {
|
||||||
|
"waitTime": 3.0
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"data": {
|
"data": {
|
||||||
|
|||||||
@@ -14,6 +14,12 @@
|
|||||||
"type": "deadline",
|
"type": "deadline",
|
||||||
"data": {
|
"data": {
|
||||||
"commands": [
|
"commands": [
|
||||||
|
{
|
||||||
|
"type": "wait",
|
||||||
|
"data": {
|
||||||
|
"waitTime": 3.0
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"data": {
|
"data": {
|
||||||
|
|||||||
@@ -3,25 +3,25 @@
|
|||||||
"waypoints": [
|
"waypoints": [
|
||||||
{
|
{
|
||||||
"anchor": {
|
"anchor": {
|
||||||
"x": 1.0502282453637657,
|
"x": 1.0,
|
||||||
"y": 2.4758915834522113
|
"y": 2.6
|
||||||
},
|
},
|
||||||
"prevControl": null,
|
"prevControl": null,
|
||||||
"nextControl": {
|
"nextControl": {
|
||||||
"x": 1.0408884389937225,
|
"x": 0.9906601936299568,
|
||||||
"y": 2.742159765250622
|
"y": 2.866268181798411
|
||||||
},
|
},
|
||||||
"isLocked": false,
|
"isLocked": false,
|
||||||
"linkedName": null
|
"linkedName": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"anchor": {
|
"anchor": {
|
||||||
"x": 1.0502282453637657,
|
"x": 1.0,
|
||||||
"y": 2.7734807417974334
|
"y": 2.9
|
||||||
},
|
},
|
||||||
"prevControl": {
|
"prevControl": {
|
||||||
"x": 1.0547546338516156,
|
"x": 1.00452638848785,
|
||||||
"y": 2.523521721541598
|
"y": 2.6500409797441646
|
||||||
},
|
},
|
||||||
"nextControl": null,
|
"nextControl": null,
|
||||||
"isLocked": false,
|
"isLocked": false,
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ public class RobotContainer {
|
|||||||
manette1.b().whileTrue(new ModeOposer(lanceur));
|
manette1.b().whileTrue(new ModeOposer(lanceur));
|
||||||
manette1.a().whileTrue(new ModeOposerDemeleur(lanceur));
|
manette1.a().whileTrue(new ModeOposerDemeleur(lanceur));
|
||||||
manette1.y().whileTrue(new ModeOposerBalayeuse(balayeuse));
|
manette1.y().whileTrue(new ModeOposerBalayeuse(balayeuse));
|
||||||
|
manette1.povUp().whileTrue(new LancerAuto(lanceur, limeLight3G));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command getAutonomousCommand() {
|
public Command getAutonomousCommand() {
|
||||||
|
|||||||
@@ -69,47 +69,32 @@ public class Limelighter extends Command {
|
|||||||
boty = BotPose[0];
|
boty = BotPose[0];
|
||||||
angle = drivetrain.getPigeon2().getYaw().getValueAsDouble();
|
angle = drivetrain.getPigeon2().getYaw().getValueAsDouble();
|
||||||
calcul = limelight3g.Calcule(botx, x, boty, 4, angle);
|
calcul = limelight3g.Calcule(botx, x, boty, 4, angle);
|
||||||
if(angle > 180){
|
if(calcul < -5 && calcul > -180){
|
||||||
angle -= 360;
|
|
||||||
}
|
|
||||||
if(calcul > -5 && calcul < 5){
|
|
||||||
drivetrain.setControl(
|
|
||||||
drive.withRotationalRate(0));
|
|
||||||
}
|
|
||||||
else if(calcul > 5){
|
|
||||||
drivetrain.setControl(
|
drivetrain.setControl(
|
||||||
drive.withRotationalRate(-0.5*(2*Math.PI)));
|
drive.withRotationalRate(0.5*(2*Math.PI)));
|
||||||
|
}
|
||||||
|
else if(calcul > 5 && calcul < 180){
|
||||||
|
drivetrain.setControl(
|
||||||
|
drive.withRotationalRate(-0.5*(2*Math.PI)));
|
||||||
}
|
}
|
||||||
else if(calcul < -5){
|
else if(calcul < -5){
|
||||||
drivetrain.setControl(
|
drivetrain.setControl(
|
||||||
drive.withRotationalRate(-0.5*(2*Math.PI)));
|
drive.withRotationalRate(-0.5*(2*Math.PI)));
|
||||||
|
}
|
||||||
|
else if(calcul <= -180){
|
||||||
|
drivetrain.setControl(
|
||||||
|
drive.withRotationalRate(0.5*(2*Math.PI)));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
drivetrain.setControl(
|
||||||
|
drive.withRotationalRate(0));
|
||||||
|
}
|
||||||
|
drivetrain.setControl(
|
||||||
|
drive.withVelocityX(0).withVelocityY(0).withRotationalRate(calcul));
|
||||||
|
System.out.println(angle);
|
||||||
|
if (calcul < 0.2 && calcul > -0.2) {
|
||||||
|
drivetrain.setControl(drive.withRotationalRate(0));
|
||||||
}
|
}
|
||||||
// if(calcul < -5 && calcul > -180){
|
|
||||||
// drivetrain.setControl(
|
|
||||||
// drive.withRotationalRate(0.5*(2*Math.PI)));
|
|
||||||
// }
|
|
||||||
// else if(calcul > 5 && calcul < 180){
|
|
||||||
// drivetrain.setControl(
|
|
||||||
// drive.withRotationalRate(-0.5*(2*Math.PI)));
|
|
||||||
// }
|
|
||||||
// else if(calcul >= 180){
|
|
||||||
// drivetrain.setControl(
|
|
||||||
// drive.withRotationalRate(-0.5*(2*Math.PI)));
|
|
||||||
// }
|
|
||||||
// else if(calcul <= -180){
|
|
||||||
// drivetrain.setControl(
|
|
||||||
// drive.withRotationalRate(0.5*(2*Math.PI)));
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// drivetrain.setControl(
|
|
||||||
// drive.withRotationalRate(0));
|
|
||||||
// }
|
|
||||||
// drivetrain.setControl(
|
|
||||||
// drive.withVelocityX(0).withVelocityY(0).withRotationalRate(calcul));
|
|
||||||
// System.out.println(angle);
|
|
||||||
// if (calcul < 0.2 && calcul > -0.2) {
|
|
||||||
// drivetrain.setControl(drive.withRotationalRate(0));
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
drivetrain.setControl(drive.withRotationalRate(0));
|
drivetrain.setControl(drive.withRotationalRate(0));
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class GrimperMur extends Command {
|
|||||||
angle = angle + 360;
|
angle = angle + 360;
|
||||||
}
|
}
|
||||||
if(alliance.get() == Alliance.Blue){
|
if(alliance.get() == Alliance.Blue){
|
||||||
y = 2.961328;
|
y = 5;
|
||||||
x = 1.11;
|
x = 1.11;
|
||||||
angle = 0;
|
angle = 0;
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 350 || drivetrain.getPigeon2().getYaw().getValueAsDouble() < 10){
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 350 || drivetrain.getPigeon2().getYaw().getValueAsDouble() < 10){
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.ctre.phoenix6.hardware.Pigeon2;
|
|||||||
import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType;
|
import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType;
|
||||||
import com.ctre.phoenix6.swerve.SwerveRequest;
|
import com.ctre.phoenix6.swerve.SwerveRequest;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.MathUtil;
|
||||||
import edu.wpi.first.wpilibj.DriverStation;
|
import edu.wpi.first.wpilibj.DriverStation;
|
||||||
import edu.wpi.first.wpilibj.DriverStation.Alliance;
|
import edu.wpi.first.wpilibj.DriverStation.Alliance;
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
@@ -54,46 +55,53 @@ public class GrimperReservoir 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() {
|
||||||
BotPose = limeLight3G.getBotPoseBlue();
|
if(limeLight3G.getV()){
|
||||||
botx = BotPose[0];
|
|
||||||
boty = BotPose[1];
|
BotPose = limeLight3G.getBotPoseBlue();
|
||||||
System.out.println(drivetrain.getPigeon2().getYaw().getValueAsDouble());
|
botx = BotPose[0];
|
||||||
if(angle < 0){
|
boty = BotPose[1];
|
||||||
angle = angle + 360;
|
System.out.println(drivetrain.getPigeon2().getYaw().getValueAsDouble());
|
||||||
}
|
if(angle < 0){
|
||||||
if(alliance.get() == Alliance.Red){
|
angle = angle + 360;
|
||||||
y = 6.959326;
|
}
|
||||||
x = 13.57966;
|
if(alliance.get() == Alliance.Red){
|
||||||
angle = 180;
|
y = 6.959326;
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() < 190 && drivetrain.getPigeon2().getYaw().getValueAsDouble() > 170){
|
x = 13.57966;
|
||||||
drivetrain.setControl(drive.withVelocityY(y-boty).withVelocityX(x-botx));
|
angle = 180;
|
||||||
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() < 190 && drivetrain.getPigeon2().getYaw().getValueAsDouble() > 170){
|
||||||
|
drivetrain.setControl(drive.withVelocityY(MathUtil.clamp(((y-boty)*5), -2, 2)).withVelocityX(MathUtil.clamp(((x-botx)*5),-2,2)));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
||||||
|
drivetrain.setControl(drive.withRotationalRate(1));
|
||||||
|
}
|
||||||
|
else if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >180){
|
||||||
|
drivetrain.setControl(drive.withRotationalRate(-1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
y = 2.6;
|
||||||
|
x = 1.11;
|
||||||
|
angle = 0;
|
||||||
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 358 || drivetrain.getPigeon2().getYaw().getValueAsDouble() < 2){
|
||||||
|
drivetrain.setControl(drive.withVelocityY(MathUtil.clamp(((y-boty)*5), -2, 2)).withVelocityX(MathUtil.clamp(((x-botx)*5),-2,2)).withRotationalRate(0));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
||||||
|
drivetrain.setControl(drive.withRotationalRate(-1));
|
||||||
|
System.out.println("x");
|
||||||
|
}
|
||||||
|
else if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >180){
|
||||||
|
System.out.println("e");
|
||||||
|
drivetrain.setControl(drive.withRotationalRate(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
drivetrain.setControl(drive.withVelocityX(0).withVelocityY(0).withRotationalRate(0));
|
||||||
drivetrain.setControl(drive.withRotationalRate(0.5*180/Math.PI));
|
|
||||||
}
|
|
||||||
else if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >180){
|
|
||||||
drivetrain.setControl(drive.withRotationalRate(-0.5*180/Math.PI));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else{
|
|
||||||
y = 5.081328;
|
|
||||||
x = 1.11;
|
|
||||||
angle = 0;
|
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > 350 || drivetrain.getPigeon2().getYaw().getValueAsDouble() < 10){
|
|
||||||
drivetrain.setControl(drive.withVelocityY(y-boty).withVelocityX(x-botx));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
|
||||||
drivetrain.setControl(drive.withRotationalRate(-0.5*180/Math.PI));
|
|
||||||
}
|
|
||||||
else if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >180){
|
|
||||||
drivetrain.setControl(drive.withRotationalRate(0.5*180/Math.PI));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@@ -105,6 +113,6 @@ public class GrimperReservoir extends Command {
|
|||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
||||||
@Override
|
@Override
|
||||||
public boolean isFinished() {
|
public boolean isFinished() {
|
||||||
return (y-boty < 0.05 && y-boty >-0.05) && (x-botx < 0.05 && x-botx > -0.05);
|
return (y-boty < 0.1 && y-boty >-0.1) && (x-botx < 0.1 && x-botx > -0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,13 +54,18 @@ public class TournerVersReservoir extends Command {
|
|||||||
angle = 0;
|
angle = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() > angle && drivetrain.getPigeon2().getYaw().getValueAsDouble() < angle + 10){
|
||||||
|
drivetrain.setControl(drive.withRotationalRate(0));
|
||||||
|
}
|
||||||
|
else{
|
||||||
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >0 && drivetrain.getPigeon2().getYaw().getValueAsDouble() <180){
|
||||||
drivetrain.setControl(drive.withRotationalRate(-force*180/Math.PI));
|
drivetrain.setControl(drive.withRotationalRate(-force*2));
|
||||||
}
|
}
|
||||||
else if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >180){
|
else if(drivetrain.getPigeon2().getYaw().getValueAsDouble() >180){
|
||||||
drivetrain.setControl(drive.withRotationalRate(force*180/Math.PI));
|
drivetrain.setControl(drive.withRotationalRate(force*2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
@@ -69,6 +74,6 @@ public class TournerVersReservoir extends Command {
|
|||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
||||||
@Override
|
@Override
|
||||||
public boolean isFinished() {
|
public boolean isFinished() {
|
||||||
return drivetrain.getPigeon2().getYaw().getValueAsDouble() > angle && drivetrain.getPigeon2().getYaw().getValueAsDouble() < angle + 10;
|
return drivetrain.getPigeon2().getYaw().getValueAsDouble() > angle && drivetrain.getPigeon2().getYaw().getValueAsDouble() < angle + 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,6 @@ public class MonterGrimpeur extends Command {
|
|||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
||||||
@Override
|
@Override
|
||||||
public boolean isFinished() {
|
public boolean isFinished() {
|
||||||
return false;
|
return Math.abs(grimpeur.Position()) > grimpeur.PositionFinal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user