Skip to content

Commit 67e26ba

Browse files
committed
buildspace changes
1 parent d374e8a commit 67e26ba

File tree

12 files changed

+233
-158
lines changed

12 files changed

+233
-158
lines changed

src/main/deploy/pathplanner/paths/left_intake.path

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
},
3333
{
3434
"anchor": {
35-
"x": 2.622507500654099,
36-
"y": 6.913091720920284
35+
"x": 2.560783467431597,
36+
"y": 6.954241076401952
3737
},
3838
"prevControl": {
39-
"x": 2.272737979059918,
40-
"y": 6.727919621252776
39+
"x": 2.2110139458374154,
40+
"y": 6.769068976734444
4141
},
4242
"nextControl": null,
4343
"isLocked": false,

src/main/deploy/pathplanner/paths/left_shoot.path

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"constraintZones": [],
3333
"eventMarkers": [],
3434
"globalConstraints": {
35-
"maxVelocity": 3.0,
36-
"maxAcceleration": 3.0,
35+
"maxVelocity": 2.0,
36+
"maxAcceleration": 1.5,
3737
"maxAngularVelocity": 540.0,
3838
"maxAngularAcceleration": 720.0
3939
},
@@ -48,5 +48,5 @@
4848
"rotation": 40.92725638742595,
4949
"velocity": 0
5050
},
51-
"useDefaultConstraints": true
51+
"useDefaultConstraints": false
5252
}

src/main/deploy/pathplanner/paths/middle_intake.path

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
},
1717
{
1818
"anchor": {
19-
"x": 2.66,
20-
"y": 5.67
19+
"x": 2.64,
20+
"y": 5.51401363454356
2121
},
2222
"prevControl": {
23-
"x": 1.9028194056388115,
24-
"y": 5.651342508139562
23+
"x": 1.1931420754069582,
24+
"y": 5.378601946827955
2525
},
2626
"nextControl": null,
2727
"isLocked": false,

src/main/deploy/pathplanner/paths/middle_left_intake.path

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"constraintZones": [],
3333
"eventMarkers": [],
3434
"globalConstraints": {
35-
"maxVelocity": 3.0,
36-
"maxAcceleration": 2.5,
35+
"maxVelocity": 2.0,
36+
"maxAcceleration": 1.2,
3737
"maxAngularVelocity": 540.0,
3838
"maxAngularAcceleration": 720.0
3939
},

src/main/deploy/pathplanner/paths/middle_middle_intake.path

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
"waypoints": [
44
{
55
"anchor": {
6-
"x": 0.8427978760719429,
7-
"y": 6.635333571419023
6+
"x": 1.3160154641111295,
7+
"y": 5.51401363454356
88
},
99
"prevControl": null,
1010
"nextControl": {
11-
"x": 0.871909586805377,
12-
"y": 6.635333571419023
11+
"x": 1.3451271748445637,
12+
"y": 5.51401363454356
1313
},
1414
"isLocked": false,
1515
"linkedName": null
1616
},
1717
{
1818
"anchor": {
19-
"x": 2.5710708063020142,
20-
"y": 6.995390431883621
19+
"x": 2.4476227398570094,
20+
"y": 5.51401363454356
2121
},
2222
"prevControl": {
23-
"x": 2.5596865489604834,
24-
"y": 6.995390431883621
23+
"x": 2.4362384825154786,
24+
"y": 5.51401363454356
2525
},
2626
"nextControl": null,
2727
"isLocked": false,
@@ -45,7 +45,7 @@
4545
"reversed": false,
4646
"folder": null,
4747
"previewStartingState": {
48-
"rotation": 58.49573328079566,
48+
"rotation": 0.0,
4949
"velocity": 0
5050
},
5151
"useDefaultConstraints": false

src/main/java/org/ghrobotics/frc2024/Robot.java

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
import edu.wpi.first.wpilibj.TimedRobot;
2222
import edu.wpi.first.wpilibj.smartdashboard.Field2d;
2323
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
24+
import edu.wpi.first.wpilibj2.command.Command;
2425
import edu.wpi.first.wpilibj2.command.CommandScheduler;
2526
import edu.wpi.first.wpilibj2.command.InstantCommand;
27+
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
28+
import edu.wpi.first.wpilibj2.command.button.CommandPS4Controller;
2629
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
2730

2831
/**
@@ -53,9 +56,11 @@ public class Robot extends TimedRobot {
5356
// Controller
5457
private final CommandXboxController driver_controller_ = new CommandXboxController(0);
5558
private final CommandXboxController operator_controller_ = new CommandXboxController(1);
59+
// private final CommandPS4Controller operator_controller_ = new CommandPS4Controller(1);
60+
5661

5762
// Superstructure
58-
private final Superstructure superstructure_ = new Superstructure(arm_, intake_, shooter_, feeder_, climber_);
63+
private final Superstructure superstructure_ = new Superstructure(arm_, intake_, shooter_, feeder_, robot_state_, climber_, drive_);
5964
private final AutoSelector auto_selector_= new AutoSelector(drive_, robot_state_, superstructure_, arm_, intake_, shooter_, feeder_);
6065

6166
// Telemetry
@@ -72,6 +77,8 @@ public void robotInit() {
7277

7378
// Just to test the blue subwoofer distance
7479
// robot_state_.reset(limelight_.getEstimatedVisionRobotPose());
80+
81+
// drive_.leftRightSteerEcoder();
7582
}
7683

7784
@Override
@@ -84,13 +91,15 @@ public void robotPeriodic() {
8491
robot_state_.update();
8592

8693
SmartDashboard.putBoolean("Auto", isAuto);
87-
SmartDashboard.putNumber("Vision x", limelight_.getBotPose2d().getX());
88-
SmartDashboard.putNumber("Vision y", limelight_.getBotPose2d().getY());
89-
SmartDashboard.putNumber("Vision Degrees", limelight_.getBotPose2d().getRotation().getDegrees());
94+
// SmartDashboard.putNumber("Vision x", limelight_.getBotPose2d().getX());
95+
// SmartDashboard.putNumber("Vision y", limelight_.getBotPose2d().getY());
96+
// SmartDashboard.putNumber("Vision Degrees", limelight_.getBotPose2d().getRotation().getDegrees());
9097

9198
SmartDashboard.putData(auto_selector_.getRoutineChooser());
9299
SmartDashboard.putData(auto_selector_.getPositionChooser());
93100

101+
SmartDashboard.putNumber("Vision X", LimelightHelpers.getTX("limelight"));
102+
94103
// if(!Robot.isSimulation())
95104
// field_.setRobotPose(robot_state_.getPosition());
96105
}
@@ -150,31 +159,34 @@ private void setupTeleopControls() {
150159

151160
// Driver Control
152161
// * RT: Spin Shooter
153-
driver_controller_.rightTrigger().whileTrue(superstructure_.setShooterPercent(0.85));
162+
driver_controller_.rightTrigger().whileTrue(superstructure_.setShooterPercent(0.95));
154163

155164
driver_controller_.rightBumper().whileTrue(superstructure_.setShooterPercent(-0.6));
156165

157166
// driver_controller_.pov(180).whileTrue(superstructure_.setShooter(0.55));
158167

159168
// driver_controller_.pov(270).whileTrue(superstructure_.setShooter(85));
160169

161-
driver_controller_.leftTrigger().whileTrue(superstructure_.setIntake(0.55));
170+
driver_controller_.leftTrigger().whileTrue(new ParallelCommandGroup(
171+
superstructure_.setIntake(0.55),
172+
superstructure_.align())
173+
);
162174

163175
driver_controller_.leftBumper().whileTrue(superstructure_.setIntake(-0.25));
164176

165177
driver_controller_.pov(0).whileTrue(superstructure_.setArmPercent(0.056));
166178

167179
driver_controller_.a().whileTrue(superstructure_.setFeeder(0.85));
168180

169-
driver_controller_.b().whileTrue(superstructure_.setFeeder(-0.75));
181+
driver_controller_.b().whileTrue(superstructure_.setFeeder(-0.35));
170182

171183
driver_controller_.y().onTrue(new InstantCommand(() -> drive_.resetGyro()));
172184

173185
// driver_controller_.pov(90).whileTrue(superstructure_.setShooter(90));
174186

175-
driver_controller_.pov(90).whileTrue(superstructure_.setArmPercent(0.15));
187+
driver_controller_.pov(90).whileTrue(superstructure_.setPosition(Superstructure.Position.SUBWOOFER));
176188

177-
driver_controller_.pov(270).whileTrue(superstructure_.setArmPercent(-0.15));
189+
driver_controller_.pov(270).whileTrue(superstructure_.setPosition(Superstructure.Position.GROUND_INTAKE));
178190

179191

180192
// Operator Control

src/main/java/org/ghrobotics/frc2024/Superstructure.java

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package org.ghrobotics.frc2024;
22

3+
import edu.wpi.first.math.MathUtil;
4+
import edu.wpi.first.math.controller.PIDController;
5+
import edu.wpi.first.math.kinematics.ChassisSpeeds;
36
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
47
import edu.wpi.first.wpilibj2.command.Command;
8+
import edu.wpi.first.wpilibj2.command.CommandScheduler;
59
import edu.wpi.first.wpilibj2.command.Commands;
610
import edu.wpi.first.wpilibj2.command.FunctionalCommand;
711
import edu.wpi.first.wpilibj2.command.InstantCommand;
@@ -14,6 +18,7 @@
1418
import org.ghrobotics.frc2024.commands.ArmPID;
1519
import org.ghrobotics.frc2024.subsystems.Arm;
1620
import org.ghrobotics.frc2024.subsystems.Climber;
21+
import org.ghrobotics.frc2024.subsystems.Drive;
1722
import org.ghrobotics.frc2024.subsystems.Feeder;
1823
import org.ghrobotics.frc2024.subsystems.Intake;
1924
import org.ghrobotics.frc2024.subsystems.Shooter;
@@ -26,6 +31,7 @@ public class Superstructure {
2631
private final Feeder feeder_;
2732
private final Climber climber_;
2833
private final RobotState robot_state_;
34+
private final Drive drive_;
2935
// private final ShootingPosition shootingPosition_ = new ShootingPosition();
3036

3137

@@ -36,14 +42,19 @@ public class Superstructure {
3642
public double armShootingAngle;
3743
public double shootingDistance;
3844

45+
public double y_velocity;
46+
47+
private final PIDController pid_ = new PIDController(0.2, 0, 0);
48+
3949
// Constructor
40-
public Superstructure(Arm arm, Intake intake, Shooter shooter, Feeder feeder, RobotState robot_state, Climber climber) {
50+
public Superstructure(Arm arm, Intake intake, Shooter shooter, Feeder feeder, RobotState robot_state, Climber climber, Drive drive) {
4151
arm_ = arm;
4252
intake_ = intake;
4353
shooter_ = shooter;
4454
feeder_ = feeder;
4555
climber_ = climber;
4656
robot_state_ = robot_state;
57+
drive_ = drive;
4758
}
4859

4960
public void periodic() {
@@ -57,10 +68,22 @@ public void periodic() {
5768

5869
SmartDashboard.putString("Superstructure State", state);
5970

71+
y_velocity = MathUtil.clamp(pid_.calculate(LimelightHelpers.getTX("limelight"), -9.8), -0.5, 0.5);
72+
SmartDashboard.putNumber("Vision Error", pid_.getPositionError());
73+
6074
// Checks output current to see if note has intaked or not (current > 35 means intaked)
6175
if (intake_.getRightOutputCurrent() > 45) {
6276
LimelightHelpers.setLEDMode_ForceOn("limelight");
6377
}
78+
79+
if(IO.align == true) {
80+
drive_.setSpeeds(new ChassisSpeeds(0, y_velocity, 0), Drive.OutputType.OPEN_LOOP);
81+
}
82+
else {
83+
drive_.setSpeeds(drive_.getSpeeds());
84+
}
85+
86+
6487
}
6588

6689
// Position Setter
@@ -135,6 +158,33 @@ public Command autoArm(double angle_deg) {
135158
);
136159
}
137160

161+
public Command align() {
162+
return new StartEndCommand(
163+
() -> IO.align = true,
164+
() -> IO.align= false,
165+
drive_
166+
);
167+
}
168+
169+
public Command autoAlign() {
170+
// pid_.setSetpoint(-9.8);
171+
172+
173+
174+
return new FunctionalCommand(
175+
() -> SmartDashboard.putNumber("Started", 0.1),
176+
() -> drive_.setSpeeds(new ChassisSpeeds(0, y_velocity, 0), Drive.OutputType.OPEN_LOOP),
177+
(interrupted) -> drive_.setSpeeds(new ChassisSpeeds(0, 0, 0), Drive.OutputType.OPEN_LOOP),
178+
() -> (pid_.getPositionError() < 0.5),
179+
drive_
180+
);
181+
}
182+
183+
public void alignNote() {
184+
185+
drive_.setSpeeds(new ChassisSpeeds(0, y_velocity, 0), Drive.OutputType.OPEN_LOOP);
186+
}
187+
138188
/**
139189
* Feeder Setter
140190
* @param percent
@@ -188,6 +238,10 @@ public String getState() {
188238
return state;
189239
}
190240

241+
public static class IO {
242+
public static boolean align;
243+
}
244+
191245
public enum Position {
192246
STOW(55, "STOW"),
193247
SUBWOOFER(16.2, "SUBWOOFER"),

0 commit comments

Comments
 (0)