Class LightningRobot

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class LightningRobot
    extends edu.wpi.first.wpilibj.TimedRobot
    Base robot class, provides logging, fault monitoring, and loops with varying periods background, low, and medium priority loops. Uses Autonomous to configure autonomous commands. Also includes self-testing support with SystemTestCommand.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      DataLogger dataLogger  
      • Fields inherited from class edu.wpi.first.wpilibj.TimedRobot

        kDefaultPeriod
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void autonomousInit()
      The default implementation handles getting the selected command from Shuffleboard.
      void disabledInit()
      The default implementation configures the default commands in the event they have been disabled by testInit().
      void disabledPeriodic()
      Nothing should happen here.
      LightningContainer getContainer()
      Getter for the configured robot container.
      protected void robotBackgroundPeriodic()
      A slower loop, running once every 10 seconds Note as currently implemented it still needs to complete in our loop time or it delay higher priority opterations.
      void robotInit()
      This function is run when the robot is first started up and should be used for any initialization code.
      protected void robotLowPriorityPeriodic()
      A slow loop, running once a second Note as currently implemented it still needs to complete in our loop time or it delay higher priority opterations.
      protected void robotMediumPriorityPeriodic()
      A loop, running 10 times a second Note as currently implemented it still needs to complete in our loop time or it delay higher priority opterations.
      void robotPeriodic()
      This function is called every robot packet, no matter the mode.
      void teleopInit()
      The default implementation handles canceling the autonomous command.
      void testInit()
      The default implementation cancles all commands and releases the default commands from the subsystems, and schedules a SystemTestCommand.
      void testPeriodic()  
      • Methods inherited from class edu.wpi.first.wpilibj.TimedRobot

        addPeriodic, addPeriodic, endCompetition, finalize, startCompetition
      • Methods inherited from class edu.wpi.first.wpilibj.IterativeRobotBase

        autonomousExit, autonomousPeriodic, disabledExit, getPeriod, loopFunc, setNetworkTablesFlushEnabled, simulationInit, simulationPeriodic, teleopExit, teleopPeriodic, testExit
      • Methods inherited from class edu.wpi.first.wpilibj.RobotBase

        close, getBooleanProperty, getMainThreadId, getRuntimeType, isAutonomous, isAutonomousEnabled, isDisabled, isEnabled, isNewDataAvailable, isOperatorControl, isOperatorControlEnabled, isReal, isSimulation, isTeleop, isTeleopEnabled, isTest, startRobot, suppressExitWarning
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • disabledPeriodic

        public void disabledPeriodic()
        Nothing should happen here.
        Overrides:
        disabledPeriodic in class edu.wpi.first.wpilibj.IterativeRobotBase
      • robotInit

        public void robotInit()
        This function is run when the robot is first started up and should be used for any initialization code. If you override it, be sure to call super.robotInit
        Overrides:
        robotInit in class edu.wpi.first.wpilibj.IterativeRobotBase
      • robotPeriodic

        public void robotPeriodic()
        This function is called every robot packet, no matter the mode. Use this for items like diagnostics that you want ran during disabled, autonomous, teleoperated and test.

        This runs after the mode specific periodic functions, but before LiveWindow and Shuffleboard integrated updating. If you override this method, be sure to call super.robotPeriod() as it drives our lower priority loops, datalogging, fault monitoring, etc.

        Overrides:
        robotPeriodic in class edu.wpi.first.wpilibj.IterativeRobotBase
      • robotBackgroundPeriodic

        protected void robotBackgroundPeriodic()
        A slower loop, running once every 10 seconds Note as currently implemented it still needs to complete in our loop time or it delay higher priority opterations. If you have a low priority, long running operation, consider creating a background thread.
      • robotLowPriorityPeriodic

        protected void robotLowPriorityPeriodic()
        A slow loop, running once a second Note as currently implemented it still needs to complete in our loop time or it delay higher priority opterations. If you have a low priority, long running operation, consider creating a background thread.
      • robotMediumPriorityPeriodic

        protected void robotMediumPriorityPeriodic()
        A loop, running 10 times a second Note as currently implemented it still needs to complete in our loop time or it delay higher priority opterations. If you have a low priority, long running operation, consider creating a background thread.
      • autonomousInit

        public void autonomousInit()
        The default implementation handles getting the selected command from Shuffleboard. If you override this method, be sure to call super.autonomousInit() or the selected registered command will not be executed.
        Overrides:
        autonomousInit in class edu.wpi.first.wpilibj.IterativeRobotBase
      • teleopInit

        public void teleopInit()
        The default implementation handles canceling the autonomous command. If you override this method, be sure to call super.teleopInit() or the autonomous command will not be canceled when teleop starts. Alternatively, if you want the autonomous command to finish running into teleop, you may override this method w/o calling super.teleopInit()
        Overrides:
        teleopInit in class edu.wpi.first.wpilibj.IterativeRobotBase
      • testInit

        public void testInit()
        The default implementation cancles all commands and releases the default commands from the subsystems, and schedules a SystemTestCommand. It is reccomended that you avoid overriding this method.
        Overrides:
        testInit in class edu.wpi.first.wpilibj.IterativeRobotBase
      • testPeriodic

        public void testPeriodic()
        Overrides:
        testPeriodic in class edu.wpi.first.wpilibj.IterativeRobotBase
      • disabledInit

        public void disabledInit()
        The default implementation configures the default commands in the event they have been disabled by testInit().
        Overrides:
        disabledInit in class edu.wpi.first.wpilibj.IterativeRobotBase