Skip to content
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

Add marker button #74

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from
5 changes: 4 additions & 1 deletion src/main/kotlin/frc/robot/RobotContainer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard
import edu.wpi.first.wpilibj2.command.Command
import edu.wpi.first.wpilibj2.command.Commands
import edu.wpi.first.wpilibj2.command.button.CommandXboxController
import edu.wpi.first.wpilibj2.command.button.RobotModeTriggers
import frc.robot.ControllerInputs.driverController
import frc.robot.ControllerInputs.operatorController
import edu.wpi.first.wpilibj2.command.button.RobotModeTriggers
import frc.robot.commandGroups.*
import frc.robot.lib.markAbnormalEvent
import frc.robot.scoreState.AmpState
import frc.robot.scoreState.ClimbState
import frc.robot.scoreState.ScoreState
Expand Down Expand Up @@ -116,6 +117,8 @@ object RobotContainer {
operatorController().circle().onTrue(gripper.disableSensor())

operatorController().options().whileTrue(intake.reset())

operatorController().square().onTrue(markAbnormalEvent())
}

fun getAutonomousCommand(): Command = autoChooser.get()
Expand Down
16 changes: 16 additions & 0 deletions src/main/kotlin/frc/robot/lib/MarkerCommands.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package frc.robot.lib

import edu.wpi.first.wpilibj.Alert
import edu.wpi.first.wpilibj.DataLogManager
import edu.wpi.first.wpilibj2.command.Command
import edu.wpi.first.wpilibj2.command.Commands

const val ABNORMAL_EVENT_NAME = "EVENT"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add the time since match start/match end. Did you check it's convenient in the console tab? I would also add error/warning so AdvantageScope will color it (check their docs for the exact wording).

val alert = Alert(ABNORMAL_EVENT_NAME, Alert.AlertType.kWarning)

fun markEvent(eventName: String): Command = Commands.runOnce({
DataLogManager.log(eventName)
alert.set(true) // TODO: Make something that sets this to false after a couple of seconds
})

fun markAbnormalEvent(): Command = markEvent(ABNORMAL_EVENT_NAME)