Search This Blog

Thursday, June 30, 2016

AR Drone 2.0 Automated Panaramos

https://github.com/eschnou/ardrone-panorama.git provides a really cool npm ar drone ponarama software.  Now once you have installed it, you can start taking panoramas!  All you need to do is to connect to your AR-drone on your computer and type "node panorama -h5"(The five would cause the drone to take the panorama at five meters in the air; you can change the height settings).  The terminal will now start displaying messages related to the calibration and picture taking process (such as which picture it is on).  During the flight, all the photos will be taken as a .png and be stored in the bin folder of the panorama folder.  In addition, a flight log will be created under the name of navdata-date.txt.  Then, in CMD, type:

var arDrone = require('ar-drone');
var client = arDrone.createClient();
client.land();

Since the drone takes the panoramas in separate pieces, you will now need to stitch the photos together with a panorama stitching software.  You can do it with Photoshop, here, or with a great free program made for panorama stitching called Hugins (you can download it here).
Some extra things you can do is by editing the original javascript file (it is located in ardrone-panorama\lib and is called panorama.js).  The original author of this file, Laurent Eschenauer, left a lot of instructions and comments on how the program was coded; this would allow you to change the settings of the automated panorama.  One thing I changed was the amount of photos it took for the panorama.  You can also do this by opening panorama.js in notepad and changing the number in the line in  "this._pictures = options.pictures ||."
I will post more tutorials about the AR-Drone and node.js later on... Stay Tuned!!!☺

Wednesday, June 29, 2016

AR-drone Programming Update

About a month ago, I posted an article about controlling the A.R. Drone with the computer.  Since my last post, I have learned a lot about coding the drone.  I've got it to move around with the computer and I 've made pre-scripted codes that run directly from Node.js command prompt.  

Here are a few examples of the coding I have done :
var arDrone = require('ar-drone');
var client = arDrone.createClient();
client.takeoff();
client
  .after(5000, function() {
    this.clockwise(0.5);
  })
  .after(3000, function() {
    this.front(1.0);
  })
  .after(1000, function() {
    this.stop();
    this.land();
  });
This will make the drone take off, rotate, fly forward, and land.
var arDrone = require('ar-drone');
 var http    = require('http');
 console.log('Connecting png stream ...');
 var pngStream = arDrone.createClient().getPngStream();
 var lastPng;
 pngStream
   .on('error', console.log)
   .on('data', function(pngBuffer) {
     lastPng = pngBuffer;
   });
 var server = http.createServer(function(req, res) {
   if (!lastPng) {
     res.writeHead(503);
     res.end('Did not receive any png data yet.');
     return;
   }
   res.writeHead(200, {'Content-Type': 'image/png'});
   res.end(lastPng);
 });
 server.listen(8080, function() {
   console.log('Serving latest png on port 8080 ...');
});
This will stream the video live (you will need ffmpeg installed for this to work) from the drone into your browser at http://localhost:8080/ (this trick was taught to me by instructables)
var arDrone = require('ar-drone');
var client = arDrone.createClient();
client.config('control:altitude_max', 100000);
Since the Ar-drone module sets the default max height to three meters, this code would set it to 100 meters.
var arDrone = require('ar-drone');
var client = arDrone.createClient();
client.takeoff();
client
  .after(5000, function() {
 this.animate('flipLeft', 15);
})
  .after(1000, function() {
    this.stop();
    this.land();
  });
This code would make the drone to a flip.  I recommend that you add a height code to make sure the drone does not hit the ground during the flip.
To control your drone from your browser, download nodecopter-monitor:
:
var arDrone = require('ar-drone'),
    client = arDrone.createClient();
require('nodecopter-monitor').init(client);
For the list of controls, click here.
For more amazing modules (such as AI flying and taking panaromas go to www.nodecopter.com)


Currently, I am working on getting the A.R. Drone to identify and follow the commands of QR codes.  Right now, all I know is that one would need opencv and qrar (can only be used if you have ffmpeg, gtk, and npm).  
Some people might wonder how to control the small Bluetooth drones.  My friends and I have found an app for the ipad/iPhone to control it.  The app is called "Tickle."  It has a Scratch-like interface (drag and drop coding) and is very easy to use.  We held a competition to see who can get it to fly a definite path (it was very hard to manipulate the distance variables) and land at the right destination.  
I will post more stuff about A.R. Drone programming later on.  Stay tuned!

Ar-drone controlled by PC


This week, I met up with a few of my friends and decided to attempt to control an A.R. drone from a computer.  I was a very complicated process and we made many mistakes.  However, today, we were able to get it to take off after two days of research and tests!  Some sources we used to figure the process out included stackoverflow, nodecopter, instructables, and yahoo answers.  In this post, I will describe to you what we did and how you will be able to code and control your A.R. Drone from your computer!
All you really need is the ar drone module from npm.

var arDrone = require('ar-drone');
var client = arDrone.createClient();
client.takeoff();
client.land();


Yay!  Now your drone should have taken off and landed.  Our project is still in development.  Any updates will be posted.