public List<ControllerConfiguration> parse(InputStream is) throws RobotCoreException { this.parser = null; try { XmlPullParserFactory newInstance = XmlPullParserFactory.newInstance(); newInstance.setNamespaceAware(true); this.parser = newInstance.newPullParser(); this.parser.setInput(is, null); int next = this.parser.getEventType(); while (next != XmlPullParser.END_DOCUMENT) { ConfigurationType type = getConfigurationType(this.parser.getName()); if (next == XmlPullParser.START_TAG) { if (type == ConfigurationType.MOTOR_CONTROLLER) { this.controllerConfigurations.add(parseMotorController(true)); } if (type == ConfigurationType.SERVO_CONTROLLER) { this.controllerConfigurations.add(parseServoController(true)); } if (type == ConfigurationType.LEGACY_MODULE_CONTROLLER) { this.controllerConfigurations.add(parseLegacyModuleController()); } if (type == ConfigurationType.DEVICE_INTERFACE_MODULE) { this.controllerConfigurations.add(parseDeviceInterfaceModule()); } } next = this.parser.next(); } } catch (XmlPullParserException e) { RobotLog.w("XmlPullParserException"); e.printStackTrace(); } catch (IOException e2) { RobotLog.w("IOException"); e2.printStackTrace(); } return this.controllerConfigurations; }
public void run() { while (!Thread.interrupted()) { Iterator iterator = EventLoopManager.this.commandsToSend.iterator(); while (iterator.hasNext()) { Command command = (Command) iterator.next(); if (command.getAttempts() > 10) { RobotLog.w("Failed to send command, too many attempts: " + command.toString()); this.completedCommands.add(command); } else if (command.isAcknowledged()) { RobotLog.v("Command " + command.getName() + " has been acknowledged by remote device"); this.completedCommands.add(command); } else { try { RobotLog.v( "Sending command: " + command.getName() + ", attempt " + command.getAttempts()); EventLoopManager.this.socket.send(new RobocolDatagram(command.toByteArray())); } catch (RobotCoreException e) { RobotLog.w("Failed to send command " + command.getName()); RobotLog.logStacktrace(e); } } } EventLoopManager.this.commandsToSend.removeAll(this.completedCommands); this.completedCommands.clear(); try { Thread.sleep(100L); } catch (InterruptedException e) { return; } } }
public void promptAllianceColor() { while (true) { telemetry.addData("alliance color", "press [X] for blue or [B] for red"); if (gamepad1.x) { // blue this.color = AllianceColor.BLUE; break; } else if (gamepad1.b) { // red this.color = AllianceColor.RED; break; } try { waitOneFullHardwareCycle(); } catch (InterruptedException e) { RobotLog.e(e.getMessage()); } } while (!opModeIsActive()) { try { waitOneFullHardwareCycle(); } catch (InterruptedException e) { RobotLog.e(e.getMessage()); } } telemetry.clearData(); }
private void onConnectionDatagram(RobocolDatagram datagram) throws RobotCoreException { if (!datagram.getAddress().equals(this.currentPeerAddressAndPort)) { if (this.state == RobotState.DROPPED_CONNECTION) { this.reportRobotStatus(RobotState.RUNNING); } if (this.eventLoop != nullEventLoop) { this.currentPeerAddressAndPort = datagram.getAddress(); RobotLog.i( "new remote peer discovered: " + this.currentPeerAddressAndPort.getHostAddress()); try { this.socket.connect(this.currentPeerAddressAndPort); } catch (SocketException var4) { RobotLog.e("Unable to connect to peer:" + var4.toString()); } PeerDiscovery peerDiscovery = new PeerDiscovery(PeerType.PEER); RobotLog.v("Sending peer discovery packet"); RobocolDatagram dgPeerDiscovery = new RobocolDatagram(peerDiscovery); if (this.socket.getInetAddress() == null) { dgPeerDiscovery.setAddress(this.currentPeerAddressAndPort); } this.socket.send(dgPeerDiscovery); } } }
private void onCommandDatagram(RobocolDatagram datagram) throws RobotCoreException { Command command = new Command(datagram.getData()); if (command.isAcknowledged()) { this.commandsToSend.remove(command); } else { command.acknowledge(); this.socket.send(new RobocolDatagram(command)); Command[] commands = this.commandsReceived; int numCommands = commands.length; // See if this is a duplicate command for (int iCommand = 0; iCommand < numCommands; ++iCommand) { Command existingCommand = commands[iCommand]; if (existingCommand != null && existingCommand.equals(command)) { return; } } // Remember the command for subsequent duplicate detection this.commandsReceived[this.iCommandReceiveNext++ % this.commandsReceived.length] = command; // Process the silly thing try { this.eventLoop.processCommand(command); } catch (Exception e) { RobotLog.e("Event loop threw an exception while processing a command"); RobotLog.logStacktrace(e); } } }
@Override public final void stop() { super.stop(); this.opModeStarted = false; this.rgba.release(); this.gray.release(); if (!this.threader.isReady()) { this.thread.interrupt(); } this.timer.reset(); while (!this.threader.isReady() && this.timer.time() < 0.5D) { Thread.yield(); } if (!this.threader.isReady()) { RobotLog.e("*****************************************************************"); RobotLog.e("User Linear Op Mode took too long to exit; emergency killing app."); RobotLog.e("Possible infinite loop in user code?"); RobotLog.e("*****************************************************************"); System.exit(-1); } }
private void startEventLoopThread() throws RobotCoreException { try { this.reportRobotStatus(RobotState.INIT); this.eventLoop.init(this); Iterator var1 = this.syncdDevices.iterator(); while (var1.hasNext()) { SyncdDevice var2 = (SyncdDevice) var1.next(); var2.startBlockingWork(); } } catch (Exception var3) { RobotLog.w("Caught exception during looper init: " + var3.toString()); RobotLog.logStacktrace(var3); this.reportRobotStatus(RobotState.EMERGENCY_STOP); if (RobotLog.hasGlobalErrorMsg()) { this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg()); } throw new RobotCoreException("Robot failed to start: " + var3.getMessage()); } this.elapsedSinceHeartbeatReceived = new ElapsedTime(0L); this.reportRobotStatus(RobotState.RUNNING); this.eventLoopThread = new Thread(new EventLoopRunnable((EventLoopManager.SyntheticClass_1) null), "Event Loop"); this.eventLoopThread.start(); }
public static InetAddress determineBindAddress(InetAddress destAddress) { ArrayList<InetAddress> removeIPv6Addresses = Network.removeIPv6Addresses(Network.removeLoopbackAddresses(Network.getLocalIpAddresses())); for (InetAddress removeIPv6Address : removeIPv6Addresses) { InetAddress inetAddress = null; try { Enumeration inetAddresses = NetworkInterface.getByInetAddress(removeIPv6Address).getInetAddresses(); while (inetAddresses.hasMoreElements()) { inetAddress = (InetAddress) inetAddresses.nextElement(); if (inetAddress.equals(destAddress)) { return inetAddress; } } } catch (SocketException e) { if (inetAddress != null) { RobotLog.v( String.format( "socket exception while trying to get network interface of %s", inetAddress.getHostAddress())); } else { RobotLog.v("exception while trying to get remote address"); } } } return determineBindAddressBasedOnWifiP2pSubnet(removeIPv6Addresses, destAddress); }
private void scanResults(LinkedList<ScanResult> results) { @SuppressLint("UseSparseArrays") HashMap<Integer, Integer> frequencyCount = new HashMap<>(); for (ScanResult result : results) { WifiManager.calculateSignalLevel(result.level, 100); if (frequencyCount.get(result.frequency) == 0) { int count = frequencyCount.get(result.frequency); frequencyCount.put(result.frequency, ++count); } else { frequencyCount.put(result.frequency, 1); } RobotLog.d("Network on: " + wifiChannelMap.get(result.frequency)); } RobotLog.d("Done displaying networks!"); LinkedList<Map.Entry<Integer, Integer>> frequencies = new LinkedList<>(frequencyCount.entrySet()); Collections.sort( frequencies, new Comparator<Map.Entry<Integer, Integer>>() { @Override public int compare(Map.Entry<Integer, Integer> lhs, Map.Entry<Integer, Integer> rhs) { if (lhs.equals(rhs)) { return 0; } if (lhs.getValue() > rhs.getValue()) { return 1; } else if (lhs.getValue() < rhs.getValue()) { return -1; } else { return 0; } } }); if (frequencies.size() > 0) { int location = frequencies.size() - 1; mostCommon = wifiChannelMap.containsKey(frequencies.get(location).getKey()) ? wifiChannelMap.get(frequencies.get(location).getKey()) : "5 GHz"; } if (frequencies.size() > 1) { int location = frequencies.size() - 2; secondMostCommon = wifiChannelMap.containsKey(frequencies.get(location).getKey()) ? wifiChannelMap.get(frequencies.get(location).getKey()) : "5 GHz"; } recChannel = recommendedChannel(); }
/** * observation: this is may be thread-safe; it could be called concurrently (with different * telemetry objects). The core remaining issue is concurrent use of socket.send(). You would have * thought that that would have been thread-safe, but I forgot it's a local thing here not a * system thing. */ public void sendTelemetryData(Telemetry telemetry) { try { this.socket.send(new RobocolDatagram(telemetry.toByteArray())); } catch (RobotCoreException var3) { RobotLog.w("Failed to send telemetry data"); RobotLog.logStacktrace(var3); } telemetry.clearData(); }
public static void logStacktrace(RobotCoreException e) { RobotLog.e(e.toString()); for (StackTraceElement el : e.getStackTrace()) { RobotLog.e(el.toString()); } if (e.isChainedException()) { RobotLog.e("Exception chained from:"); if (e.getChainedException() instanceof RobotCoreException) { logStacktrace((RobotCoreException) e.getChainedException()); } else { logStacktrace(e.getChainedException()); } } }
@Override public void init() { wifiChannelMap = HashBiMap.create(); wifiChannelMap.put(2412, "2.4G Ch01"); wifiChannelMap.put(2417, "2.4G Ch02"); wifiChannelMap.put(2422, "2.4G Ch03"); wifiChannelMap.put(2427, "2.4G Ch04"); wifiChannelMap.put(2432, "2.4G Ch05"); wifiChannelMap.put(2437, "2.4G Ch06"); wifiChannelMap.put(2442, "2.4G Ch07"); wifiChannelMap.put(2447, "2.4G Ch08"); wifiChannelMap.put(2452, "2.4G Ch09"); wifiChannelMap.put(2457, "2.4G Ch10"); wifiChannelMap.put(2462, "2.4G Ch11"); wifiChannelMap.put(2467, "2.4G Ch12"); wifiChannelMap.put(2472, "2.4G Ch13"); wifiChannelMap.put(2484, "2.4G Ch14"); wifi = (WifiManager) hardwareMap.appContext.getSystemService(Context.WIFI_SERVICE); hardwareMap.appContext.registerReceiver( new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { LinkedList<ScanResult> results = new LinkedList<>(wifi.getScanResults()); scanResults(results); } }, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); wifi.startScan(); try { String absolutePath = hardwareMap.appContext.getFilesDir().getAbsolutePath() + "/"; RunShellCommand cmd = new RunShellCommand(); String output; if ((output = cmd.run( String.format( "cp /data/misc/wifi/p2p_supplicant.conf %sp2p_supplicant.conf \n", absolutePath))) .length() > 0) { RobotLog.e("Cannot copy p2p file" + output); operChannel = output; } String fileData = Files.toString(new File(absolutePath + "p2p_supplicant.conf"), Charset.defaultCharset()); String[] datas = fileData.split("/n"); for (String data : datas) { if (data.contains("p2p_oper_channel")) { operChannel = data.substring(data.indexOf("=")); } } } catch (IOException ex) { if (operChannel.equals("")) { operChannel = ex.getMessage(); } } }
protected void onCreate(Bundle var1) { super.onCreate(var1); this.setContentView(R.layout.digital_devices); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); this.a = new Utility(this); RobotLog.writeLogcatToDisk(this, 1024); LinearLayout var2 = (LinearLayout) this.findViewById(R.id.linearLayout_digital_device0); this.b = this.getLayoutInflater().inflate(R.layout.digital_device, var2, true); ((TextView) this.b.findViewById(R.id.port_number_digital_device)).setText("0"); LinearLayout var3 = (LinearLayout) this.findViewById(R.id.linearLayout_digital_device1); this.c = this.getLayoutInflater().inflate(R.layout.digital_device, var3, true); ((TextView) this.c.findViewById(R.id.port_number_digital_device)).setText("1"); LinearLayout var4 = (LinearLayout) this.findViewById(R.id.linearLayout_digital_device2); this.d = this.getLayoutInflater().inflate(R.layout.digital_device, var4, true); ((TextView) this.d.findViewById(R.id.port_number_digital_device)).setText("2"); LinearLayout var5 = (LinearLayout) this.findViewById(R.id.linearLayout_digital_device3); this.e = this.getLayoutInflater().inflate(R.layout.digital_device, var5, true); ((TextView) this.e.findViewById(R.id.port_number_digital_device)).setText("3"); LinearLayout var6 = (LinearLayout) this.findViewById(R.id.linearLayout_digital_device4); this.f = this.getLayoutInflater().inflate(R.layout.digital_device, var6, true); ((TextView) this.f.findViewById(R.id.port_number_digital_device)).setText("4"); LinearLayout var7 = (LinearLayout) this.findViewById(R.id.linearLayout_digital_device5); this.g = this.getLayoutInflater().inflate(R.layout.digital_device, var7, true); ((TextView) this.g.findViewById(R.id.port_number_digital_device)).setText("5"); LinearLayout var8 = (LinearLayout) this.findViewById(R.id.linearLayout_digital_device6); this.h = this.getLayoutInflater().inflate(R.layout.digital_device, var8, true); ((TextView) this.h.findViewById(R.id.port_number_digital_device)).setText("6"); LinearLayout var9 = (LinearLayout) this.findViewById(R.id.linearLayout_digital_device7); this.i = this.getLayoutInflater().inflate(R.layout.digital_device, var9, true); ((TextView) this.i.findViewById(R.id.port_number_digital_device)).setText("7"); }
private void reportRobotStatus(RobotState var1) { this.state = var1; RobotLog.v("EventLoopManager state is " + var1.toString()); if (this.eventLoopMonitor != null) { this.eventLoopMonitor.onStateChange(var1); } }
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.servos); PreferenceManager.setDefaultValues((Context) this, (int) R.xml.preferences, (boolean) false); this.a = new Utility((Activity) this); RobotLog.writeLogcatToDisk((Context) this, (int) 1024); this.d = (EditText) this.findViewById(R.id.servocontroller_name); LinearLayout linearLayout = (LinearLayout) this.findViewById(R.id.linearLayout_servo1); this.e = this.getLayoutInflater().inflate(R.layout.servo, (ViewGroup) linearLayout, true); TextView textView = (TextView) this.e.findViewById(R.id.port_number_servo); textView.setText((CharSequence) "1"); LinearLayout linearLayout2 = (LinearLayout) this.findViewById(R.id.linearLayout_servo2); this.f = this.getLayoutInflater().inflate(R.layout.servo, (ViewGroup) linearLayout2, true); TextView textView2 = (TextView) this.f.findViewById(R.id.port_number_servo); textView2.setText((CharSequence) "2"); LinearLayout linearLayout3 = (LinearLayout) this.findViewById(R.id.linearLayout_servo3); this.g = this.getLayoutInflater().inflate(R.layout.servo, (ViewGroup) linearLayout3, true); TextView textView3 = (TextView) this.g.findViewById(R.id.port_number_servo); textView3.setText((CharSequence) "3"); LinearLayout linearLayout4 = (LinearLayout) this.findViewById(R.id.linearLayout_servo4); this.h = this.getLayoutInflater().inflate(R.layout.servo, (ViewGroup) linearLayout4, true); TextView textView4 = (TextView) this.h.findViewById(R.id.port_number_servo); textView4.setText((CharSequence) "4"); LinearLayout linearLayout5 = (LinearLayout) this.findViewById(R.id.linearLayout_servo5); this.i = this.getLayoutInflater().inflate(R.layout.servo, (ViewGroup) linearLayout5, true); TextView textView5 = (TextView) this.i.findViewById(R.id.port_number_servo); textView5.setText((CharSequence) "5"); LinearLayout linearLayout6 = (LinearLayout) this.findViewById(R.id.linearLayout_servo6); this.j = this.getLayoutInflater().inflate(R.layout.servo, (ViewGroup) linearLayout6, true); TextView textView6 = (TextView) this.j.findViewById(R.id.port_number_servo); textView6.setText((CharSequence) "6"); }
@Override protected void onStart() { super.onStart(); // save 4MB of logcat to the SD card RobotLog.writeLogcatToDisk(this, 4 * 1024); Intent intent = new Intent(this, FtcRobotControllerService.class); bindService(intent, connection, Context.BIND_AUTO_CREATE); utility.updateHeader( Utility.NO_FILE, R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header); callback.wifiDirectUpdate(WifiDirectAssistant.Event.DISCONNECTED); entireScreenLayout.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { dimmer.handleDimTimer(); return false; } }); wifiLock.acquire(); }
/** * Writes a error message to the respective loggers. * * @param tag the log tag * @param mess the message to send * @see RobotLog#e(String) * @see RobotStatus#log(Level, String, String) * @see Level#SEVERE */ public static synchronized void e(String tag, String mess) { tag = checkNotNull(tag); mess = checkNotNull(mess); RobotLog.e(mess); getInstance().context.status().log(Level.SEVERE, tag, mess); }
/** * Writes a debug message to the respective loggers. * * @param tag the log tag * @param mess the message to send * @see RobotLog#setGlobalErrorMsg(String) * @see Log#wtf(String, String) */ public static synchronized void wtf(String tag, String mess, Exception ex) { tag = checkNotNull(tag); mess = checkNotNull(mess); ex = checkNotNull(ex); Log.wtf(tag, mess, ex); RobotLog.setGlobalErrorMsg(mess); }
@Override protected void onStop() { super.onStop(); if (controllerService != null) unbindService(connection); RobotLog.cancelWriteLogcatToDisk(this); }
public void handleDroppedConnection() { OpModeManager var1 = this.eventLoop.getOpModeManager(); String var2 = "Lost connection while running op mode: " + var1.getActiveOpModeName(); this.resetGamepads(); var1.initActiveOpMode("Stop Robot"); this.reportRobotStatus(RobotState.DROPPED_CONNECTION); RobotLog.i(var2); }
public void logOpModes() { int var1 = this.a.size() + this.opModeBasedRegister.size(); RobotLog.i("There are " + var1 + " Op Modes"); Iterator var2 = this.a.entrySet().iterator(); Entry var3; while (var2.hasNext()) { var3 = (Entry) var2.next(); RobotLog.i(" Op Mode: " + var3.getKey()); } var2 = this.opModeBasedRegister.entrySet().iterator(); while (var2.hasNext()) { var3 = (Entry) var2.next(); RobotLog.i(" Op Mode: " + var3.getKey()); } }
public void setEventLoop(EventLoop eventLoop) throws RobotCoreException { if (eventLoop == null) { eventLoop = nullEventLoop; RobotLog.d("Event loop cannot be null, using empty event loop"); } this.stopEventLoopThread(); this.eventLoop = eventLoop; this.startEventLoopThread(); }
public void run() { while (true) { RobocolDatagram datagram = EventLoopManager.this.socket.recv(); // what's the timeout? if (EventLoopManager.this.receivingProhibited || EventLoopManager.this.socket.isClosed()) { return; } if (datagram == null) { Thread.yield(); } else { if (RobotLog.hasGlobalErrorMsg()) { EventLoopManager.this.buildAndSendTelemetry( "SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg()); } try { switch (EventLoopManager.SyntheticClass_1.a[datagram.getMsgType().ordinal()]) { case 1: EventLoopManager.this.onGamepadDatagram(datagram); break; case 2: EventLoopManager.this.onHeartbeatDatagramReceived(datagram); break; case 3: EventLoopManager.this.onConnectionDatagram(datagram); break; case 4: EventLoopManager.this.onCommandDatagram(datagram); break; case 5: EventLoopManager.this.onEmptyDatagram(); break; default: EventLoopManager.this.onUnknownDatagram(datagram); } } catch (RobotCoreException var3) { RobotLog.w("RobotCore event loop cannot process event: " + var3.toString()); } } } }
public static InetAddress determineBindAddressBasedOnIsReachable( ArrayList<InetAddress> localIpAddresses, InetAddress destAddress) { for (InetAddress inetAddress : localIpAddresses) { try { if (inetAddress.isReachable(NetworkInterface.getByInetAddress(inetAddress), TTL, TIMEOUT)) { return inetAddress; } } catch (SocketException e) { RobotLog.v( String.format( "socket exception while trying to get network interface of %s", inetAddress.getHostAddress())); } catch (IOException e2) { RobotLog.v( String.format( "IO exception while trying to determine if %s is reachable via %s", destAddress.getHostAddress(), inetAddress.getHostAddress())); } } return Network.getLoopbackAddress(); }
private void onGamepadDatagram(RobocolDatagram datagram) throws RobotCoreException { Gamepad var2 = new Gamepad(); var2.fromByteArray(datagram.getData()); if (var2.user >= 1 && var2.user <= 2) { int var3 = var2.user - 1; this.gamepads[var3].copy(var2); if (this.gamepads[0].id == this.gamepads[1].id) { RobotLog.v("Gamepad moved position, removing stale gamepad"); if (var3 == 0) { this.gamepads[1].copy(new Gamepad()); } if (var3 == 1) { this.gamepads[0].copy(new Gamepad()); } } } else { RobotLog.d("Gamepad with user %d received. Only users 1 and 2 are valid"); } }
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.motors); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); this.f184a = new Utility(this); RobotLog.writeLogcatToDisk(this, 1024); this.f189f = (EditText) findViewById(R.id.controller_name); this.f192i = (CheckBox) findViewById(R.id.checkbox_port7); this.f193j = (CheckBox) findViewById(R.id.checkbox_port6); this.f194k = (EditText) findViewById(R.id.editTextResult_analogInput7); this.f195l = (EditText) findViewById(R.id.editTextResult_analogInput6); }
private DeviceConfiguration parseDeviceConfiguration() { ConfigurationType type = getConfigurationType(this.parser.getName()); String name = this.parser.getAttributeValue(null, "name"); int port = Integer.parseInt(this.parser.getAttributeValue(null, "port")); boolean enabled = !(name.equalsIgnoreCase(DeviceConfiguration.DISABLED_DEVICE_NAME)); DeviceConfiguration deviceConfiguration = new DeviceConfiguration(port, type, name, enabled); if (DEBUG) { RobotLog.e("[handleDevice] name: " + name + ", port: " + port + ", type: " + type); } return deviceConfiguration; }
public static boolean CheckIfIFC() { boolean bl = false; String string = Build.BOARD; String string2 = Build.BRAND; String string3 = Build.DEVICE; String string4 = Build.HARDWARE; String string5 = Build.MANUFACTURER; String string6 = Build.MODEL; String string7 = Build.PRODUCT; RobotLog.d( "Platform information: board = " + string + " brand = " + string2 + " device = " + string3 + " hardware = " + string4 + " manufacturer = " + string5 + " model = " + string6 + " product = " + string7); if (string.equals("MSM8960") && string2.equals("qcom") && string3.equals("msm8960") && string4.equals("qcom") && string5.equals("unknown") && string6.equals("msm8960") && string7.equals("msm8960")) { RobotLog.d("Detected IFC6410 Device!"); bl = true; } else { RobotLog.d("Detected regular SmartPhone Device!"); } return bl; }
public static InetAddress determineBindAddressBasedOnIsReachable( ArrayList<InetAddress> localIpAddresses, InetAddress destAddress) { Iterator it = localIpAddresses.iterator(); while (it.hasNext()) { InetAddress inetAddress = (InetAddress) it.next(); try { if (inetAddress.isReachable(NetworkInterface.getByInetAddress(inetAddress), TTL, TIMEOUT)) { return inetAddress; } } catch (SocketException e) { RobotLog.m254v( String.format( "socket exception while trying to get network interface of %s", new Object[] {inetAddress.getHostAddress()})); } catch (IOException e2) { RobotLog.m254v( String.format( "IO exception while trying to determine if %s is reachable via %s", new Object[] {destAddress.getHostAddress(), inetAddress.getHostAddress()})); } } return Network.getLoopbackAddress(); }
public void waitMillis(long ms) { long targetTime = System.currentTimeMillis() + ms; while (System.currentTimeMillis() < targetTime) { telemetry.addData( "wait", Double.toString(Math.round((double) (targetTime - System.currentTimeMillis()))) + "ms until next action"); try { waitOneFullHardwareCycle(); } catch (InterruptedException e) { RobotLog.d(e.getMessage()); } } }