Skip to content

Commit 099d1e1

Browse files
authored
Merge pull request #240 from strykeforce/mwitcpalek/driverTune
Mwitcpalek/driver tune
2 parents 136f0b9 + 01e6c3c commit 099d1e1

File tree

5 files changed

+28
-30
lines changed

5 files changed

+28
-30
lines changed

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# 2019 FIRST DEEP SPACE
22

3+
![airtight](https://strykeforce.smugmug.com/2019-Stryke-Force/2019-Deep-Space/i-2dCqG95/A)
4+
5+
## Controls
6+
![driver](docs/2019-driver-controls.JPG)
7+
8+
![copilot](docs/2019-copilot-controls.JPG)
9+
310
## Talons
411

512
Subsystem | Talon | ID | PDP
@@ -61,7 +68,8 @@ Vision | cam0Tune | User Button
6168

6269
## PCM
6370

64-
Subsystem | Valve | Solenoid
65-
--------- | ------------ | --------
66-
Vacuum | trident | 0
67-
Vacuum | climb | 2
71+
Subsystem | Valve | Solenoid
72+
--------- | ------------- | --------
73+
Vacuum | trident(hatch)| 0
74+
Vacuum | climb | 2
75+
Vacuum | trident(cargo)| 3

docs/2019-copilot-controls.JPG

84.9 KB
Loading

docs/2019-driver-controls.JPG

84.9 KB
Loading

src/main/java/frc/team2767/deepspace/command/TeleOpDriveCommand.java

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ public final class TeleOpDriveCommand extends Command {
1616
private static final DriveSubsystem DRIVE = Robot.DRIVE;
1717
private static final VisionSubsystem VISION = Robot.VISION;
1818
private static final double DEADBAND = 0.05;
19-
private static final double YAW_EXPO = 0.5;
20-
private static final double DRIVE_EXPO = 0.5;
19+
private static final double YAW_EXPO = 0.65; // 0.5
20+
private static final double DRIVE_EXPO = 0.65; // 0.5
2121
private static final double kP = 0.1;
22+
private static final double MAX_FWD_STR = 0.7;
23+
private static final double MAX_YAW = 0.6;
2224
private static DriverControls controls;
2325
private final Logger logger = LoggerFactory.getLogger(this.getClass());
2426
private final ExpoScale yawExpo;
@@ -39,33 +41,15 @@ protected void initialize() {
3941

4042
@Override
4143
protected void execute() {
42-
/*VISION.queryPyeye(); // gets corrected heading and range from NT
43-
44-
double maxYawVelocity = 0.3; // max yaw input
45-
46-
double error = VISION.getCorrectedHeading();
47-
boolean isGood =
48-
VISION.getCorrectedRange() >= 0; // check if range is good (we have a target), not -1*/
4944
double yaw;
50-
51-
/*if (isGood) {
52-
53-
yaw = error * kP; // corrected heading is error from camera center
54-
55-
// normalize yaw
56-
if (yaw > maxYawVelocity) {
57-
yaw = maxYawVelocity;
58-
} else if (yaw < -maxYawVelocity) {
59-
yaw = -maxYawVelocity;
60-
}
61-
} else {*/
6245
yaw = yawExpo.apply(controls.getYaw());
63-
// }
64-
65-
// forward and strafe are still normal
6646
double forward = driveExpo.apply(controls.getForward());
6747
double strafe = driveExpo.apply(controls.getStrafe());
6848

49+
forward = maximum(forward, MAX_FWD_STR);
50+
strafe = maximum(strafe, MAX_FWD_STR);
51+
yaw = maximum(yaw, MAX_YAW);
52+
6953
DRIVE.drive(forward, strafe, yaw);
7054
}
7155

@@ -83,4 +67,10 @@ private double deadband(double value) {
8367
if (Math.abs(value) < DEADBAND) return 0.0;
8468
return value;
8569
}
70+
71+
private double maximum(double value, double max) {
72+
if (value > max) return max;
73+
else if (value < -max) return -max;
74+
else return value;
75+
}
8676
}

src/main/java/frc/team2767/deepspace/control/DriverControls.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import edu.wpi.first.wpilibj.command.Command;
66
import frc.team2767.deepspace.command.ZeroGyroCommand;
77
import frc.team2767.deepspace.command.approach.sequences.AutoHatchPickupCommandGroup;
8-
import frc.team2767.deepspace.command.approach.sequences.AutoHatchPlaceCommandGroup;
98
import frc.team2767.deepspace.command.biscuit.BiscuitNegativeCommand;
109
import frc.team2767.deepspace.command.biscuit.BiscuitPositiveCommand;
1110
import frc.team2767.deepspace.command.biscuit.BiscuitStopCommand;
@@ -88,7 +87,8 @@ public class DriverControls {
8887

8988
// gamepiece place
9089
new JoystickButton(joystick, Shoulder.LEFT_DOWN.id).whenPressed(new ReleaseGamepieceCommand());
91-
new JoystickButton(joystick, Shoulder.LEFT_UP.id).whenPressed(new AutoHatchPlaceCommandGroup());
90+
// new JoystickButton(joystick, Shoulder.LEFT_UP.id).whenPressed(new
91+
// AutoHatchPlaceCommandGroup());
9292
// new JoystickButton(joystick, Shoulder.LEFT_UP.id).whenReleased(new InterruptCommand());
9393
}
9494

0 commit comments

Comments
 (0)