Giter Site home page Giter Site logo

voxel-drone's Introduction

voxel-drone

An AR Drone simulator in voxeljs.

work in progress. please view the issue tracker if you would like to help!

example

Open up the demo: shama.github.com/voxel-drone. Then in the command box at the bottom type: takeoff(). Or open up the javascript console and type: drone.takeoff().

It works with a browserified version of ar-drone and reads raw AT* commands (well almost). So all the commands you do in ar-drone you can do here as well:

drone.takeoff();
drone
  .after(5000, function() {
    this.animate('flipLeft', 15);
  })
  .after(5000, function() {
    this.stop();
    this.clockwise(0.3);
  })
  .after(3000, function() {
    this.stop();
    this.land();
  });

usage

In your voxeljs world add a drone with the following:

// create a world
var createEngine = require('voxel-engine');
var game = createEngine({
  generate: function(x, y, z) {
    return (Math.sqrt(x*x + y*y + z*z) > 20 || y*y > 10) ? 0 : (Math.random() * 2) + 1;
  },
  texturePath: './textures/',
  materials: ['dirt', 'grass']
});
var container = document.body;
game.appendTo(container);
container.addEventListener('click', function() {
  game.requestPointerLock(container);
});

// voxel-drone returns a function to create a drone
var createDrone = require('voxel-drone');

// create a drone / add to the game
var drone = createDrone(game);
game.addItem(drone.item());

// tell the drone to take off
drone.takeoff();

Use Your Own Custom Object

Would you rather a flying block? The drone.item(item) takes an item argument to override the object of the drone:

var createDrone = require('voxel-drone');
var drone = createDrone(game);

var block = {
  mesh: new game.THREE.Mesh(
    new game.THREE.CubeGeometry(25, 25, 25),
    game.loadTextures(['obsidian'])
  ),
  width: 25, height: 25, depth: 25,
  collisionRadius: 25
};

game.addItem(drone.item(block));

Voila! A flying api controlled obsidian block.

run the demo

  1. Clone: git clone git://github.com/shama/voxel-drone && cd voxel-drone.
  2. Install: npm install
  3. Run: npm start and goto http://localhost:8080.

release history

  • 0.2.1 - cap the amount of tilt. add front texture. update voxel engine.
  • 0.2.0 - video camera!
  • 0.1.2 - fix animations and leds
  • 0.1.1 - fix rotation relative direction
  • 0.1.0 - initial release

license

Copyright (c) 2013 Kyle Robinson Young
Licensed under the MIT license.

voxel-drone's People

Contributors

pr3mar avatar raldred avatar shama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

voxel-drone's Issues

Which commit ID is currently running as the demo?

As in the title, I have spent a while trying to get my local functioning like the demo and I can't for the life of me replicate it.

I have managed to get it to a workable state but things like the trees and the camera refuse to work. Just point me at the right commit and I'll tackle it again ๐Ÿ‘

Error when visiting localhost

Installs fine with npm but when visiting http://localhost:8080, the following error appears:

`~\voxel-drone\node_modules\response-stream\index.js:64
if (src[name]) s[name] = src[name].bind(src);
^

TypeError: src[name].bind is not a function
at ~\voxel-drone\node_modules\response-stream\index.js:64:48
at Array.forEach ()
at copyStream (~\voxel-drone\node_modules\response-stream\index.js:63:10)
at module.exports (~\voxel-drone\node_modules\response-stream\index.js:6:18)
at handle_static (~\voxel-drone\node_modules\beefy\lib\server.js:144:14)
at Server.beefy_server (~\voxel-drone\node_modules\beefy\lib\server.js:74:16)
at Server.emit (events.js:315:20)
at Server.EventEmitter.emit (domain.js:485:12)
at parserOnIncoming (_http_server.js:789:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:116:17)`

I've tried to run this on a few systems and the '.bind is not a function' error crops up regardless of platform.

Animations and LED Animations

Would be nice to support all the animations. Also the flip animations need some fine tuning. With longer durations it goes crazy. The LED animations are completely wrong too.

Build a camera!

Would be totally awesome to give it a camera with a little window showing what the drone sees. Probably should be another lib that this one uses. :D

Drone.prototype._emitNavdata undefined

Console snags on the prototype that comes with voxel-drone.

I instantiated the drone as per the docs, but how are you running the example without errors? Isn't it just running off of gh-pages? I see that's on the TODO on master, but would like to get my own up and running.

Weird error (not my description, NPM's)

Install and start this through NPM, all seems fine, but visiting localhost:8080 gives the error report below. The online demo works with no problems.

listening on http://localhost:8080/
200    7ms      707B /index.html

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)
npm ERR! weird error 8
npm ERR! not ok code 0

Emit a PNG stream

Not even sure if this is possible... but would be cool to emulate the PNG stream in ar-drone. Something like this: canvas.toDataURL("image/png")

Parse actual AT* commands

Currently the browserified version of ar-drone doesn't convert values from floats to int32, look here. This is because of bugs in buffer-browserify.

I would like to get that bug fixed so this lib can parse actual AT* commands. Then, in theory, any library that sends commands to an ar drone could control the sim instead. :D

Dependencies: AR-Drone, Repl

Getting a few errors. First one being that npm start requires the ar-drone module. Made a pull request for that one, but any idea about Error: ENOENT, open 'repl'?

Tried installing it but had no luck.

Direction issues

Do front(0.3), clockwise(0.3) until it does a 180, then front(0.3) again. Whoops! Goes the wrong way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.