ar-drone-socket.io-proxy

Proxy AR.Drone UDP messages over a Socket.io HTTP connection

Stars
17

ar-drone-socket.io-proxy

This client-server package is part of my DroneGames 2012 entry, where I attempt to control an AR.Drone over a Verizon 4G LTE cellular connection.

Instructions

This setup is broken up into 3 parts:

  • The "relay server"
  • The AR.Drone 2.0 iteself - the "receiver"
  • The program which sends commands to control the drone - the "sender"

Relay Server

The "relay server" is a node.js script that binds to TCP ports 8080 and 8081. It awaits for an AR.Drone to connect to the "socket.io" server over the internet, and relays any "client" UDP activity over the HTTP connection to finally reach the AR.Drone.

The "relay server" should ideally be a server that has a predictable hostname (i.e. static IP) because you will be contacting the relay server from both the AR.Drone and the "client".

Forwarding ports

The relay server should be a remote server where you have access to TCP ports 8080 and 8081.

I chose to set the relay server up on my Mac Mini at my home, and forward the ports through my Time Capsule using Airport Utility:

Start the "relay server"

To start the "relay server", simply execute:

$ node relay-server.js

Leave it running while "droning"...


The AR.Drone - "receiver"

I used velcro to strap the MiFi to the top of the indoor hull of the AR.Drone.

On the drone itself I have running a "receiver client" which establishes a connection to the remote "relay server" over the MiFi's cellular connection.

The MiFi

I set the MiFi up to use WEP encryption (rather than the default WPA2 encryption), and renamed the ESSID to something that didn't contain any spaces (natefi in this case).

Be sure the MiFi is on and broadcasting before going to the next step...

Prepare Drone to run the receiver client

You can use ftp to transfer the node executable, the socket.io-client module, the receiver.js and ports.js files to the AR.Drone. The username is "anonymous" with no password.

$ ftp 192.168.1.1
...

Connect drone to MiFi

The drone needs to connect to the MiFi as a wifi client and then run the receiver.js program. The connect.js script does this for us nicely:

  1. Power up AR.Drone
  2. Connect to access point ardrone2_058438 on laptop (or whatever your AR.Drone's ESSID is)
  3. Run node connect.js on your laptop, it will connect the drone to the MiFi and launch the "receiver" program
  4. At this point, the AR.Drone is ready to receive commands from the "relay server"

The controller - "sender"

The "sender" is the computer that is going to be sending commands to the AR.Drone over the MiFi connection. To begin you need to run the "sender.js" script in order to bind the AR.Drone ports locally:

$ node sender.js

Once that is running you can send AR.Drone commands to "localhost". Some recommended "controllers":

You can also telnet directly to the drone over the MiFi connection by connecting to port 2223:

$ telnet localhost 2223