Skip to content

Commit

Permalink
Fix up some bugs and scaffold new features
Browse files Browse the repository at this point in the history
  • Loading branch information
bubner committed Aug 13, 2024
1 parent 9be51b5 commit cff8528
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ public void setVelocity(double vel, AngleUnit unit) {
*/
@Override
public void setPower(double power) {
// TODO: currently not working, needs testing
switch (mode) {
case RUN_TO_POSITION:
if (rtpController == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ public MecanumDrive(DriveConstants constants, MecanumCoefficients mecanumCoeffic
updatePoseFromMemory();
}

// public MecanumDrive useFallbackLocalizer() {
// return this;
// }
//
// public MecanumDrive useFallbackLocalizer(Localizer fallback) {
// // TODO: part of SwitchableLocalizer, may need to reconsider Localizers for drives as they are common
// return this;
// }

/**
* Reset the IMU's yaw to 0.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.murraybridgebunyips.bunyipslib.roadrunner.drive.localizers;

/**
* SwitchableLocalizer is a composite localizer that allows self-tests to be performed, and to allow a "fallback"
* localizer to kick in if the self-test fails.
*
* @author Lucas Bubner, 2024
*/
/* TODO: WIP */ class SwitchableLocalizer {
}
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ public class Tasks {
* @return a task to move the actuator
*/
public Task control(DoubleSupplier powerSupplier) {
return new ContinuousTask(() -> setPower(powerSupplier.getAsDouble()))
return new ContinuousTask(() -> HoldableActuator.this.setPower(powerSupplier.getAsDouble()))
.onSubsystem(HoldableActuator.this, false)
.withName("Supplier Control");
}
Expand All @@ -396,7 +396,7 @@ public Task control(DoubleSupplier powerSupplier) {
* @return a task to set the power
*/
public Task setPower(double p) {
return new RunTask(() -> setPower(p))
return new RunTask(() -> HoldableActuator.this.setPower(p))
.onSubsystem(HoldableActuator.this, false)
.withName("Set Power");
}
Expand Down

0 comments on commit cff8528

Please sign in to comment.