Repository navigation
Adding base arm subsystem #685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6474706
b0ad120
e51f068
41dcc33
a89cad7
07950b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| package xbot.common.subsystems.arm; | ||
|
|
||
| import javax.inject.Singleton; | ||
|
|
||
| import org.wpilib.command2.Command; | ||
| import org.wpilib.command2.Commands; | ||
| import org.wpilib.units.measure.Angle; | ||
|
|
||
| import xbot.common.command.BaseSetpointSubsystem; | ||
| import xbot.common.controls.actuators.XCANMotorController; | ||
| import xbot.common.properties.TunableFactory; | ||
|
|
||
| @Singleton | ||
| public abstract class BaseArmSubsystem extends BaseSetpointSubsystem<Angle, Double> { | ||
|
|
||
| boolean isCalibrated = false; | ||
| boolean hasAbsoluteEncoder; | ||
|
|
||
| public BaseArmSubsystem(XCANMotorController.XCANMotorControllerFactory xcanMotorControllerFactory, TunableFactory tunableFactory) { | ||
| super(); | ||
| tunableFactory.setPrefix(this); | ||
|
|
||
| } | ||
|
|
||
| public abstract Angle getTargetValue(); | ||
|
|
||
| public abstract boolean hasAbsoluteEncoder(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⭐ ⭐ ⭐ this one for sure doesn't need to be abstract, you have an instance variable up above for is there an absolute encoder? |
||
|
|
||
| public abstract void setTargetValue(Angle desiredAngle); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⭐ ⭐ Same thing here |
||
|
|
||
| public abstract void setPower(Double power); | ||
|
|
||
| public abstract boolean isCalibrated(); | ||
|
|
||
| protected abstract boolean areTwoTargetsEquivalent(Angle target1, Angle target2); | ||
|
|
||
| @Override | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⭐ ⭐ This periodic override isn't doing anything, the same as removing it. Or is there something that should happen here? Like recording properties? |
||
| public void periodic() { | ||
| super.periodic(); | ||
| } | ||
|
|
||
| public abstract Angle getCurrentValue(); | ||
|
|
||
| public Command getHasAbsoluteEncoder() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ what would this command be used for? |
||
| return Commands.runOnce(() -> { | ||
| hasAbsoluteEncoder = hasAbsoluteEncoder(); | ||
| }); | ||
| } | ||
|
|
||
| public Command getCalibrateCommand() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ I'm confused about what this one is for as well. Is it about calibrating the current arm position? |
||
| return Commands.runOnce(() -> { | ||
| isCalibrated = isCalibrated(); | ||
| }); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package xbot.common.subsystems.arm.commands; | ||
|
|
||
| import org.wpilib.units.measure.Angle; | ||
|
|
||
| import xbot.common.command.BaseMaintainerCommand; | ||
| import xbot.common.logic.HumanVsMachineDecider; | ||
| import xbot.common.properties.TunableFactory; | ||
| import xbot.common.subsystems.arm.BaseArmSubsystem; | ||
|
|
||
| public abstract class BaseArmMaintainer extends BaseMaintainerCommand<Angle, Double> { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⭐ ⭐ ⭐ this maintainer isn't doing much right now, it's basically the same as not having this class at all and people just extending BaseMaintainer themselves? |
||
|
|
||
| final BaseArmSubsystem baseArm; | ||
|
|
||
| public BaseArmMaintainer(TunableFactory tunableFactory, HumanVsMachineDecider.HumanVsMachineDeciderFactory hvmFactory, BaseArmSubsystem baseArm) { | ||
| super(baseArm, tunableFactory, hvmFactory, 1, 1); | ||
|
|
||
| this.baseArm = baseArm; | ||
| } | ||
|
|
||
| public abstract void initialize(); | ||
|
|
||
| protected abstract void coastAction(); | ||
|
|
||
| protected abstract void calibratedMachineControlAction(); | ||
|
|
||
| protected abstract double getErrorMagnitude(); | ||
|
|
||
| protected abstract Double getHumanInput(); | ||
|
|
||
| protected abstract double getHumanInputMagnitude(); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐ ⭐ this probably doesn't have to be abstract does it?