2026-02-20 18:30:35 -05:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
#
|
|
|
|
|
# Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
# Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
# the WPILib BSD license file in the root directory of this project.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
import commands2
|
|
|
|
|
import wpilib
|
|
|
|
|
|
|
|
|
|
from rapidreactcommandbot import RapidReactCommandBot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MyRobot(commands2.TimedCommandRobot):
|
|
|
|
|
"""The methods in this class are called automatically corresponding to each mode, as
|
|
|
|
|
described in the TimedRobot documentation. If you change the name of this class or the
|
|
|
|
|
package after creating this project, you must also update the Main.java file in the
|
|
|
|
|
project.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def __init__(self) -> None:
|
|
|
|
|
"""This function is run when the robot is first started up and should be used for any
|
|
|
|
|
initialization code.
|
|
|
|
|
"""
|
|
|
|
|
super().__init__()
|
|
|
|
|
self.autonomousCommand = None
|
|
|
|
|
self.robot = RapidReactCommandBot()
|
|
|
|
|
|
|
|
|
|
# Configure default commands and condition bindings on robot startup
|
|
|
|
|
self.robot.configureBindings()
|
|
|
|
|
|
|
|
|
|
# Initialize data logging.
|
|
|
|
|
wpilib.DataLogManager.start()
|
|
|
|
|
|
|
|
|
|
def disabledInit(self) -> None:
|
|
|
|
|
"""This function is called once each time the robot enters Disabled mode."""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def disabledPeriodic(self) -> None:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def autonomousInit(self) -> None:
|
|
|
|
|
self.autonomousCommand = self.robot.getAutonomousCommand()
|
|
|
|
|
|
|
|
|
|
if self.autonomousCommand is not None:
|
|
|
|
|
self.autonomousCommand.schedule()
|
|
|
|
|
|
|
|
|
|
def autonomousPeriodic(self) -> None:
|
|
|
|
|
"""This function is called periodically during autonomous."""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def teleopInit(self) -> None:
|
|
|
|
|
# This makes sure that the autonomous stops running when
|
|
|
|
|
# teleop starts running. If you want the autonomous to
|
|
|
|
|
# continue until interrupted by another command, remove
|
|
|
|
|
# this line or comment it out.
|
|
|
|
|
if self.autonomousCommand is not None:
|
|
|
|
|
self.autonomousCommand.cancel()
|
|
|
|
|
|
|
|
|
|
def teleopPeriodic(self) -> None:
|
|
|
|
|
"""This function is called periodically during operator control."""
|
|
|
|
|
pass
|
|
|
|
|
|
2026-04-20 20:29:25 -07:00
|
|
|
def utilityInit(self) -> None:
|
|
|
|
|
# Cancels all running commands at the start of utility mode.
|
2026-02-20 18:30:35 -05:00
|
|
|
commands2.CommandScheduler.getInstance().cancelAll()
|
|
|
|
|
|
2026-04-20 20:29:25 -07:00
|
|
|
def utilityPeriodic(self) -> None:
|
|
|
|
|
"""This function is called periodically during utility mode."""
|
2026-02-20 18:30:35 -05:00
|
|
|
pass
|