Friday, 6 November 2015

Parrot Rolling Spider Drone

Hey Friends,
I am back again with some projects that I am currently working on. I would love to hear new possibilities as well as what could be done to improve the same.

I recently got my hands on the Parrot rolling spider drone. It is a small sized drone of around the size of a palm that can be controlled by Bluetooth BLE. I selected the following setup:



The round thingies are IR reflector markers which I am using in the lab setting along with Optitrack cameras to keep track of the drones position. I intend the drone to be able to do certain tasks autonomously such as going from one point of area to other or traversing through a series of waypoints or maybe following another ground bot. I also aim to develop voice controlled app to control the drones via speech.

I order to achieve my goal, I started off with controlling the drone manually from any PC. To do so, I came across a wonderful library:

This library can be used to hack the rolling spider or send commands to the rolling spider. The link is self sufficient, but I would like to reiterate it here. Please follow the following steps to be able to use the library:
  1. Install Nodejs.
    The link for the same is:
    https://nodejs.org/en/
  2. Install Python v2.7.3(recommended)
    The link for it is:
    https://www.python.org/download/releases/2.7.3/#download

    After this, we need to add the path variable for python.exe.
  3. Install Microsoft Visual Studio C++ 2013(Express Edition)
    The link:
    http://www.microsoft.com/en-gb/download/details.aspx?id=44914
  4. Windows 7 SDK.
    The link :
    http://www.microsoft.com/en-us/download/details.aspx?id=8279
  5. Install node-gyp.
    The zip file for the same needs to be downloaded from:
    https://github.com/nodejs/node-gyp#installation

    It can be installed by executing the following command in command prompt.:
    npm install -g node-gyp
  6. Next u need a bluetooth 4.0 BLE adapter. Then the driver needs to changed to Winusb using the zadig tool.
    The link for the same is:
    http://zadig.akeo.ie/
  7. Install Noble. It is a node.js BLE central module. The link and detailed information can be found on:
    https://github.com/sandeepmistry/noble#prerequisites

    The zip file needs to downloaded from the link. It can be installed through command prompt by the following command:
    npm install -g noble
  8. Now we go to the last step, that is installing the rolling-spider library.
    For this download the zip file from:
    https://github.com/voodootikigod/node-rolling-spider

    To install, do it through command prompt:
    npm install rolling-spider
More information can be found on the libraries in the respective links given by the developers. Its simply amazing :)

So, now we are all set to be able to get our drone flying. We need to type in a set of actions using the rolling-spider library to command the drone. I started off with controlling the drone via keypress events. The code can be seen below:


'use strict';

var RollingSpider = require('rolling-spider');
var temporal = require('temporal');
var rollingSpider = new RollingSpider();

var keypress = require('keypress');



rollingSpider.connect(function () {
  rollingSpider.setup(function () {
    rollingSpider.flatTrim();
    rollingSpider.startPing();
    rollingSpider.flatTrim();
console.log('Now Active for receiving commands');
keypress(process.stdin);
console.log('\n');
console.log('Give your input');
// listen for the "keypress" event
process.stdin.on('keypress', function (ch, key) {
  console.log('got "keypress"', key.name);
  if (key && key.ctrl && key.name == 'c') {
    process.stdin.pause();
  }
  else if (key && key.name == 'w') {
    
console.log('Going forward');

rollingSpider.forward({step:10, speed: 30});
rollingSpider.flatTrim();
  }

  else if (key && key.name == 's') {
    
console.log('Going backward');
          rollingSpider.backward({steps: 15, speed: 20});
        
  }
  
   else if (key && key.name == 'a') {
    
          console.log('Going left');
          rollingSpider.tiltLeft({steps: 15, speed: 20});
        
  } 
  
   else if (key && key.name == 'd') {
    
          console.log('Going right');
          rollingSpider.tiltRight({steps: 15, speed: 20});
        
  }

  else if (key && key.name == 't') {
    
 console.log('Getting ready for takeOff!');
          rollingSpider.takeOff();       
  }

  else if (key && key.name == 'l') {
    
          console.log('Time to land');
          rollingSpider.land();
        
  } 
  else if (key && key.name == 'up') {
    
          console.log('Going up');
          rollingSpider.up({steps: 15, speed: 20});
        
  }

  else if (key && key.name == 'down') {
    
          console.log('Going down');
          rollingSpider.down({steps: 15, speed: 20});
        
  }
  
   else if (key && key.name == 'left') {
    
          console.log('Turn Left');
          rollingSpider.turnLeft({steps: 15, speed: 20});
        
  } 
  
   else if (key && key.name == 'right') {
    
          console.log('Turn Right');
          rollingSpider.turnRight({steps: 15, speed: 20});
        
  }
  
  else if (key && key.name == 'f') {
    
          console.log('OMG Flip!');
          rollingSpider.frontFlip();
        
  }
  
    else if (key && key.name == 'q') {
    
          console.log('Bye Bye');
          temporal.clear();
          process.exit(0);
        
  }
  
});

process.stdin.setRawMode(true);
 });
});



Then after being able to run the drone, I wanted to create a voice controlled app to control the drone. I started learning with android studio. I have to say its fun :)
This is when I came across MIT appinventor. I was amazed at how good it is and how simple and easy have they made for us to make an app. I was able to make the voice controlled app and the run video is:


After this, I decided to use Optitrack to keep track my Drones position and make it follow a set of waypoints. The waypoints here consist of points on the track. It needs to be more stable and perfect. But still it works :D. The result of the same is:


The problems that I faced for my project were many. Sometimes the drone refused to move, sometimes got freezed. I am still working on it. Moreover the Optitrack PC and my laptop communicate using socket communication and I am facing error that sometimes it throws socket has been closed error. Hope I get it fixed soon :D

I recently got my hands on the Parrot AR drone 2.0. Time to get to work :D

4 comments:

  1. For the first time in India, we at Creogen Technologies Private Limited has built an Autonomous Cleaning and Surveillance Robot called SRISHTI. This is an Artificially Intelligent robot which is able to perform a multitude of tasks and is completely wireless. To know more about us please
    contact us from the given links.

    ReplyDelete
  2. Thank you for taking some time to write this post. This is mainly due to a bunch of interesting features offered by the manufacturer at a price that’s considerably fair. Something that you will notice about the drone is the fact that it looks pretty regular. You can know more here see more http://mydronelab.com/reviews/parrot-mini-drone-rolling-spider.html

    ReplyDelete
  3. The Flying Computer Drone can be hackedThe Flying Computer Drone can be hacked – We have heard hacking related to information of charge card, pay, assurance, messages, Defense, Security and others. Every such datum is hacked by familiarizing malware or disease on with the PC system by methods for Internet. Hacking every one of these information isn't the end; software engineers are furthermore drawn in with hacking meanders, a flying PC

    ReplyDelete