Skip navigation

Node.js & PHP Client-Server Platform for Parrot AR.Drone

As part of our drone research, we developed a platform to talk to the drone from a local server that is easy to set-up and use. Communication to and from the client through the HTTP interface using cURL in PHP and Node.js. cURL is a command line tool that allows a user to make HTTP requests in PHP. Node.js is a runtime environment for running applications as a socket and HTTP communicator. The HTTP and socket allow Node.js to act as a web server. We use Node.js because it serves as a client for the Parrot AR.Drone.
We combined Node.js and cURL to communicate with and execute commands to the drone. We named the PHP file process.php which includes the cURL command line and the form where users enter and submit commands. The Node.js file is called php_bridge.js which includes the code that will tell the drone to execute the entered command.
The Process:
The user will open the php_bridge.bat file to execute the node and will open the process.php file in the browser. In the browser, the user is introduced to a form where they will be asked to enter a command they want the drone to do. Once the user presses submit, the input they submittedl goes through a filter using FILTER_SANITIZE_STRING and into the function notifyNode() which is called by cURL. cURL takes that input and sends it to the Node client. Both cURL and the Node client are on the same server ( port 3000). We created a http:createServer functionin php_bridge.js and expanded on it to listen for incoming inputs from our localhost (cURL). Inside the http:createServer function, we parse the user input to only include the command the user indicated using url.parse and query.cmd. The command is then sent as a parameter to the function handleServerNotice(). When the function is called, the command goes through a list of if-statements to find the command in relation to the user input. The command will execute and the user and input another command if they wish.
Currently, the platform supports commands like takeoff, land, stop, left, right, up, down, front, back, clockwise, counter-clockwise. We are working on making all the commands buttons instead of user inputs to increase response time and decrease any typing errors.
To Do: Mavelink integration and sending remote way points