public class RoboLib
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RoboLib.Alliance
Enum representation of Alliance
|
static class |
RoboLib.StationID
Enum representation of alliance station location
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FRC_JAVA_VERSION |
private static GameMode |
m_currentMode
The m_current mode.
|
private static RobotMode |
m_currentRobotMode
The m_current robot mode.
|
protected static ILogger |
m_log
The m_log.
|
private static java.lang.String |
m_name
The m_name.
|
private static ITable |
m_table
The m_table.
|
private static boolean |
m_thread_keepAlive |
private static java.lang.String |
m_version
The m_version.
|
static int |
MAJOR_VERSION
RoboLibJ Major Version
|
static int |
MINOR_VERSION
RoboLibJ Minor Version
|
private static java.util.EnumMap<GameMode,RobotMode> |
MODES_MAP
The m_modes.
|
static int |
PATCH_VERSION
RoboLibJ Patch Version
|
| Modifier | Constructor and Description |
|---|---|
protected |
RoboLib()
Robot Class Method.
|
protected |
RoboLib(java.lang.String name)
Robot Class Method.
|
protected |
RoboLib(java.lang.String name,
java.lang.String version)
Robot Class Method.
|
| Modifier and Type | Method and Description |
|---|---|
private static void |
checkVersionFile(java.io.File file)
Check version file.
|
protected void |
debug(java.lang.String msg)
Send a message to the Console, and to the Dashboard.
|
static void |
die()
Kill the robot.
|
protected void |
enableDebug(boolean debug)
Enable or Disable Debug Messages.
|
protected void |
enableDebugStatements()
Enable Debug Messages.
|
protected void |
error(java.lang.String msg)
Send out an error to the console.
|
protected void |
error(java.lang.String msg,
java.lang.Throwable e)
Send out an error to the console.
|
protected void |
fatal(java.lang.String msg)
Send out fatal message to the console.
|
protected void |
fatal(java.lang.String msg,
java.lang.Throwable e)
Send out a fatal message to the console.
|
void |
free()
Free the resources for a RoboLibBot class.
|
static RoboLib.Alliance |
getAlliance() |
static RobotMode |
getCurrentRobotMode()
Gets the current
RobotMode. |
static GameMode |
getGameMode()
Gets the current
GameMode. |
static double |
getMatchTime()
An approxamation of the time left in the current period
|
static RobotMode |
getRobotMode(GameMode mode)
|
static ITable |
getRobotTable()
Get the main NetworkTable table for the robot.
|
static RoboLib.StationID |
getStation() |
static boolean |
hasMode(GameMode mode)
|
static boolean |
isAutonomous()
Determine if the robot is currently in Autonomous mode.
|
static boolean |
isBrownedOut()
Check if the system is browned out.
|
static boolean |
isDisabled()
Determine if the Robot is currently disabled.
|
static boolean |
isEnabled()
Determine if the Robot is currently enabled.
|
static boolean |
isEStopped()
Determine if the robot is currently Emergency stopped.
|
static boolean |
isOperatorControl()
Determine if the robot is currently in Operator Control mode.
|
static boolean |
isSysActive()
Check on the overall status of the system.
|
static boolean |
isTest()
Determine if the robot is currently in Test mode.
|
static void |
main(java.lang.String[] args)
The Main method for the robot.
|
protected void |
msg(java.lang.String msg)
Send a message to the Console, and to the Dashboard.
|
static void |
registerAutonomous(AutonMode aMode,
java.lang.String name) |
void |
robotInit()
User Initialization code.
|
protected static void |
set(GameMode gMode,
RobotMode rMode)
|
private static void |
writeVersionFile(java.io.File file)
Write version file.
|
public static final int MAJOR_VERSION
public static final int MINOR_VERSION
public static final int PATCH_VERSION
public static final java.lang.String FRC_JAVA_VERSION
private static GameMode m_currentMode
private static RobotMode m_currentRobotMode
private static volatile boolean m_thread_keepAlive
private static java.lang.String m_name
private static java.lang.String m_version
protected static ILogger m_log
private static ITable m_table
protected RoboLib()
protected RoboLib(java.lang.String name)
name - Name of the Robotprotected RoboLib(java.lang.String name,
java.lang.String version)
name - Name of the Robotversion - Version number of the robot codeprotected void msg(java.lang.String msg)
msg - The message to be sent.protected void debug(java.lang.String msg)
msg - The message to be sent.protected final void enableDebugStatements()
protected final void enableDebug(boolean debug)
debug - Enable or Disableprotected void error(java.lang.String msg)
msg - The message to be sent with the RuntimeExceptionprotected void error(java.lang.String msg,
java.lang.Throwable e)
msg - The message to be sent with the RuntimeExceptione - The throwable object to send with this messageprotected void fatal(java.lang.String msg)
msg - The message to be sent with the RuntimeExceptionprotected void fatal(java.lang.String msg,
java.lang.Throwable e)
msg - The message to be sent with the RuntimeExceptione - The throwable object to send with this messagepublic static void die()
public static final ITable getRobotTable()
public void robotInit()
public static final void main(java.lang.String[] args)
This method does three main things.
Checks to see whether we need to switch RobotMode or not
If needed, switch the current game mode. This will first call the end()
Method of the current RobotMode, then set the current GameMode,
call the System Garbace Collector, and then call the new RobotMode init() method.
Finally, Runs the Current RobotMode. Catches any Throwable objects that may be thrown. Any caught Throwable Object is treated as fatal and will kill the RoboLibBot. They are treated as fatal because any uncaught Throwables can only be RuntimeExceptions or Errors, which are Fatal
args - the argumentsDisabledMode,
TestMode,
AutonMode,
TeleopModeprivate static final void checkVersionFile(java.io.File file)
file - the fileprivate static final void writeVersionFile(java.io.File file)
file - the filepublic void free()
public static final void registerAutonomous(AutonMode aMode, java.lang.String name)
public static final RobotMode getCurrentRobotMode()
RobotMode.
If there is no current Mode, then something went wrong,
and an error mode is returned that will cause the robot to quit.RobotModepublic static final GameMode getGameMode()
GameMode.GameModepublic static final RobotMode getRobotMode(GameMode mode)
mode - the modeRobotModepublic static final boolean hasMode(GameMode mode)
mode - the modepublic static final double getMatchTime()
public static final RoboLib.Alliance getAlliance()
public static final RoboLib.StationID getStation()
public static final boolean isDisabled()
public static final boolean isEnabled()
public static final boolean isAutonomous()
public static final boolean isTest()
public static final boolean isEStopped()
public static final boolean isOperatorControl()
public static final boolean isSysActive()
public static final boolean isBrownedOut()