Package com.lightningrobotics.common
Class LightningRobot
- java.lang.Object
-
- edu.wpi.first.wpilibj.RobotBase
-
- edu.wpi.first.wpilibj.IterativeRobotBase
-
- edu.wpi.first.wpilibj.TimedRobot
-
- com.lightningrobotics.common.LightningRobot
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class LightningRobot extends edu.wpi.first.wpilibj.TimedRobotBase robot class, provideslogging,fault monitoring, and loops with varying periodsbackground,low, andmediumpriority loops. UsesAutonomousto configure autonomous commands. Also includes self-testing support withSystemTestCommand.
-
-
Field Summary
Fields Modifier and Type Field Description DataLoggerdataLogger
-
Constructor Summary
Constructors Constructor Description LightningRobot(LightningContainer container)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidautonomousInit()The default implementation handles getting the selected command from Shuffleboard.voiddisabledInit()The default implementation configures the default commands in the event they have been disabled bytestInit().voiddisabledPeriodic()Nothing should happen here.LightningContainergetContainer()Getter for the configured robot container.protected voidrobotBackgroundPeriodic()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.voidrobotInit()This function is run when the robot is first started up and should be used for any initialization code.protected voidrobotLowPriorityPeriodic()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 voidrobotMediumPriorityPeriodic()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.voidrobotPeriodic()This function is called every robot packet, no matter the mode.voidteleopInit()The default implementation handles canceling the autonomous command.voidtestInit()The default implementation cancles all commands and releases the default commands from the subsystems, and schedules aSystemTestCommand.voidtestPeriodic()-
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
-
-
-
-
Field Detail
-
dataLogger
public DataLogger dataLogger
-
-
Constructor Detail
-
LightningRobot
public LightningRobot(LightningContainer container)
-
-
Method Detail
-
getContainer
public LightningContainer getContainer()
Getter for the configured robot container.- Returns:
- the
LightningContainerfor the robot.
-
disabledPeriodic
public void disabledPeriodic()
Nothing should happen here.- Overrides:
disabledPeriodicin classedu.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:
robotInitin classedu.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:
robotPeriodicin classedu.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 callsuper.autonomousInit()or the selected registered command will not be executed.- Overrides:
autonomousInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
teleopInit
public void teleopInit()
The default implementation handles canceling the autonomous command. If you override this method, be sure to callsuper.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 callingsuper.teleopInit()- Overrides:
teleopInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
testInit
public void testInit()
The default implementation cancles all commands and releases the default commands from the subsystems, and schedules aSystemTestCommand. It is reccomended that you avoid overriding this method.- Overrides:
testInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
testPeriodic
public void testPeriodic()
- Overrides:
testPeriodicin classedu.wpi.first.wpilibj.IterativeRobotBase
-
disabledInit
public void disabledInit()
The default implementation configures the default commands in the event they have been disabled bytestInit().- Overrides:
disabledInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
-