Windows 10, Xbox Controller and Drones (Oh yeah)
Drones! It's been like forever since we've highlighted drones here, so when I saw this and that Shahed Chowdhuri not only used an Xbox Controller but also Windows 10, well heck, there's no way I could pass that up!
I recently started playing around with an AR Drone 2.0 by Parrot. There is a companion app available on iOS, Android and Windows 8. But I really wanted to use my Xbox controller for better control, and also tweak the app to make improvements and add functionality.
Like any efficient software developer, I set out to look for some existing code out there, so that I could tinker with it and build upon it. I found the source code for a Windows Store app on Github:
- Source code on Github: https://github.com/ARDrone2Windows/SDK
The last update to this repo was Summer 2013 (about 2 years ago, as of this blog post), so I wasn’t sure if the code would work on my current machines. It turns out that the store app was built for Windows 8, before the Windows 8.1 update.
I tried it out on 2 devices:
- Laptop running Windows 8.1, Visual Studio Premium 2013
- Surface Pro 3 running Windows 10 Tech Preview, Visual Studio 2013 Community Edition
On both machines, I was able to run the app and fly the drone. I would recommend updating the Windows 8 store app projects to retarget Windows 8.1. This can be done by right-clicking any 8.0 store app project and then choosing the “Retarget…” option.
wireless Xbox One controller as well.
Up, Up and Away
To run the app and connect to the drone, you should go through the following steps:
- Insert fully-charged battery into drone.
- Place drone on the ground in an open area.
- Connect Windows laptop/tablet to drone’s internal wifi.
- Download the source code from the GitHub repo mentioned above.
- Open the “ArDrone2 solution, and dismiss any popups asking about Source Control.
- (Optional) Update Windows 8 projects to Windows 8.1. (This will run on Windows 10)
- Enable Nuget Package Restore, then Build Solution (F6 on Visual Studio)
- Ensure that “ARDrone2.Sample.W8″ is set as Startup Project.
- Connect an Xbox controller, then Run the program (F5 on Visual Studio).
- Verify that a green check mark appears on the top right area within the app.
Once the app is running and connected, you can start flying right away!
- Click the Flying tile on the left side of the app.
- On the controller, click the Start button (Menu button on Xbox One controller).
- Use the left thumbstick to lunge forward/backward or strafe left/right.
- Use the right thumbstick to rise/fall up or down or rotate left/right.
- If you’re low to the ground, use the Back button (View button on Xbox One controller) to drop immediately.
I tried clicking the picture icon (or clicking A) on the controller to trigger a picture, but couldn’t get the picture functionality to work with the Windows app, built from the GitHub source code.
NOTE: The official app on the Windows Store appears almost identical to the GitHub project, but it was updated as recently as March 2015. Also, the photo feature appears to work without any issues, in the official app. I inserted a USB stick and was able to capture photos from the drone using the app that I downloaded from the Windows Store.
But this blog post is about the source code found on GitHub. So, I’ll continue to tinker with it…
The GitHub page for the aforementioned project does have a discussion thread about the TakePicture() method, but the suggested solution (USB stick + FTP access) didn’t work for me. I didn’t get any error message, but I didn’t see any pictures being captured on my machine or on a USB stick connected to the drone.
So, my next step is to troubleshoot the picture-taking feature, and possibly write my own routines.