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.
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"
The "relay server" is a node.js script that binds to TCP ports
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 "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".
The relay server should be a remote server where you have access to TCP ports
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.
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 (
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
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:
- Power up AR.Drone
- Connect to access point
ardrone2_058438on laptop (or whatever your AR.Drone's ESSID is)
node connect.json your laptop, it will connect the drone to the MiFi and launch the "receiver" program
- 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
$ telnet localhost 2223