RIOdroid: RoboRIO + Android USB Communication

I’ve been working on this for a while and I’m finally to the point where I think it might be useful to other teams. This is still very young and will need a lot of work before it ever becomes really useful.

The basic idea for the project is to be able to use the power of inexpensive Android devices on FRC robots. Android devices are getting faster and cheaper and they include many sensors and also a mature code base to draw from.

What has been accomplished so far?

  • Complied Android Debug Bridge (ADB) for the roboRIO
  • Modified jadb and usb4java to work with the roboRIO
  • A port forwarding solution between an Android Device and external ports on the roboRIO (This allows for IP Webcam apps to work on the Android device)
  • Simple install script for copying over the needed files and installing needed packages on the roboRIO
  • None of this requires a rooted android device, so it can be used with most cheap pre-paid phones, etc.

Project Home: RIOdroid on Github

What can you currently do?

  • Forward ports from an Android device to the roboRIO and external ports
  • Run ADB commands from your Java code (including running Android shell commands from Java)
  • use LibUSB commands in Java (This will allow you to setup your roboRIO as an Android Accessory)

Most useful thing you can currently do.

  • Auto start a webcam server (like IP Webcam) and forward that port so you can view the video on your driverstation laptop with the web interface controls
  • RIOdroid-test project does this on boot, just have your android device running the webcam server on port 8080, connect the device to the roborio and power on the roborio, go to roborio-XXXX.local:8080 to view the video.

I’m not much of a programmer (anyone looking at the project can probably tell that) I just do it for FRC. If anyone with experience wants to help work on this please let me know. This is just a side project for me that I think could have some cool applications in the future.

Sounds cool… I think?

If all you’re doing is using it as an interface for displaying information, maybe sending a bit of data, and viewing camera streams, why not just write a smart dashboard client for android? Network tables has java bindings and everything…

Please speak up if I’m missing something here…

That’s one of the eventual goals. You still need to able to launch apps from the roboRIO side to make sure it’s actually running during a match, etc. Having ADB running on the roboRIO is very helpful for that sort of thing. This is also so we can run it during a match so it needs to be a wired connection that’s where getting USB networking and port forwarding working comes in.

Why would you want the RoboRIO to control the phone? Launching an app during the match doesn’t seem like a really key/useful feature. Why not just launch the app once the robot boots? Although it occurs to me that for network tables stuff you’d have to figure out how to connect the android phone to the network… not sure what the rules are about that stuff and if that’s even possible.

I would want the robot to be able to ensure that the app is loaded and to reload it if it crashes, etc. For network tables it works with ADB because you can virtually forward a port over the USB connection.