Compare commits
2 Commits
7b734cc046
...
d98dc4e467
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d98dc4e467 | ||
|
|
b0ad34519e |
@@ -48,15 +48,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "named",
|
"type": "deadline",
|
||||||
"data": {
|
"data": {
|
||||||
"name": "Lancer"
|
"commands": [
|
||||||
}
|
{
|
||||||
},
|
"type": "named",
|
||||||
{
|
"data": {
|
||||||
"type": "named",
|
"name": "Lancer"
|
||||||
"data": {
|
}
|
||||||
"name": "TournerA180"
|
},
|
||||||
|
{
|
||||||
|
"type": "named",
|
||||||
|
"data": {
|
||||||
|
"name": "Aspirer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,15 +48,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "named",
|
"type": "deadline",
|
||||||
"data": {
|
"data": {
|
||||||
"name": "Lancer"
|
"commands": [
|
||||||
}
|
{
|
||||||
},
|
"type": "named",
|
||||||
{
|
"data": {
|
||||||
"type": "named",
|
"name": "Lancer"
|
||||||
"data": {
|
}
|
||||||
"name": "TournerAZero"
|
},
|
||||||
|
{
|
||||||
|
"type": "named",
|
||||||
|
"data": {
|
||||||
|
"name": "Aspirer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,15 +19,13 @@ public class Inverser extends Command {
|
|||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {}
|
public void initialize() {
|
||||||
|
drivetrain.getPigeon2().setYaw(drivetrain.getPigeon2().getYaw().getValueAsDouble()+180);
|
||||||
|
}
|
||||||
|
|
||||||
// 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(!inverse){
|
|
||||||
drivetrain.getPigeon2().setYaw(drivetrain.getPigeon2().getYaw().getValueAsDouble()+180);
|
|
||||||
inverse = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import edu.wpi.first.wpilibj2.command.Command;
|
|||||||
import frc.robot.generated.TunerConstants;
|
import frc.robot.generated.TunerConstants;
|
||||||
import frc.robot.subsystems.CommandSwerveDrivetrain;
|
import frc.robot.subsystems.CommandSwerveDrivetrain;
|
||||||
import frc.robot.subsystems.LimeLight3;
|
import frc.robot.subsystems.LimeLight3;
|
||||||
|
import frc.robot.subsystems.Limelight3G;
|
||||||
|
|
||||||
/* 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 GrimperMur extends Command {
|
public class GrimperMur extends Command {
|
||||||
@@ -57,6 +58,7 @@ public class GrimperMur 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(limeLight3.getV()){
|
||||||
BotPose = limeLight3.getBotPoseBlue();
|
BotPose = limeLight3.getBotPoseBlue();
|
||||||
botx = BotPose[0];
|
botx = BotPose[0];
|
||||||
boty = BotPose[1];
|
boty = BotPose[1];
|
||||||
@@ -96,7 +98,7 @@ public class GrimperMur extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class LimelighterAuto extends Command {
|
|||||||
double[] BotPose = new double[6];
|
double[] BotPose = new double[6];
|
||||||
System.out.println("e");
|
System.out.println("e");
|
||||||
if (limelight3g.getV()) {
|
if (limelight3g.getV()) {
|
||||||
// BotPose = limelight3g.getBotPoseBlue();
|
BotPose = limelight3g.getBotPoseBlue();
|
||||||
if (!alliance.isPresent()) {
|
if (!alliance.isPresent()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -65,25 +65,25 @@ public class LimelighterAuto extends Command {
|
|||||||
x = 11.915394;
|
x = 11.915394;
|
||||||
BotPose = limelight3g.getBotPoseRed();
|
BotPose = limelight3g.getBotPoseRed();
|
||||||
}
|
}
|
||||||
botx = BotPose[1];
|
botx = BotPose[0];
|
||||||
boty = BotPose[0];
|
boty = BotPose[1];
|
||||||
angle = drivetrain.getPigeon2().getYaw().getValueAsDouble();
|
angle = BotPose[5];
|
||||||
calcul = limelight3g.Calcule(botx, x, boty, 4, angle);
|
calcul = limelight3g.Calcule(botx, x, boty, 4, angle);
|
||||||
if(angle > 180){
|
|
||||||
angle -= 360;
|
|
||||||
}
|
|
||||||
if(calcul > -5 && calcul < 5){
|
if(calcul > -5 && calcul < 5){
|
||||||
drivetrain.setControl(
|
drivetrain.setControl(
|
||||||
drive.withRotationalRate(0));
|
drive.withRotationalRate(0));
|
||||||
}
|
}
|
||||||
else if(calcul > 5){
|
else if(calcul > 5){
|
||||||
drivetrain.setControl(
|
drivetrain.setControl(
|
||||||
drive.withRotationalRate(0.5*(2*Math.PI)));
|
drive.withRotationalRate(2));
|
||||||
}
|
}
|
||||||
else if(calcul < -5){
|
else if(calcul < -5){
|
||||||
drivetrain.setControl(
|
drivetrain.setControl(drive.withRotationalRate(-2));
|
||||||
drive.withRotationalRate(-0.5*(2*Math.PI)));
|
|
||||||
}
|
}
|
||||||
|
// botx = BotPose[1];
|
||||||
|
// boty = BotPose[0];
|
||||||
|
// angle = drivetrain.getPigeon2().getYaw().getValueAsDouble();
|
||||||
|
// calcul = limelight3g.Calcule(botx, x, boty, 4, angle);
|
||||||
// if(calcul < -5 && calcul > -180){
|
// if(calcul < -5 && calcul > -180){
|
||||||
// drivetrain.setControl(
|
// drivetrain.setControl(
|
||||||
// drive.withRotationalRate(0.5*(2*Math.PI)));
|
// drive.withRotationalRate(0.5*(2*Math.PI)));
|
||||||
@@ -92,7 +92,7 @@ public class LimelighterAuto extends Command {
|
|||||||
// drivetrain.setControl(
|
// drivetrain.setControl(
|
||||||
// drive.withRotationalRate(-0.5*(2*Math.PI)));
|
// drive.withRotationalRate(-0.5*(2*Math.PI)));
|
||||||
// }
|
// }
|
||||||
// else if(calcul >= 180){
|
// else if(calcul < -5){
|
||||||
// drivetrain.setControl(
|
// drivetrain.setControl(
|
||||||
// drive.withRotationalRate(-0.5*(2*Math.PI)));
|
// drive.withRotationalRate(-0.5*(2*Math.PI)));
|
||||||
// }
|
// }
|
||||||
@@ -126,6 +126,7 @@ public class LimelighterAuto 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 calcul > -5 && calcul < 5;
|
return calcul > -5 && calcul < 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user