Instructional Material: Deploying Code over WiFi

Printer-friendly version

As you have no doubt learned, deploying code with a USB cable is time consuming and means taking the controller phone off the robot. When you are developing actual robot code, you will be doing this a lot. There is a better way.

You can deploy your code over a WiFi network instead of using a cable. This is much quicker and leaves the controller phone on the robot. Here are the instructions on how to do it using either a WiFi router or WiFi Direct.

With a local area network created by a WiFi router, you can connect your development PC to and the robot controller phone to that network. On the phone, go to Settings, WiFi, and select the local network created by the router and connect to it. You should mark it to automatically connect. After connecting, on the lower right of the available WiFi networks display is a three dot menu. Open it and go to Advanced. Scroll to the bottom looking for the IP Address. This is the address assigned to the phone by the router. This IP address needs to be that same value every time the phone connects. If you see this not happening, you will need to configure the router's DHCP component to assign a fixed IP address to the phone's hardware (MAC) address (shown above the IP address).

When this is done, upload the attached text file (Configure Wireless with ADB.txt) to a location on your development PC. Edit the file to reflect your phone's assigned IP address. Save the file and then rename it to change the extension from .txt to .bat. This will make it an executable command file. You should also create a shortcut to this file on your desktop as you will be running this command file often. Running this command (when connected via USB as discussed below) starts the Android Debug Bridge (ABD) app running on the phone and configures it to provide communication between the phone and your PC over WiFi.

With all this done, you attach the phone to the PC with the USB cable. When the PC has recognized the phone, run the command file. This will enable communication with the phone over the WiFi network using the phone's IP address. When the command file has completed, disconnect the phone and place on the robot. Now, when you compile in AS, the networked controller phone will be available as a deployment target. Compiled code will be sent to the phone over the network connection.

You can also use the WiFi Direct network created by the robot controller phone when the controller app is running instead of a router. On the controller app go to the settings menu and select Program & Manage. On the next screen you will see the name of the network created by the phone. On your development PC, connect to that network name and use the network pass code displayed on the phone. The IP address shown on the phone (without the :8080) should be used in the Configure Wireless with ADB command file. You will still need to connect the phone with a USB cable and run the command file to get ADB running. After that you can disconnect the cable and deploy code over the WiFi Direct connection.

 

Attached Resource: 
Material Type: 
Lecture/Presentation
Education Level: 
HW Platform: 
SW Platform: 
Interactivity Style: 
Audience: