As promised in my previous post (“Hard Reset“), these articles will be coming in much more regularly now that I have a place to properly fly and test the drone in. Progress has already started to build 🙂
Over the last 24 hours the project has gone from sending the drone off on a pre-programmed flight, to enabling manual control through a laptop. Thanks to some helpful signposting of a fellow student at Brunel (Ben Evans – thanks for the advice!), I was able to implement Webflight (all credit to Laurent Eschenauer (eschnou) for building and providing this application). Below is a screenshot of me and two of my coursemates getting this working today, taken from the front camera of my drone.
This program uses NodeJS to connect with the drone, display a live video stream straight to a web browser (“localhost:3000”) while also enabling the user to manually navigate the drone around using the keyboard. If you’d like to use Webflight yourself, below are some tips that helped me get up and running with it that should hopefully help you get set up and flying in no time at all:
- Make sure you’ve done the tutorial over on the Instructables site as described in my earlier post, takeOff();. This guide provides a great foundation to help you understand NodeJS and the npm library usages in a practical manner and will greatly help you in getting to grips with further drone/NodeJS/npm related work.
- Completing the Instructables tutorial will ensure that you have a separate “Drone” folder, as well as NodeJS and Ffmpeg installed so is a good head start!
- Visit the Webflight Github page and spend some time reading the README.md file, the author has spent considerable time and thought to provide a comprehensive guide to the application.This guide is immensely useful if you follow it word-for-word
- If (like me) you are too keen to get the drone airborne and think you know best, you might end up spending quite a bit of time rectifying your mistakes later on!
- To be 100% clear, install git, NodeJS and ffmpeg before starting to work on the Webflight installation.
- Also, make sure that your PATH (environment variable) includes a reference to “c:\…\Ffmpeg\bin\”, “c:\…\nodejs\”, “c:\…npm\ and “c:\…\Git\bin” once all of these have been installed on your machine through the hyperlinks in “3.”.
- Using Git Bash, clone the Webflight project into your Drone folder (see Instructables tutorial) on your laptop as shown in the first step of the Install instructions on the Github page.
- I’d recommend going over the Git and Github tutorials on The New Boston’s Website if you’re new to Git and/or Git Bash.
- Open up windows command prompt to complete the second and third lines of the Install guide on the Github page, ensuring you have used “cd ” to navigate into the Webflight folder
- The fourth/final line about installing Bower caused me some issues as it couldn’t find Git on the laptop I was using so here’s what happened:
- Firstly, make sure you run “npm install –global bower” instead and make sure you’re running the command in the Webflight folder that you cloned (see step two in the Install guide)
- Checked environment variables, Git was in there
- Ran “npm install –global bower” through Command Prompt as administrator, no change on the output
- Ran the same command in Git Bash (while inside the Webflight folder) and success! I have no idea why this worked, it just did!
- The initial control layout is not in QWERTY format, to change this edit the config.js file and save it
If you follow the guide on the Github page and use the above for reference, you should be fine. The Bower install issue was by far the biggest pain as this resulted in only seeing a blank webpage with the Webflight banner at the top when the app was running. Once all the above it set up, it’s as simple as connecting to the drone’s WiFi, executing the program in Command Prompt (cd to Webflight folder and type “node app.js”) and entering “localhost:3000” in a new web browser window or tab.
The above has been more of a how-to style post as this caused me a little trouble while setting it up so below I’ll talk about why I chose this existing application as part of my project.
When determining the best means of approaching drone programming there were several options out there in various different languages (see “Hard Reset”). Considering all of the available options, it became obvious to me that NodeJS is the most established and well documented means of creating drone applications for beginners. As I am a beginner and this project isn’t about me reinventing the wheel in terms of drone control, this offered the best platform for me to get on with programming a meaningful solution towards the objectives of my dissertation.
- Semi-autonomous navigation – upon request of user (JS)
- Autonomous detection of objects (JS)
- Image capture (JS)
- Image comparison (Java)
Bundling all of this together in a Java project will enable a single point of usage, alleviating text-based input requirements of the user and allowing an image comparison function to be implemented in the same project (comparing a past and present version of a structure for differences). All in good time though…
So there you go, I’ll keep posting as this project progresses and hopefully provide some content to help other beginners get into drone programming 🙂
Thanks for reading,