Mechazawa / minidrone-js

🚁 Parrot Minidrone library
https://minidrone.js.org
MIT License
31 stars 6 forks source link

Having a hard time getting the program started #52

Open Pdom02 opened 5 years ago

Pdom02 commented 5 years ago

Hi, sorry if this is not the place to put this but I'm having some difficulty running the connection program. I'm using the Atom IDE and have installed Node.js and some of the packages such as Winston and a script runner. However, now I'm getting constant errors for the script missing the module "./util/Enum". I'm really lost at this point, is there anyway you could walk me through getting this program running? Sorry again and thanks in advance for any help.

Edit: I'm trying to run the DroneConnection.js program btw.

Mechazawa commented 5 years ago

Try running the programs in the ./examples. The library needs to be compiled and/or installed first and after that you can import it to connect to your drone.

For example:

$ npm init
$ npm install minidrone-js --save

and then in main.js

const {DroneConnection, CommandParser} = require('minidrone-js');

const parser = new CommandParser();
const drone = new DroneConnection();

/* 
 * Commands are easily found by reading the xml specification
 * https://github.com/Parrot-Developers/arsdk-xml/blob/master/xml/
 */
const takeoff = parser.getCommand('minidrone', 'Piloting', 'TakeOff');
const landing = parser.getCommand('minidrone', 'Piloting', 'Landing');
const backFlip = parser.getCommand('minidrone', 'Animations', 'Flip', {direction: 'back'});

/** Helper function */
function sleep(ms) {
  return new Promise(a => setTimeout(a, ms));
}

async function main() {
  await new Promise(resolve => drone.once('connected', resolve));

  // Makes the code a bit clearer
  const runCommand = x => drone.runCommand(x);

  await runCommand(takeoff);

  await sleep(2000);
  await runCommand(backFlip);

  await sleep(2000);
  await runCommand(landing);

  await sleep(5000);
  process.exit();
}

main();

After that if you run main.js using node it should connect to your drone and do a couple of tricks before landing again.

Pdom02 commented 5 years ago

Try running the programs in the ./examples. The library needs to be compiled and/or installed first and after that you can import it to connect to your drone.

For example:

$ npm init
$ npm install minidrone-js --save

Hi, after inputing the command "$ npm install minidrone-js --save" in the windows terminal I get the response, "Sorry, name can only contain URL-friendly characters." Is this an issue relating to the windows platform or am I just stupid? Sorry for bothering you so much and thanks again for the help.

EDIT: I've gotten everything installed and such, now I'm just trying to run the main.js file. This is the error im getting (pictured below), I'm a bit confused, does this mean that the program isn't connecting to the drone successfully?

Real Real error

Mechazawa commented 5 years ago

I don't have any support for Windows sadly. I don't own any hardware with that OS. I'm unsure if it'll even run on a non nix* OS.