Conversation
teleHoldHeading for the teleop specific command.
| private final ConnectableFlowable<Double> currentHeading; | ||
| private final TimeUnit pidTerminateUnit = TimeUnit.MILLISECONDS; | ||
| private final long pidTerminateTime = 1000; | ||
| private final double distanceP = 0.2; |
There was a problem hiding this comment.
Make these static constants
| this.teleHoldHeading = teleHoldHeading; | ||
| } | ||
|
|
||
| private Flowable<?> pidTerminator(Flowable<Double> error, double tolerance) { |
There was a problem hiding this comment.
Move this into FRamework (time permitting)
| */ | ||
| public Command driveDistanceAction(double distance, double speed) { | ||
| System.out.println(FEET_PER_ENCODER_ROTATION); | ||
| public Command driveDistance(double distance, |
There was a problem hiding this comment.
Move all three to separate lines
| public Command driveDistanceAction(double distance, double speed) { | ||
| System.out.println(FEET_PER_ENCODER_ROTATION); | ||
| public Command driveDistance(double distance, | ||
| double distanceTolerance, double angleTolerance) { |
There was a problem hiding this comment.
Add a comment explaining that this just stores the current heading
| double setpoint = distance / FEET_PER_ENCODER_ROTATION; | ||
| System.out.println(setpoint); | ||
| Command resetRight = Command.just(x -> { | ||
| Flowable<Double> distanceError = toFlow(() -> |
There was a problem hiding this comment.
Where does the 2.0 come from?
There was a problem hiding this comment.
It's the simple average of the two controllers' positions.
| Command resetRight = Command.just(x -> { | ||
| Flowable<Double> distanceError = toFlow(() -> | ||
| (rightDrive.position() + leftDrive.position()) / 2.0 - setpoint); | ||
| Flowable<Double> distanceOutput = distanceError |
There was a problem hiding this comment.
Move .onBackpressureDrop to new line
| distanceOutput.subscribe(new WpiSmartDashboard().getTextFieldDouble("distance")); | ||
| Command right = Command.fromSubscription(() -> | ||
| combineLatest(distanceOutput, angleOutput, (x, y) -> x + y) | ||
| .map(limitWithin(-1.0, 1.0)) |
| .terminable(pidTerminator(distanceError, | ||
| distanceTolerance / WHEEL_ROTATION_PER_ENCODER_ROTATION)) | ||
| .then(driveHoldHeading(noDrive, noDrive, Flowable.just(true), targetHeading) | ||
| .terminable(pidTerminator(angleError, angleTolerance)) |
There was a problem hiding this comment.
Do we want this hard coded in?
There was a problem hiding this comment.
Doesn't this stop us from going a longer distance?
| .subscribeOn(Schedulers.io()) | ||
| .onBackpressureDrop() | ||
| .map(limitWithin(-1.0, 1.0)) | ||
| .map(Events::power) |
| public Command registerAuto() { | ||
| Command drive = this.drivetrain.driveDistanceAction(4.0, 0.3); | ||
| return drive.then(this.drivetrain.turn(-85, 1)).then(drive); | ||
| return Command.serial( |
There was a problem hiding this comment.
This looks really nice. Very declarative!
| private static final double FEET_PER_ENCODER_ROTATION = | ||
| FEET_PER_WHEEL_ROTATION * WHEEL_ROTATION_PER_ENCODER_ROTATION; | ||
| // PID for turning to an angle based on the gyro | ||
| private static final double angleP = 0.09; |
| public void registerSubscriptions() { | ||
| FlowOperators.deadband(joyControl).map(FlowOperators::printId).map(x -> Events.power(x / 4)) | ||
| FlowOperators.deadband(joyControl).map(x -> Events.power(x / 4)) | ||
| .subscribe(hoodMaster); //TODO: remove this joystick |
There was a problem hiding this comment.
Has this TODO been done?
There was a problem hiding this comment.
Fixed in Lydia's branch, wait for that to be merged.
Before Merging
Check the following subsystems work:
Drivetrain
Turn to angleShooter
Turret/Vision
Turns to target w/ visionClimbtake
Auto