-
Notifications
You must be signed in to change notification settings - Fork 664
Description
Is your feature request related to a problem? Please describe.
One issue our team faced last year was the lack of clear visibility into when and what parts of the trigger were (or weren't) being triggered, without having to delve into multiple subsystems and graph them in AScope.
Describe the solution you'd like
I would like to have an option to create a more detailed trigger that logs everything together and provides clear visibility, all in one section, on what conditions have or haven't been met for the trigger.
Describe alternatives you've considered
Logging values in RobotContainer with paths set for each Trigger, but this really bloated up the code.
Additional context
Here is a very rough pass on something that does have minimal functionality and does work. Just didn't want to spend time, as I am sure this is the wrong approach (for example, switching to a Map and Entry would have been much cleaner). I initially tried making a Sendable; this worked with SmartDashboard.putData()
, however, it didn't work when testing with Epilogue. I ended up scrapping Sendable and decided to get this to work with Epilogue with a CustomLoggerFor
, which is very cumbersome.
DetailedTrigger.zip
Example code and how it looks in code and on AdvantageScope
exampleTrigger =
new DetailedTrigger(
() -> arm.getPosition().isNear(arm.getTargetPosition(), arm.getTolerance()),
new String[] {"position", "target", "tolerance"},
() -> arm.getPosition().in(Degrees),
() -> arm.getTargetPosition().in(Degrees),
() -> arm.getTolerance().in(Degrees));

As stated, what I provided was a rough draft. Thinking some more, ideal approaches would potentially look like
var exampleTrigger = new DetailedTrigger(
() -> arm.getPosition().isNear(arm.getTargetPosition(), arm.getTolerance()),
entry("position", () -> arm.getPosition().in(Degrees)),
entry("target", () -> arm.getTargetPosition().in(Degrees)),
entry("tolerance", () -> arm.getTolerance().in(Degrees))
);
or
var exampleTrigger = new DetailedTrigger(
() -> arm.getPosition().isNear(arm.getTargetPosition(), arm.getTolerance()))
.with("position", () -> arm.getPosition().in(Degrees))
.with("target", () -> arm.getTargetPosition().in(Degrees))
.with("tolerance", () -> arm.getTolerance().in(Degrees));