public class FtcEventLoopHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected UpdateUI.Callback |
callback |
protected static boolean |
DEBUG |
protected EventLoopManager |
eventLoopManager |
protected HardwareFactory |
hardwareFactory |
protected HardwareMap |
hardwareMap
the actual hardware map seen by the user
|
protected HardwareMap |
hardwareMapExtra
the hardware map in which we keep any extra devices (ones not used by the user) we need to instantiate
|
static java.lang.String |
NO_VOLTAGE_SENSOR
This string is sent in the robot battery telemetry payload to identify
that no voltage sensor is available on the robot.
|
protected java.lang.Object |
refreshUserTelemetryLock |
protected double |
robotBatteryInterval |
protected double |
robotBatteryLoggingInterval |
protected ElapsedTime |
robotBatteryLoggingTimer |
protected MovingStatistics |
robotBatteryStatistics |
protected ElapsedTime |
robotBatteryTimer |
protected BatteryChecker |
robotControllerBatteryChecker |
protected double |
robotControllerBatteryCheckerInterval |
protected android.content.Context |
robotControllerContext |
static java.lang.String |
TAG |
protected double |
updateUIInterval |
protected ElapsedTime |
updateUITimer |
protected double |
userTelemetryInterval |
protected ElapsedTime |
userTelemetryTimer |
Constructor and Description |
---|
FtcEventLoopHandler(HardwareFactory hardwareFactory,
UpdateUI.Callback callback,
android.content.Context robotControllerContext) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected static void |
closeAutoCloseOnTeardown(HardwareMap hardwareMap) |
protected void |
closeBatteryMonitoring() |
protected static void |
closeHardwareMap(HardwareMap hardwareMap) |
protected static void |
closeMotorControllers(HardwareMap hardwareMap) |
protected static void |
closeServoControllers(HardwareMap hardwareMap) |
void |
displayGamePadInfo(java.lang.String activeOpModeName) |
EventLoopManager |
getEventLoopManager() |
java.util.List<LynxUsbDeviceImpl> |
getExtantLynxDeviceImpls() |
Gamepad[] |
getGamepads() |
<T> T |
getHardwareDevice(java.lang.Class<? extends T> classOrInterface,
SerialNumber serialNumber,
<any> usbScanManagerSupplier)
Returns the device whose serial number is the one indicated, from the hardware map if possible
but instantiating / opening it if necessary.
|
HardwareMap |
getHardwareMap() |
java.lang.String |
getOpMode(java.lang.String extra) |
void |
init(EventLoopManager eventLoopManager) |
void |
refreshUserTelemetry(TelemetryMessage telemetry,
double requestedInterval)
Updates the (indicated) user's telemetry: the telemetry is transmitted if a sufficient
interval has passed since the last transmission.
|
void |
restartRobot() |
void |
sendBatteryInfo()
Send robot phone power % and robot battery voltage level to Driver station
|
void |
sendTelemetry(java.lang.String tag,
java.lang.String msg) |
void |
updateBatteryStatus(BatteryChecker.BatteryStatus status) |
public static final java.lang.String TAG
public static final java.lang.String NO_VOLTAGE_SENSOR
protected static final boolean DEBUG
protected final UpdateUI.Callback callback
protected final HardwareFactory hardwareFactory
protected final android.content.Context robotControllerContext
protected EventLoopManager eventLoopManager
protected BatteryChecker robotControllerBatteryChecker
protected double robotControllerBatteryCheckerInterval
protected ElapsedTime robotBatteryTimer
protected double robotBatteryInterval
protected MovingStatistics robotBatteryStatistics
protected ElapsedTime robotBatteryLoggingTimer
protected double robotBatteryLoggingInterval
protected ElapsedTime userTelemetryTimer
protected double userTelemetryInterval
protected final java.lang.Object refreshUserTelemetryLock
protected ElapsedTime updateUITimer
protected double updateUIInterval
protected HardwareMap hardwareMap
protected HardwareMap hardwareMapExtra
public FtcEventLoopHandler(HardwareFactory hardwareFactory, UpdateUI.Callback callback, android.content.Context robotControllerContext)
public void init(EventLoopManager eventLoopManager)
public void close()
protected static void closeHardwareMap(HardwareMap hardwareMap)
public EventLoopManager getEventLoopManager()
public HardwareMap getHardwareMap() throws RobotCoreException, java.lang.InterruptedException
RobotCoreException
java.lang.InterruptedException
public java.util.List<LynxUsbDeviceImpl> getExtantLynxDeviceImpls()
public <T> T getHardwareDevice(java.lang.Class<? extends T> classOrInterface, SerialNumber serialNumber, <any> usbScanManagerSupplier)
classOrInterface
- the interface to retrieve on the returned objectserialNumber
- the serial number of the object to retrieveusbScanManagerSupplier
- how to get a USBScanManager
if it ends up we need onepublic void displayGamePadInfo(java.lang.String activeOpModeName)
public Gamepad[] getGamepads()
public void refreshUserTelemetry(TelemetryMessage telemetry, double requestedInterval)
telemetry
- the telemetry data to sendrequestedInterval
- the minimum interval (s) since the last transmission. NaN indicates
that a default transmission interval should be usedEventLoop.TELEMETRY_DEFAULT_INTERVAL
public void sendBatteryInfo()
public void sendTelemetry(java.lang.String tag, java.lang.String msg)
protected static void closeMotorControllers(HardwareMap hardwareMap)
protected static void closeServoControllers(HardwareMap hardwareMap)
protected static void closeAutoCloseOnTeardown(HardwareMap hardwareMap)
protected void closeBatteryMonitoring()
public void restartRobot()
public java.lang.String getOpMode(java.lang.String extra)
public void updateBatteryStatus(BatteryChecker.BatteryStatus status)