21 Commits

Autor SHA1 Mensagem Data
Laurent Eschenauer adeca594f6 Updated git ignore 2013-12-19 10:44:42 +01:00
Laurent Eschenauer b2891204ac Added piwik code 2013-09-26 22:14:58 +02:00
Laurent Eschenauer 75e963afb5 Update index.html 2013-06-04 22:04:59 +02:00
Laurent Eschenauer bfca9146ca Update index.html 2013-05-31 10:54:46 +03:00
Laurent Eschenauer bef41c356b Update index.html 2013-05-31 09:53:51 +02:00
Laurent Eschenauer 0bd84e142f Added a few sections 2013-05-27 21:51:40 +02:00
Laurent Eschenauer 641783e0e8 Added plugins to ignored folders 2013-05-27 21:41:19 +02:00
Laurent Eschenauer 194f020827 Added copterface example 2013-05-25 23:41:40 +02:00
Laurent Eschenauer 05ea61c3e8 Replaced screenshot by video 2013-05-22 23:34:09 +02:00
Laurent Eschenauer cfe440bed9 Added link to nodecopter 2013-05-21 22:54:13 +02:00
Laurent Eschenauer ed685ab315 Updated title to match project font 2013-05-21 09:43:50 +02:00
Laurent Eschenauer 1639ec3059 Fixed typo 2013-05-21 09:19:24 +02:00
Laurent Eschenauer b761fcb81b Fixed fork-me github link 2013-05-20 23:07:07 +02:00
Laurent Eschenauer df6bca7ebe Added screenshot 2013-05-20 22:31:11 +02:00
Laurent Eschenauer e4bba0c3db Added _site to gitignore 2013-05-20 22:13:36 +02:00
Laurent Eschenauer 3ba60b188a Updated thank you note 2013-05-20 22:01:14 +02:00
Laurent Eschenauer 8d4eeb1279 Fixed urls 2013-05-20 21:59:26 +02:00
Laurent Eschenauer 61517c7c2f Removed title 2013-05-20 21:48:56 +02:00
Laurent Eschenauer fffe2bf7ca Fine tuned the page 2013-05-20 21:46:54 +02:00
Laurent Eschenauer 0b262e8cde Added gitignore 2013-05-20 21:41:53 +02:00
Laurent Eschenauer 9945d7612c Create gh-pages branch via GitHub 2013-05-20 12:40:25 -07:00
65 arquivos alterados com 505 adições e 2842 exclusões
-1
Ver Arquivo
@@ -1 +0,0 @@
*.iso
-45
Ver Arquivo
@@ -1,45 +0,0 @@
{
"actions": [],
"canPull": false,
"canPush": false,
"compatibility": [],
"description": "Combox recipe for ardrone-webflight development.",
"directories": [],
"documentation": "",
"files": [
{
"group": "root",
"mode": "755",
"name": "install.sh",
"owner": "root",
"path": "/var/lib/comodit/webflight/install.sh",
"template": {
"delimiter": {
"end": "}",
"start": "${"
},
"name": "install.sh"
}
}
],
"groups": [],
"handlers": [],
"name": "ardrone-webflight",
"organization": "Eschnou",
"packages": [
{
"name": "git"
},
{
"name": "nodejs"
}
],
"parameters": [],
"price": "0.00",
"repositories": [],
"services": [],
"url": "",
"users": [],
"uuid": "B72AD380C2E611E2B891B16EAC1F0212",
"version": 10
}
-2
Ver Arquivo
@@ -1,2 +0,0 @@
#!/bin/sh
npm install bower -g
Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 2.3 KiB

-42
Ver Arquivo
@@ -1,42 +0,0 @@
{
"vm" : {
"name": "webflight",
"memory": "512",
"ports_fw" : [["127.0.0.1", "2222", "22"], ["127.0.0.1", "3000", "3000"], ["127.0.0.1", "3001", "3001"]]
},
"applications": [
{
"name": ".combox/virtualbox-guest-additions",
"settings": {"shares":[{"name":"default", "mount":"/opt/ardrone-webflight"}]}
},
{
"name": ".combox/ardrone-webflight",
"settings": {}
}
],
"distribution": {
"name" : "CentOS 6 (Kickstart)",
"store_uuid": "27D7AD10438A11E2AD1EB0A1AC1F0212",
"settings" : {
"install_tree_url": "http://ftp.heanet.ie/pub/centos/6/os/i386/",
"root_password": "secret",
"repos": [
{
"base_url": "http://ftp.heanet.ie/pub/fedora/epel/6/i386/",
"name": "epel",
"release": true
},
{
"base_url": "http://ftp.heanet.ie/pub/centos/6/updates/i386/",
"name": "updates",
"release": false
},
{
"base_url": "http://dl.comodit.com/pub/centos/6/i386/",
"name": "comodit",
"release": true
}
]
}
}
}
@@ -1,80 +0,0 @@
{
"canPull": false,
"canPush": false,
"description": "Install virtual box guest additions and configure mount points.",
"directories": [
{
"group": "root",
"mode": "755",
"name": "ComodIT Logs",
"owner": "root",
"path": "/var/log/comodit/virtualbox/"
}
],
"documentation": "",
"files": [
{
"group": "root",
"mode": "755",
"name": "install.sh",
"owner": "root",
"path": "/var/lib/comodit/applications/virtualbox/install.sh",
"template": {
"delimiter": {
"end": "}",
"start": "${"
},
"name": "install.sh"
}
}
],
"groups": [],
"handlers": [
{
"do": [
{
"action": "execute",
"resource": "file://install.sh"
}
],
"on": [
"_install"
]
}
],
"name": "virtualbox-guest-additions",
"packages": [],
"parameters": [
{
"description": "",
"key": "shares",
"name": "Shares",
"schema": {
"items": {
"properties": {
"mount": {
"description": "Share mount point",
"pretty": "Mount point",
"required": true,
"type": "string"
},
"name": {
"description": "Share name",
"pretty": "Name",
"required": true,
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"version": 1
}
],
"price": "0.00",
"repositories": [],
"services": [],
"url": "https://www.virtualbox.org/",
"users": []
}
@@ -1,30 +0,0 @@
#!/bin/sh
(
# Install additional packages
yum -y install gcc make gcc-c++ kernel-devel zlib-devel openssl-devel readline-devel sqlite-devel perl wget dkms nfs-utils
# Install guest additions
cd /tmp
wget http://download.virtualbox.org/virtualbox/4.2.8/VBoxGuestAdditions_4.2.8.iso
mount -o loop VBoxGuestAdditions_4.2.8.iso /mnt
sh /mnt/VBoxLinuxAdditions.run
# Delete iso
umount /mnt
rm VBoxGuestAdditions_4.2.8.iso
# Add mount points if any
<#if shares??>
<#list shares as share>
mkdir -p ${share.mount}
echo -e "${share.name}\t\t${share.mount}\tvboxsf\tdefaults\t0 0" >> /etc/fstab
mount ${share.mount}
</#list>
</#if>
) > /var/log/comodit/virtualbox/install.log 2>&1
Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 2.3 KiB

+5 -8
Ver Arquivo
@@ -1,11 +1,8 @@
*.swp
.DS_Store
.project
.settings
.settings/
components/
bower_components/
config.js
node_modules
components
bower_components
node_modules/
_site
pictures
temp.js
plugins/
-7
Ver Arquivo
@@ -1,7 +0,0 @@
Author:
Laurent Eschenauer <laurent@eschenauer.be>
With additional contributions from:
Bernhard K. Weisshuhn (bkw@codingforce.com)
Benjamin Nortier (@bjnortier)
Andreas (@functino)
-19
Ver Arquivo
@@ -1,19 +0,0 @@
Copyright (c) 2013 by the AUTHORS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-127
Ver Arquivo
@@ -1,127 +0,0 @@
# ardrone-webflight
Pilot the AR.Drone 2.0 directly from your browser. Extend the application with plugins
to add features such as video recording, autonomous flight, face recognition, and more.
It makes it a very friendly environment to quickly build and experiment with your drone
(e.g. during a [nodecopter](http://nodecopter.com) event).
If you encounter an issue; please submit it to the issue tracker! You can also catch
up with me (eschnou) on twitter or on #freenode (channel #nodecopter).
**This branch is the development branch, there are no packaged release yet.**
## Built-in plugins
* **[video-png](plugins/video-png/)** stream the video to the browser through static image loading,
works great in every browser. Requires ffmpeg installed on your system.
* **[video-stream](plugins/video-stream/)** use [node-dronestream](https://github.com/bkw/node-dronestream) to stream the raw h264 video
feed via webscokets and rendering in Javascript !!! Need a modern browser and CPU.
* **[hud](plugins/hud/)** to visualize a head-up display with artificial horizon, compass,
altimeter, etc. Based on [nodecopter-cockpit](https://github.com/bkw/nodecopter-cockpit)
* **[pilot](plugins/pilot)** to control the drone remotely using the keyboard. Based on [drone-browser](https://github.com/functino/drone-browser).
* **[battery](plugins/battery)** display a battery widget in the top bar.
* **[blackbox](plugins/blackbox)** records all mission data (raw video, navdata, etc.) on the disk.
* **[replay](plugins/replay)** replays a mission by injecting the data at the client level. Makes it a very
friendly tool to code/test/debug when you can't fly. **You need to use video-png for video, not compatible with video-stream yet.**
## Other plugins
Feel free to add your plugins in this list by editing this page.
* **[copterface](https://github.com/eschnou/webflight-copterface)** detect faces and track them by rotating the drone.
A port of the [copterface](https://github.com/paulhayes/copterface) project to the webflight environment.
* **[traffic](https://github.com/wiseman/webflight-traffic)** displays live Air traffic from ADS-B data as an augmented reality overlay.
* **[gamepad](https://github.com/wiseman/webflight-gamepad)** controls the drone with a gamepad.
* **[tracker](https://github.com/bkw/webflight-tracker)** track pixels on the videostream by clicking on them.
* **[trollface](https://github.com/andrew/webflight-trollface)** detect faces and overlay trollfaces on top of them.
## Install
WebFlight requires a recent nodejs (built and tested with node > 0.10) as well as
[npm](https://npmjs.org/) and [bower](http://bower.io/) for dependency management.
In order to use the video-png plugin, you also need ffmpeg installed on your system.
```
git clone https://github.com/eschnou/ardrone-webflight.git
cd ardrone-webflight
npm install
bower install
```
## Usage
1. Copy the config.js.sample to config.js and edit to select your plugins
2. Connect to the drone's wifi
3. Run `node app.js`
4. Point your browser to http://localhost:3000/
### Controlling the drone
If you have enabled the **pilot** plugin, you can fly the drone with the following keys. You can define your keyboard in the
config file. In the plugin, `azerty` and `qwerty` keyboards are defined. Feel free to define others.
Use `z, s, q, d` to move front, back and sideways. Use your `cursors` to go up/down or turn
clockwise/counter clockwise. Use `t` to takeoff and `l` for landing.
Use the `tab` key to toggle acceleration speed slow/fast.
Use the `f` key to perform a flip in the current direction of movement.
Use the `c` key to switch the video feed between front/bottom camera.
Use the `e` key to recover from an emergency after a crash.
### Record a mission
Just press the `r` to start recording. A popup alers you when the recording starts. Press `r` again to stop. Each mission
is bundled in its own folder.
## Adding your own plugin
There is no tutorial yet, in the meanwhile, just have a look at the built in plugins,
it is faily straightforward.
## Thanks
This work is based on the integration of [nodecopter-cockpit](https://github.com/bkw/nodecopter-cockpit)
and [drone-browser](https://github.com/functino/drone-browser), refactored in a plugin architecture.
Thanks to [@bkw](https://github.com/bkw/) and [@functino](https://github.com/functino) for sharing! Also
a big thank you to [@felixge](https://github.com/felixge) for his [node-ar-drone](https://github.com/felixge/node-ar-drone) library
which pushed me into buying a drone and become crazy about these little flying robots!
## License
The MIT License
Copyright (c) 2013 by the AUTHORS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-162
Ver Arquivo
@@ -1,162 +0,0 @@
var express = require('express')
, app = express()
, fs = require('fs')
, path = require('path')
, server = require("http").createServer(app)
, io = require('socket.io').listen(server)
, arDrone = require('ar-drone')
, arDroneConstants = require('ar-drone/lib/constants')
;
// Fetch configuration
try {
var config = require('./config');
} catch (err) {
console.log("Missing or corrupted config file. Have a look at config.js.example if you need an example.");
process.exit(-1);
}
// Override the drone ip using an environment variable,
// using the same convention as node-ar-drone
var drone_ip = process.env.DEFAULT_DRONE_IP || '192.168.1.1';
// Keep track of plugins js and css to load them in the view
var scripts = []
, styles = []
;
app.configure(function () {
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs', { pretty: true });
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
app.use("/components", express.static(path.join(__dirname, 'bower_components')));
});
app.configure('development', function () {
app.use(express.errorHandler());
app.locals.pretty = true;
});
app.get('/', function (req, res) {
res.render('index', {
title: 'Express'
,scripts: scripts
,styles: styles
,options: {
keyboard: config.keyboard
}
});
});
function navdata_option_mask(c) {
return 1 << c;
}
// From the SDK.
var navdata_options = (
navdata_option_mask(arDroneConstants.options.DEMO)
| navdata_option_mask(arDroneConstants.options.VISION_DETECT)
| navdata_option_mask(arDroneConstants.options.MAGNETO)
| navdata_option_mask(arDroneConstants.options.WIFI)
);
// Connect and configure the drone
var client = new arDrone.createClient({timeout:4000});
client.config('general:navdata_demo', 'TRUE');
client.config('video:video_channel', '0');
client.config('general:navdata_options', navdata_options);
// Add a handler on navdata updates
var latestNavData;
client.on('navdata', function (d) {
latestNavData = d;
});
// Signal landed and flying events.
client.on('landing', function () {
console.log('LANDING');
io.sockets.emit('landing');
});
client.on('landed', function () {
console.log('LANDED');
io.sockets.emit('landed');
});
client.on('takeoff', function() {
console.log('TAKEOFF');
io.sockets.emit('takeoff');
});
client.on('hovering', function() {
console.log('HOVERING');
io.sockets.emit('hovering');
});
client.on('flying', function() {
console.log('FLYING');
io.sockets.emit('flying');
});
// Process new websocket connection
io.set('log level', 1);
io.sockets.on('connection', function (socket) {
socket.emit('event', { message: 'Welcome to cockpit :-)' });
});
// Schedule a time to push navdata updates
var pushNavData = function() {
io.sockets.emit('navdata', latestNavData);
};
var navTimer = setInterval(pushNavData, 100);
// Prepare dependency map for plugins
var deps = {
server: server
, app: app
, io: io
, client: client
, config: config
};
// Load the plugins
var dir = path.join(__dirname, 'plugins');
function getFilter(ext) {
return function(filename) {
return filename.match(new RegExp('\\.' + ext + '$', 'i'));
};
}
config.plugins.forEach(function (plugin) {
console.log("Loading " + plugin + " plugin.");
// Load the backend code
require(path.join(dir, plugin))(plugin, deps);
// Add the public assets to a static route
if (fs.existsSync(assets = path.join(dir, plugin, 'public'))) {
app.use("/plugin/" + plugin, express.static(assets));
}
// Add the js to the view
if (fs.existsSync(js = path.join(assets, 'js'))) {
fs.readdirSync(js).filter(getFilter('js')).forEach(function(script) {
scripts.push("/plugin/" + plugin + "/js/" + script);
});
}
// Add the css to the view
if (fs.existsSync(css = path.join(assets, 'css'))) {
fs.readdirSync(css).filter(getFilter('css')).forEach(function(style) {
styles.push("/plugin/" + plugin + "/css/" + style);
});
}
});
// Start the web server
server.listen(app.get('port'), function() {
console.log('AR. Drone WebFlight is listening on port ' + app.get('port'));
});
-7
Ver Arquivo
@@ -1,7 +0,0 @@
{
"name": "ardrone-webflight",
"dependencies": {
"jquery": "~1.9.1",
"bootstrap.css": "~2.1.1"
}
}
-28
Ver Arquivo
@@ -1,28 +0,0 @@
var config = {
plugins: [
"video-png" // Display the video feed as static pngs (work in every browser)
//, "video-stream" // Display the video as a native h264 stream decoded in JS
, "hud" // Display the artificial horizon, altimeter, compass, etc.
, "battery" // Display a simple battery widget in the header bar
, "pilot" // Pilot the drone with the keyboard
, "blackbox" // Experimental: Records all mision data (navData, raw video, PaVE headers, etc.)
//, "replay" // Experimental: Replay the data recorded by the blackbox
],
// Config for pilot plugin
keyboard: 'azerty',
// Config for blackbox plugin. Path is an existing folder where to store mission data
// Each new mission will have its own timestamped folder.
blackbox: {
path: "/tmp"
},
// Config for replay plugin. Path points to a specific mission folder to be replayed.
replay: {
path: "/tmp/2013-06-03_09-10-33/"
}
};
module.exports = config;
BIN
Ver Arquivo
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 4.2 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 1.2 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 52 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 727 KiB

+184
Ver Arquivo
@@ -0,0 +1,184 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link href='http://fonts.googleapis.com/css?family=Audiowide' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/pygment_trac.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script type="text/javascript" src="https://blockchain.info//Resources/wallet/pay-now-button.js"></script>
<title>AR.Drone WebFlight</title>
</head>
<body>
<header>
<div class="container">
<h1>AR.Drone WebFlight</h1>
<h2>Flying robots in your browser!</h2>
<a href="https://github.com/eschnou/ardrone-webflight"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
</div>
</header>
<div class="container">
<section id="main_content">
<p>Pilot the <a href="http://ardrone2.parrot.com/">AR.Drone 2.0</a> directly from your browser.
Extend the application with plugins to add features such as video recording, autonomous flight,
face recognition, and more. It makes it a very friendly environment to quickly build and
experiment with your drone (e.g. during a <a href="http://nodecopter.com/">nodecopter event</a>).</p>
<div class="screenshot">
<iframe width="560" height="315" src="http://www.youtube.com/embed/CF4SlwLkIaU" frameborder="0" allowfullscreen></iframe>
</div>
<h2>Built-in plugins</h2>
<ul>
<li><p><strong><a href="https://github.com/eschnou/ardrone-webflight/tree/master/plugins/video-png/">video-png</a></strong> stream the video to the browser through static image loading,
works great in every browser.</p></li>
<li><p><strong><a href="https://github.com/eschnou/ardrone-webflight/tree/master/plugins/video-stream/">video-stream</a></strong> uses <a href="https://github.com/bkw/node-dronestream">node-dronestream</a> to stream the raw h264 video
feed via webscokets and rendering in Javascript. Need a modern browser and CPU.</p></li>
<li><p><strong><a href="https://github.com/eschnou/ardrone-webflight/tree/master/plugins/hud/">hud</a></strong> to visualize a head-up display with artificial horizon, compass,
altimeter, etc. Based on <a href="https://github.com/bkw/nodecopter-cockpit">nodecopter-cockpit</a></p></li>
<li><p><strong><a href="https://github.com/eschnou/ardrone-webflight/tree/master/plugins/pilot">pilot</a></strong> to control the drone remotely using the keyboard. Based on <a href="https://github.com/functino/drone-browser">drone-browser</a>.</p></li>
<li><p><strong><a href="https://github.com/eschnou/ardrone-webflight/tree/master/plugins/blackbox">blackbox</a></strong> records all mission data (raw video, navdata, etc.) on the disk.</p></li>
<li><p><strong><a href="https://github.com/eschnou/ardrone-webflight/tree/master/plugins/replay">replay</a></strong> replays a mission by injecting the data at the client level. Makes it a very friendly tool to code/test/debug when you can't fly.</p></li>
</ul>
<h2 id="plugins">Additional plugins</h2>
<p>If you have written your own webflight plugins, please add them to this list by editing this page.</p>
<ul>
<li><p><strong><a href="https://github.com/eschnou/webflight-copterface/">copterface</a></strong> detect faces and track them by rotating the drone. A port of the <a href="https://github.com/paulhayes/copterface">copterface</a> project to the webflight environment.</p></li>
<li><p><strong><a href="https://github.com/wiseman/webflight-traffic/">traffic</a></strong> Air traffic overlay plugin for ardrone-webflight that uses ADS-B data.</p></li>
<li><p><strong><a href="https://github.com/wiseman/webflight-gamepad/">gamepad</a></strong> controls the drone with a gamepad for much smoother flights.</p></li>
</ul>
<h2 id="install">Install</h2>
<p>WebFlight requires a recent nodejs (built and tested with node &gt; 0.10) as well as
<a href="https://npmjs.org/">npm</a> and <a href="http://bower.io/">bower</a> for dependency management.</p>
<pre><code>git clone git@github.com:eschnou/ardrone-webflight
cd ardrone-webflight
npm install
bower install
</code></pre>
<h2>Usage</h2>
<ol>
<li>Copy the config.js.sample to config.js and edit to select your plugins</li>
<li>Connect to the drone's wifi</li>
<li>Run <code>node app.js</code>
</li>
<li>Point your browser to http://localhost:3000/</li>
</ol>
<h2>Remote control</h2>
<p>If you have enabled the <strong>pilot</strong> plugin, you can fly the drone with the following keys. Yes,
these are azerty bindings :-) If you need qwerty ones, just hack the plugin. I'll need to find
a way to provide custome configuration etc.</p>
<p>Use <code>Z, S, Q, D</code> to move front, back and sideways. Use your <code>cursors</code> to go up/down or turn
clockwise/counter clockwise. Use <code>t</code> to takeoff and <code>l</code> for landing.</p>
<h2>Adding your own plugin</h2>
<p>There is no tutorial yet, in the meanwhile, just have a look at the built in plugins,
it is faily straightforward. </p>
<h2>Support</h2>
<p>If you encounter issues, please add them to the <a href="https://github.com/eschnou/ardrone-webflight/issues">issue tracker</a>. You can find
me on twitter (<a href="http://twitter.com/eschnou">@eschnou</a>) or on the #nodecopter IRC channel
on #freenode.
<h2>Thanks</h2>
<p>This work is based on the integration of <a href="https://github.com/bkw/nodecopter-cockpit">nodecopter-cockpit</a>
and <a href="https://github.com/functino/drone-browser">drone-browser</a>, refactored in a plugin architecture.
Thanks to <a href="https://github.com/bkw">@bkw</a> and <a href="https://github.com/functino">@functino</a> for sharing!</p>
</p>
<p>Also a big thank you to <a href="https://github.com/felixge">@felixge</a> for his <a href="https://github.com/felixge/node-ar-drone">node-ar-drone</a> library
which pushed me into buying a drone and become crazy about these little flying robots!</p>
<h2>Donate</h2>
<p>If you like this project, please consider donating. The less time I need to work, the more I can spend on open source projects :-)</p>
<div style="font-size:16px;margin:0 auto;width:300px" class="blockchain-btn"
data-address="13q2eVG8KkmsFqGHqDWbjHeq3qicxi4rjh"
data-shared="false">
<div class="blockchain stage-begin">
<img src="https://blockchain.info//Resources/buttons/donate_64.png"/>
</div>
<div class="blockchain stage-loading" style="text-align:center">
<img src="https://blockchain.info//Resources/loading-large.gif"/>
</div>
<div class="blockchain stage-ready">
<p align="center">Please Donate To Bitcoin Address: <b>[[address]]</b></p>
<p align="center" class="qr-code"></p>
</div>
<div class="blockchain stage-paid">
Donation of <b>[[value]] BTC</b> Received. Thank You.
</div>
<div class="blockchain stage-error">
<font color="red">[[error]]</font>
</div>
</div>
<h2>License</h2>
<p>The MIT License</p>
<p>Copyright (c) 2013 by the AUTHORS</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.</p>
</section>
</div>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://analytics.eschnou.com/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "4"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Piwik Code -->
</body>
</html>
+1
Ver Arquivo
@@ -0,0 +1 @@
console.log('This would be the main JS file.');
-41
Ver Arquivo
@@ -1,41 +0,0 @@
{
"name": "ardrone-webflight",
"version": "0.1.1",
"description": "Extensible remote-control environment for the AR Drone.",
"main": "app.js",
"repository": {
"type": "git",
"url": "git@github.com:eschnou/ardrone-webflight.git"
},
"keywords": [
"drone",
"ardrone",
"nodecopter",
"parrot",
"cockpit",
"browser",
"artificial horizon"
],
"dependencies": {
"ar-drone": "0.3.1",
"express": "3.0.x",
"ejs": "~0.8.3",
"socket.io": "~0.9.4",
"dronestream": "1.1.1",
"dateformat": "~1.0.6-1.2.3",
"line-reader": "~0.2.3",
"buffered-reader": "~1.0.1"
},
"author": "Laurent Eschenauer <laurent@eschenauer.be>",
"contributors": [
{
"name": "Benjamin Nortier",
"email": "bjnortier@gmail.com"
},
{
"name": "Bernhard K. Weisshuhn",
"email": "bkw@codingforce.com>"
}
],
"license": "MIT"
}
+1
Ver Arquivo
@@ -0,0 +1 @@
{"name":"AR.Drone WebFlight","tagline":"Flying robots in your browser!","body":"# ardrone-webflight\r\n\r\nPilot the AR.Drone 2.0 directly from your browser. Extend the application with plugins\r\nto add features such as video recording, autonomous flight, face recognition, and more.\r\nIt makes it a very friendly environment to quickly build and experiment with your drone \r\n(e.g. during a nodecopter event).\r\n\r\nIf you encounter an issue; please submit it to the issue tracker! You can also catch\r\nup with me (eschnou) on twitter or on #freenode (channel #nodecopter).\r\n\r\n**This branch is the development branch, there are no packaged release yet.** \r\n\r\n## Built-in plugins\r\n\r\n* **[video-png](plugins/video-png/)** stream the video to the browser through static image loading, \r\n works great in every browser.\r\n\r\n* **[video-stream](plugins/video-stream/)** use [node-dronestream](https://github.com/bkw/node-dronestream) to stream the raw h264 video \r\nfeed via webscokets and rendering in Javascript !!! Need a modern browser and CPU.\r\n\r\n* **[hud](plugins/hud/)** to visualize a head-up display with artificial horizon, compass, \r\n altimeter, etc. Based on [nodecopter-cockpit](https://github.com/bkw/nodecopter-cockpit)\r\n\r\n* **[pilot](plugins/pilot)** to control the drone remotely using the keyboard. Based on [drone-browser](https://github.com/functino/drone-browser).\r\n\r\n## Install\r\n\r\nWebFlight requires a recent nodejs (built and tested with node > 0.10) as well as\r\n[npm](https://npmjs.org/) and [bower](http://bower.io/) for dependency management.\r\n\r\n```\r\ngit clone git@github.com:eschnou/ardrone-webflight\r\ncd ardrone-webflight\r\nnpm install\r\nbower install\r\n```\r\n\r\n## Usage\r\n\r\n1. Copy the config.js.sample to config.js and edit to select your plugins\r\n2. Connect to the drone's wifi\r\n3. Run `node app.js`\r\n4. Point your browser to http://localhost:3000/\r\n\r\nIf you have enabled the **pilot** plugin, you can fly the drone with the following keys. Yes, \r\nthese are azerty bindings :-) If you need qwerty ones, just hack the plugin. I'll need to find \r\na way to provide custome configuration etc.\r\n\r\nUse `Z, S, Q, D` to move front, back and sideways. Use your `cursors` to go up/down or turn \r\nclockwise/counter clockwise. Use `t` to takeoff and `l` for landing.\r\n\r\n## Adding your own plugin\r\n\r\nThere is no tutorial yet, in the meanwhile, just have a look at the built in plugins, \r\nit is faily straightforward. \r\n\r\nI would like to maintain a list of user plugins. If you hack something, please let me know\r\nand I'll add you to the list.\r\n\r\n## Thanks\r\n\r\nThis work is based on the integration of [nodecopter-cockpit](https://github.com/bkw/nodecopter-cockpit) \r\nand [drone-browser](https://github.com/functino/drone-browser), refactored in a plugin architecture.\r\n\r\nAlso a big thank you to [@felixge](https://github.com/felixge) for his [node-ar-drone](https://github.com/felixge/node-ar-drone) library \r\nwhich pushed me into buying a drone and become crazy about these little flying robots!\r\n\r\n## License\r\n\r\nThe MIT License\r\n\r\nCopyright (c) 2013 by the AUTHORS\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n","google":"UA-3039760-14","note":"Don't delete this file! It's used internally to help with page regeneration."}
-5
Ver Arquivo
@@ -1,5 +0,0 @@
function battery(name, deps) {
// Nothing special on the backend for now
};
module.exports = battery;
-11
Ver Arquivo
@@ -1,11 +0,0 @@
#battery {
display: block;
float: right;
}
#battery .level {
vertical-align: 70%;
margin-left: -35px;
font-family: Arial;
font-size: 12px;
}
-80
Ver Arquivo
@@ -1,80 +0,0 @@
(function (window, $, undefined) {
'use strict';
var Battery;
Battery = function Battery(cockpit) {
console.log("Loading Battery indicator plugin.");
// Instance variables
this.cockpit = cockpit;
this.level = 100;
// Add required UI elements
$(".header-container .wrapper").prepend('<div id="battery"><canvas class="gauge" width="50px;" height="25px;" /><span class="level">100%</span></div>');
this.ctx = $('#battery .gauge').get(0).getContext('2d');
// Bind to navdata events on websockets
var self = this;
this.cockpit.socket.on('navdata', function(data) {
if (!jQuery.isEmptyObject(data)) {
requestAnimationFrame(function() {
self.render(data);
});
}
});
// Initial draw
this.draw();
};
Battery.prototype.render = function(data) {
this.level = data.demo.batteryPercentage;
$("#battery .level").text(this.level + '%');
this.draw();
}
Battery.prototype.draw = function() {
var cw = this.ctx.canvas.width;
var ch = this.ctx.canvas.height;
this.ctx.clearRect(0, 0, cw, ch);
this.ctx.save();
this.ctx.strokeStyle = 'grey';
this.ctx.fillStyle = 'grey';
this.ctx.lineWidth = 2;
roundRect(this.ctx, 5, 1, 40, 20);
this.ctx.fillRect(45, 5, 4, 12);
var width = Math.floor(this.level / 100 * 35);
this.ctx.fillStyle = this.getColor();
roundRect(this.ctx, 8, 3, width, 15, 3, true, false);
this.ctx.restore();
}
Battery.prototype.getColor = function() {
if (this.level > 90) {
return 'lightgreen';
} else if (this.level > 80) {
return 'green';
} else if (this.level > 70) {
return 'darkgreen';
} else if (this.level > 60) {
return 'lightyellow';
} else if (this.level > 50) {
return 'yellow';
} else if (this.level > 40) {
return 'darkyellow';
} else if (this.level > 30) {
return 'lightred';
} else if (this.level > 20) {
return 'red';
} else {
return 'darkred';
}
}
window.Cockpit.plugins.push(Battery);
}(window, jQuery));
-40
Ver Arquivo
@@ -1,40 +0,0 @@
/**
* Draws a rounded rectangle using the current state of the canvas.
* If you omit the last three params, it will draw a rectangle
* outline with a 5 pixel border radius
* @param {CanvasRenderingContext2D} ctx
* @param {Number} x The top left x coordinate
* @param {Number} y The top left y coordinate
* @param {Number} width The width of the rectangle
* @param {Number} height The height of the rectangle
* @param {Number} radius The corner radius. Defaults to 5;
* @param {Boolean} fill Whether to fill the rectangle. Defaults to false.
* @param {Boolean} stroke Whether to stroke the rectangle. Defaults to true.
*
* Source: http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas
*/
function roundRect(ctx, x, y, width, height, radius, fill, stroke) {
if (typeof stroke == "undefined" ) {
stroke = true;
}
if (typeof radius === "undefined") {
radius = 5;
}
ctx.beginPath();
ctx.moveTo(x + radius, y);
ctx.lineTo(x + width - radius, y);
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
ctx.lineTo(x + width, y + height - radius);
ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
ctx.lineTo(x + radius, y + height);
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
ctx.lineTo(x, y + radius);
ctx.quadraticCurveTo(x, y, x + radius, y);
ctx.closePath();
if (stroke) {
ctx.stroke();
}
if (fill) {
ctx.fill();
}
}
-130
Ver Arquivo
@@ -1,130 +0,0 @@
var fs = require('fs');
var path = require('path');
var df = require('dateformat');
var PaVEParser = require('ar-drone/lib/video/PaVEParser')
var client
, io
, config
, navStream
, motionStream
, videoStream
, paveStream
, recording = false
;
function blackbox(name, deps) {
client = deps.client;
io = deps.io;
config = deps.config;
// Listen to user actions to start/stop recording
deps.io.sockets.on('connection', function (socket) {
socket.on('/blackbox/start', function (cmd) {
_start();
});
socket.on('/blackbox/stop', function (cmd) {
_stop();
});
});
// Listen to navdata and process them
deps.client.on('navdata', function(data) {
_writeNavData(data);
});
// Process the videostream
var parser = new PaVEParser();
parser.on('data', function(data) {
_writeVideo(data);
})
client.getVideoStream().pipe(parser);
};
function _start() {
if (recording) return;
console.log("Start recording navigation data");
if (config && config.blackbox && config.blackbox.path) {
var root = config.blackbox.path;
} else {
var root = ".";
}
var folder = df(new Date(), "yyyy-mm-dd_hh-MM-ss");
fs.mkdir(path.join(root, folder), function() {
navStream = fs.createWriteStream(path.join(root, folder, 'navdata.txt'));
videoStream = fs.createWriteStream(path.join(root, folder, 'video.h264'));
paveStream = fs.createWriteStream(path.join(root, folder, 'paveHeaders.txt'));
motionStream = fs.createWriteStream(path.join(root, folder, 'motion.txt'));
motionStream.write("seq,pitch,roll,yaw,xVelocity,yVelocity,zVelocity,altitude\n", function() {
recording = true;
io.sockets.emit('/message', "Blackbox started recording NavData.");
});
});
}
function _stop() {
if (!recording) return;
console.log("Stopped recording navigation data");
recording = false;
navStream.end();
motionStream.end();
paveStream.end();
videoStream.end();
io.sockets.emit('/message', "Blackbox stopped recording NavData.");
}
function _writeNavData(data) {
if (!recording) return;
navStream.write(JSON.stringify(data) + "\n");
var seq = data.sequenceNumber
, pitch = data.demo.rotation.pitch
, roll = data.demo.rotation.roll
, yaw = data.demo.rotation.yaw
, vx = data.demo.velocity.x
, vy = data.demo.velocity.y
, vz = data.demo.velocity.z
, z = data.demo.altitude
;
motionStream.write(seq + "," + pitch + "," + roll + "," + yaw + "," + vx + "," + vy + "," + vz + "," + z + "\n");
}
function _writeVideo(data) {
if (!recording) return;
videoStream.write(data.payload);
var header = {
signature : data.signature,
version : data.version,
video_codec : data.video_codec,
header_size : data.header_size,
payload_size : data.payload_size,
encoded_stream_width : data.encoded_stream_width,
encoded_stream_height : data.encoded_stream_height,
display_width : data.display_width,
display_height : data.display_height,
frame_number : data.frame_number,
timestamp : data.timestamp,
total_chunks : data.total_chunks,
chunk_index : data.chunk_index,
frame_type : data.frame_type,
control : data.control,
stream_byte_position_lw : data.stream_byte_position_lw,
stream_byte_position_uw : data.stream_byte_position_uw,
stream_id : data.stream_id,
total_slices : data.total_slices,
slice_index : data.slice_index,
header1_size : data.header1_size,
header2_size : data.header2_size,
advertised_size : data.advertised_size,
}
paveStream.write(JSON.stringify(header) + "\n");
}
module.exports = blackbox;
-42
Ver Arquivo
@@ -1,42 +0,0 @@
(function(window, document) {
'use strict';
/*
* Constructuor
*/
var Blackbox = function Blackbox(cockpit) {
console.log("Loading Blackbox plugin.");
this.cockpit = cockpit;
this.recording = false;
// Register the various event handlers
this.listen();
};
/*
* Register keyboard event listener
*/
Blackbox.prototype.listen = function listen() {
var self = this;
$(document).keydown(function(ev) {
self.keyDown(ev);
});
};
/*
* Process onkeydown.
*/
Blackbox.prototype.keyDown = function keyDown(ev) {
if ([ev.keyCode] != 82) {
return;
}
ev.preventDefault();
this.recording = !this.recording;
var cmd = this.recording ? "stop" : "start";
this.cockpit.socket.emit("/blackbox/" + cmd, {});
};
window.Cockpit.plugins.push(Blackbox);
}(window, document));
-5
Ver Arquivo
@@ -1,5 +0,0 @@
function hud(name, deps) {
// Nothing special on the backend for now
};
module.exports = hud;
-17
Ver Arquivo
@@ -1,17 +0,0 @@
#horizon {
opacity: 0.5;
position: absolute;
z-index: 3;
top: 0px;
left: 0px;
}
#compass {
position: absolute;
width: 100%;
height: 30px;
bottom: 0;
z-index: 5;
}
-110
Ver Arquivo
@@ -1,110 +0,0 @@
(function (window, document, $, undefined) {
'use strict';
var headings = ['N', 'E', 'S', 'W'],
Compass;
Compass = function (cockpit) {
console.log("Adding Compass to Artificial Horizon.");
// Instance variables
this.cockpit = cockpit;
// Add required UI elements
$('#cockpit').append('<div id="compass"></div>');
var div = $('#compass').get(0);
// Listen to navdata updates
var compass = this;
this.cockpit.socket.on('navdata', function(data) {
if (!jQuery.isEmptyObject(data)) {
requestAnimationFrame(function() {
compass.moveTo(data.magneto.heading.fusionUnwrapped);
});
}
});
// Setup compass canvas
var divRect = div.getBoundingClientRect(),
ctx, x, i, needle;
div.style.position = 'absolute';
div.style.bottom = '0px';
div.style.backgroundImage = '-webkit-radial-gradient(50% 50%, circle cover, rgb(68, 68, 68) 0%, black 100%)';
this.visibleWidth = divRect.width;
this.canvas = document.createElement('canvas');
this.canvas.width = this.visibleWidth * 2;
this.canvas.height = divRect.height;
this.canvas.style.position = 'absolute';
div.style.overflow = 'hidden';
ctx = this.canvas.getContext('2d');
x = 0;
ctx.textAlign = 'center';
for (i = 0; i < 36 * 2; i += 1.5) {
ctx.beginPath();
ctx.moveTo(x, 0);
if (i % 9 === 0) {
ctx.fillStyle = 'white';
ctx.font = 'bold';
ctx.fillText(headings[i / 9 % 4], x, 24);
ctx.strokeStyle = 'white';
ctx.lineTo(x, 10);
ctx.lineWidth = 2;
} else if (i % 3 === 0) {
ctx.fillStyle = '#CCC';
ctx.font = 'normal';
ctx.fillText(i % 36, x, 24);
ctx.strokeStyle = 'white';
ctx.lineWidth = 1;
ctx.lineTo(x, 7);
} else {
ctx.strokeStyle = 'white';
ctx.lineTo(x, 5);
ctx.lineWidth = 0.5;
}
ctx.stroke();
x += this.visibleWidth / 24;
}
div.appendChild(this.canvas);
needle = document.createElement('canvas');
needle.width = 15;
needle.height = 15;
needle.style.top = 0;
needle.style.left = Math.floor(this.visibleWidth / 2 - needle.width / 2) + 'px';
needle.style.position = 'absolute';
ctx = needle.getContext('2d');
ctx.fillStyle = 'red';
ctx.moveTo(0, 0);
ctx.lineTo(Math.ceil(needle.width / 2), needle.height);
ctx.lineTo(needle.width, 0);
ctx.lineTo(0, 0);
ctx.fill();
div.appendChild(needle);
this.moveTo(0);
};
Compass.prototype.moveTo = function (angle) {
var offset,
compass = this;
while (angle > 180) {
angle -= 360;
}
while (angle < -180) {
angle += 360;
}
offset = - angle * (this.visibleWidth / 360);
offset -= (this.visibleWidth / 2);
// '-webkit-transform'
window.requestAnimationFrame(function () {
compass.canvas.style.webkitTransform = 'translateX(' + offset + 'px)';
});
};
window.Cockpit.plugins.push(Compass);
}(window, document, jQuery));
-545
Ver Arquivo
@@ -1,545 +0,0 @@
/*
* This is heavily based on the JS from https://github.com/bjnortier/autopilot
* by Benjamin Nortier.
*
* Original License:
*
* Copyright (c) 2010 Benjamin Nortier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/
(function (window, $, undefined) {
'use strict';
var AH,
skyColor = '#33f',
earthColor = '#992',
frontCameraFovY = 70,
majorWidth = 100,
minorWidth = 60,
zeroWidth = 200,
zeroGap = 20,
radialLimit = 60,
tickRadius = 10,
radialRadius = 178,
speedIndicatorHeight = 250,
speedIndicatorWidth = 60,
zeroPadding = 100,
speedAltOpacity = 0.2,
pixelsPer10Kmph = 50,
minorTicksPer10Kmph = 5,
speedWarningWidth = 10,
yellowBoundarySpeed = 100,
redBoundarySpeed = 130,
altIndicatorHeight = 250,
altIndicatorWidth = 50,
majorTickWidth = 10,
minorTickWidth = 5,
pixelsPer100Ft = 50,
minorTicksPer100Ft = 5;
AH = function AriticialHorizon(cockpit) {
console.log("Loading Artificial Horizon plugin.");
// Instance variables
this.cockpit = cockpit;
this.roll = 0;
this.pitch = 0;
this.altitude = 0;
this.speed = 0;
// Add required UI elements
$("#cockpit").append('<canvas id="horizon" width="640" height="360"></canvas>');
this.ctx = $("#horizon").get(0).getContext('2d');
// Bind to navdata events on websockets
var ah = this;
this.cockpit.socket.on('navdata', function(data) {
if (!jQuery.isEmptyObject(data)) {
requestAnimationFrame(function() {
ah.render(data);
});
}
});
// Bind on window events to resize
$(window).resize(function(event) {
ah.draw();
});
this.draw();
};
AH.prototype.render = function(data) {
this.setValues({
roll : data.demo.rotation.roll * Math.PI / 180,
pitch : data.demo.rotation.pitch * Math.PI / 180,
altitude : data.demo.altitudeMeters,
speed : data.demo.velocity.z
// no idea...
});
this.draw();
}
AH.prototype.setValues = function setValues(values) {
this.roll = values.roll;
this.pitch = values.pitch;
this.altitude = values.altitude;
this.speed = values.speed;
};
AH.prototype.drawHorizon = function drawHorizon() {
var pitchPixels, i, pitchAngle;
this.ctx.save();
this.ctx.translate(
this.ctx.canvas.width / 2,
this.ctx.canvas.height / 2
);
this.ctx.rotate(-this.roll);
pitchPixels = this.pitch / (Math.PI * 2) * 360 * this.pixelsPerDeg;
this.ctx.translate(0, pitchPixels);
/*
this.ctx.fillStyle = skyColor;
this.ctx.fillRect(-10000, -10000, 20000, 10000);
this.ctx.fillStyle = earthColor;
this.ctx.fillRect(-10000, 0, 20000, 10000);
*/
// horizon
this.ctx.strokeStyle = '#fff';
this.ctx.fillStyle = 'white';
this.ctx.lineWidth = 2;
this.ctx.beginPath();
this.ctx.moveTo(-10000, 0);
this.ctx.lineTo(20000, 0);
this.ctx.stroke();
this.ctx.beginPath();
this.ctx.arc(
0, -pitchPixels, radialRadius,
0, Math.PI * 2,
false /* anti-clockwise */
);
this.ctx.closePath();
this.ctx.clip();
this.ctx.beginPath();
for (i = -18; i <= 18; ++i) {
pitchAngle = i / 2 * 10;
if (i !== 0) {
if (i % 2 === 0) {
this.ctx.moveTo(
-majorWidth / 2,
-this.pixelsPerDeg * pitchAngle
);
this.ctx.lineTo(
+majorWidth / 2,
-this.pixelsPerDeg * pitchAngle
);
this.ctx.fillText(
pitchAngle,
-majorWidth / 2 - 20,
-this.pixelsPerDeg * 10 / 2 * i
);
this.ctx.fillText(
pitchAngle,
majorWidth / 2 + 10,
-this.pixelsPerDeg * 10 / 2 * i
);
} else {
this.ctx.moveTo(
-minorWidth / 2,
-this.pixelsPerDeg * pitchAngle
);
this.ctx.lineTo(
+minorWidth / 2,
-this.pixelsPerDeg * pitchAngle
);
}
}
}
this.ctx.closePath();
this.ctx.stroke();
this.ctx.restore();
};
AH.prototype.drawZero = function drawZero() {
var i;
this.ctx.save();
this.ctx.translate(
this.ctx.canvas.width / 2,
this.ctx.canvas.height / 2
);
this.ctx.strokeStyle = 'yellow';
this.ctx.lineWidth = 2;
this.ctx.beginPath();
this.ctx.moveTo(-zeroWidth / 2, 0);
this.ctx.lineTo(-zeroGap / 2, 0);
this.ctx.moveTo(+zeroWidth / 2, 0);
this.ctx.lineTo(+zeroGap / 2, 0);
this.ctx.moveTo(-zeroGap / 2, zeroGap / 2);
this.ctx.lineTo(0, 0);
this.ctx.lineTo(+zeroGap / 2, zeroGap / 2);
this.ctx.stroke();
// The radial roll indicator
this.ctx.beginPath();
this.ctx.arc(
0, 0, radialRadius,
-Math.PI / 2 - Math.PI * radialLimit / 180,
-Math.PI / 2 + Math.PI * radialLimit / 180,
false /* anti-clockwise */
);
this.ctx.stroke();
for (i = -4; i <= 4; ++i) {
this.ctx.moveTo(
(radialRadius - tickRadius) * Math.cos(
-Math.PI / 2 + i * 15 / 180 * Math.PI
),
(radialRadius - tickRadius) * Math.sin(
-Math.PI / 2 + i * 15 / 180 * Math.PI
)
);
this.ctx.lineTo(
radialRadius * Math.cos(-Math.PI / 2 + i * 15 / 180 * Math.PI),
radialRadius * Math.sin(-Math.PI / 2 + i * 15 / 180 * Math.PI)
);
}
this.ctx.stroke();
this.ctx.restore();
};
AH.prototype.drawRoll = function drawRoll() {
this.ctx.save();
this.ctx.translate(
this.ctx.canvas.width / 2,
this.ctx.canvas.height / 2
);
this.ctx.rotate(-this.roll);
this.ctx.fillStyle = 'white';
this.ctx.lineWidth = 2;
this.ctx.beginPath();
this.ctx.moveTo(0, -radialRadius);
this.ctx.lineTo(-5, -radialRadius + 10);
this.ctx.lineTo(+5, -radialRadius + 10);
this.ctx.closePath();
this.ctx.fill();
var readableRollAngle = Math.round(this.roll / Math.PI / 2 * 360) % 360;
if (readableRollAngle > 180) {
readableRollAngle = readableRollAngle - 360;
}
this.ctx.fillRect(-20, -radialRadius + 9, 40, 16);
this.ctx.font = '12px Arial';
this.ctx.fillStyle = 'black';
this.ctx.fillText(readableRollAngle, -7, -radialRadius + 22);
this.ctx.restore();
};
AH.prototype.drawSpeed = function drawSpeed() {
var yellowBoundaryY, redBoundaryY, yOffset, from, to, i, j;
this.ctx.save();
this.ctx.translate(
this.ctx.canvas.width / 2,
this.ctx.canvas.height / 2
);
this.ctx.translate(
-zeroWidth / 2 - zeroPadding - speedIndicatorWidth,
0
);
this.ctx.fillStyle = 'rgba(0,0,0,' + speedAltOpacity + ')';
this.ctx.strokeStyle = 'white';
this.ctx.lineWidth = 2;
this.ctx.strokeRect(
0, -speedIndicatorHeight / 2,
speedIndicatorWidth, speedIndicatorHeight
);
this.ctx.fillRect(
0, -speedIndicatorHeight / 2,
speedIndicatorWidth, speedIndicatorHeight
);
this.ctx.restore();
this.ctx.save();
this.ctx.translate(
this.ctx.canvas.width / 2,
this.ctx.canvas.height / 2
);
this.ctx.translate(
-zeroWidth / 2 - zeroPadding - speedIndicatorWidth,
0
);
this.ctx.rect(
0, -speedIndicatorHeight / 2,
speedIndicatorWidth, speedIndicatorHeight
);
this.ctx.clip();
yellowBoundaryY = -(-this.speed + yellowBoundarySpeed) / 10 * pixelsPer10Kmph;
redBoundaryY = -(-this.speed + redBoundarySpeed) / 10 * pixelsPer10Kmph;
this.ctx.fillStyle = 'yellow';
this.ctx.fillRect(
speedIndicatorWidth - speedWarningWidth, yellowBoundaryY,
speedWarningWidth, redBoundaryY - yellowBoundaryY
);
this.ctx.fillStyle = 'red';
this.ctx.fillRect(
speedIndicatorWidth - speedWarningWidth, redBoundaryY,
speedWarningWidth, -speedIndicatorHeight / 2 - redBoundaryY
);
this.ctx.fillStyle = 'green';
this.ctx.fillRect(
speedIndicatorWidth - speedWarningWidth, yellowBoundaryY,
speedWarningWidth, +speedIndicatorHeight / 2 - yellowBoundaryY
);
yOffset = this.speed / 10 * pixelsPer10Kmph;
// The unclipped ticks to be rendered.
// We render 100kmph either side of the center to be safe
from = -Math.floor(this.speed / 10) - 10;
to = Math.ceil(this.speed / 10) + 10;
for (i = from; i < to; ++i) {
this.ctx.moveTo(
speedIndicatorWidth - speedWarningWidth,
-i * pixelsPer10Kmph + yOffset
);
this.ctx.lineTo(
speedIndicatorWidth - speedWarningWidth - majorTickWidth,
-i * pixelsPer10Kmph + yOffset
);
for (j = 1; j < minorTicksPer10Kmph; ++j) {
this.ctx.moveTo(
speedIndicatorWidth - speedWarningWidth,
-i * pixelsPer10Kmph - j * pixelsPer10Kmph /
minorTicksPer10Kmph + yOffset
);
this.ctx.lineTo(
speedIndicatorWidth - speedWarningWidth - minorTickWidth,
-i * pixelsPer10Kmph - j * pixelsPer10Kmph /
minorTicksPer10Kmph + yOffset
);
}
this.ctx.font = '12px Arial';
this.ctx.fillStyle = 'white';
this.ctx.fillText(i * 10, 20, -i * pixelsPer10Kmph + yOffset + 4);
}
this.ctx.strokeStyle = 'white';
this.ctx.lineWidth = 2;
this.ctx.stroke();
this.ctx.beginPath();
this.ctx.moveTo(
speedIndicatorWidth - speedWarningWidth - minorTickWidth, 0
);
this.ctx.lineTo(
speedIndicatorWidth - speedWarningWidth - minorTickWidth * 2, -5
);
this.ctx.lineTo(
speedIndicatorWidth - speedWarningWidth - minorTickWidth * 2, -10
);
this.ctx.lineTo(0, -10);
this.ctx.lineTo(0, 10);
this.ctx.lineTo(
speedIndicatorWidth - speedWarningWidth - minorTickWidth * 2, 10
);
this.ctx.lineTo(
speedIndicatorWidth - speedWarningWidth - minorTickWidth * 2, 5
);
this.ctx.closePath();
this.ctx.fill();
this.ctx.strokeStyle = 'black';
this.ctx.fillStyle = 'black';
this.ctx.fillText(Math.round(this.speed * 100) / 100, 15, 4.5, altIndicatorHeight);
this.ctx.restore();
};
AH.prototype.drawAltitude = function drawAltitude() {
var yOffset, from, to, i, j;
this.ctx.save();
this.ctx.translate(
this.ctx.canvas.width / 2,
this.ctx.canvas.height / 2
);
this.ctx.translate(
zeroWidth / 2 + zeroPadding,
0
);
this.ctx.fillStyle = 'rgba(0,0,0,' + speedAltOpacity + ')';
this.ctx.strokeStyle = 'white';
this.ctx.lineWidth = 2;
this.ctx.fillRect(
0, -altIndicatorHeight / 2,
altIndicatorWidth, altIndicatorHeight
);
this.ctx.strokeRect(
0, -altIndicatorHeight / 2,
altIndicatorWidth, altIndicatorHeight
);
this.ctx.restore();
this.ctx.save();
this.ctx.translate(
this.ctx.canvas.width / 2,
this.ctx.canvas.height / 2
);
this.ctx.translate(
zeroWidth / 2 + zeroPadding,
0
);
this.ctx.rect(
0, -altIndicatorHeight / 2,
altIndicatorWidth, altIndicatorHeight
);
this.ctx.clip();
yOffset = this.altitude / 100 * pixelsPer100Ft;
// The unclipped ticks to be rendered. We render 500ft either side of
// the center to be safe
from = Math.floor(this.altitude / 100) - 5;
to = Math.ceil(this.altitude / 100) + 5;
for (i = from; i < to; ++i) {
this.ctx.moveTo(0, -i * pixelsPer100Ft + yOffset);
this.ctx.lineTo(majorTickWidth, -i * pixelsPer100Ft + yOffset);
for (j = 1; j < minorTicksPer100Ft; ++j) {
this.ctx.moveTo(
0,
-i * pixelsPer100Ft - j * pixelsPer100Ft /
minorTicksPer100Ft + yOffset
);
this.ctx.lineTo(
minorTickWidth,
-i * pixelsPer100Ft -
j * pixelsPer100Ft / minorTicksPer100Ft +
yOffset
);
}
this.ctx.font = '12px Arial';
this.ctx.fillStyle = 'white';
this.ctx.fillText(i * 100, 15, -i * pixelsPer100Ft + yOffset + 4);
}
this.ctx.strokeStyle = 'white';
this.ctx.lineWidth = 2;
this.ctx.stroke();
this.ctx.restore();
this.ctx.save();
this.ctx.translate(
this.ctx.canvas.width / 2,
this.ctx.canvas.height / 2
);
this.ctx.translate(
zeroWidth / 2 + zeroPadding,
0
);
this.ctx.strokeStyle = 'white';
this.ctx.lineWidth = 2;
this.ctx.font = '12px Arial';
this.ctx.fillStyle = 'white';
this.ctx.fillOpacity = 1.0;
this.ctx.beginPath();
this.ctx.moveTo(minorTickWidth, 0);
this.ctx.lineTo(minorTickWidth * 2, -5);
this.ctx.lineTo(minorTickWidth * 2, -10);
this.ctx.lineTo(altIndicatorWidth, -10);
this.ctx.lineTo(altIndicatorWidth, 10);
this.ctx.lineTo(minorTickWidth * 2, 10);
this.ctx.lineTo(minorTickWidth * 2, 5);
this.ctx.closePath();
this.ctx.fill();
this.ctx.strokeStyle = 'black';
this.ctx.fillStyle = 'black';
this.ctx.fillText(
Math.round(this.altitude * 200) / 100,
15, 4.5, altIndicatorHeight
);
this.ctx.restore();
};
AH.prototype.draw = function draw() {
var width = $('#cockpit').innerWidth();
var height = $('#cockpit').innerHeight();
this.ctx.canvas.width = width
this.ctx.canvas.height = height
this.pixelsPerDeg = height / (frontCameraFovY / 2);
this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
this.drawHorizon();
this.drawZero();
this.drawRoll();
this.drawSpeed();
this.drawAltitude();
};
window.Cockpit.plugins.push(AH);
}(window, jQuery));
-35
Ver Arquivo
@@ -1,35 +0,0 @@
var channel = 0;
function pilot(name, deps) {
deps.io.sockets.on('connection', function (socket) {
socket.on('/pilot/move', function (cmd) {
var _name;
console.log("move", cmd);
return typeof deps.client[_name = cmd.action] === "function" ? deps.client[_name](cmd.speed) : void 0;
});
socket.on('/pilot/drone', function (cmd) {
var _name;
console.log("drone", cmd);
return typeof deps.client[_name = cmd.action] === "function" ? deps.client[_name]() : void 0;
});
socket.on('/pilot/calibrate', function (cmd) {
console.log("calibrate", cmd);
return deps.client.calibrate(cmd.device_num);
});
socket.on('/pilot/ftrim', function () {
console.log("flat trim");
return deps.client.ftrim();
});
socket.on('/pilot/animate', function (cmd) {
console.log("animate", cmd);
return deps.client.animate(cmd.action, 500);
});
socket.on('/pilot/channel', function (cmd) {
channel = (channel == 0) ? 1 : 0;
console.log("switching to channel %d", channel);
return deps.client.config('video:video_channel', channel);
});
});
};
module.exports = pilot;
-266
Ver Arquivo
@@ -1,266 +0,0 @@
PILOT_ACCELERATION = 0.04;
(function(window, document, $, undefined) {
'use strict';
var keyCodeMap = {"0":"96","1":"97","2":"98","3":"99","4":"100","5":"101","6":"102","7":"103","8":"104","9":"105","backspace":"8","tab":"9","return":"13","shift":"16","ctrl":"17","alt":"18","pausebreak":"19","capslock":"20","escape":"27"," ":"32","pageup":"33","pagedown":"34","end":"35","home":"36","left":"37","up":"38","right":"39","down":"40","+":"107","printscreen":"44","insert":"45","delete":"46",";":"186","=":"187","a":"65","b":"66","c":"67","d":"68","e":"69","f":"70","g":"71","h":"72","i":"73","j":"74","k":"75","l":"76","m":"77","n":"78","o":"79","p":"80","q":"81","r":"82","s":"83","t":"84","u":"85","v":"86","w":"87","x":"88","y":"89","z":"90","*":"106","-":"189",".":"190","/":"191","f1":"112","f2":"113","f3":"114","f4":"115","f5":"116","f6":"117","f7":"118","f8":"119","f9":"120","f10":"121","f11":"122","f12":"123","numlock":"144","scrolllock":"145",",":"188","`":"192","[":"219","\\":"220","]":"221","'":"222"};
;
var forward = 'w'
, backward = 's'
, left = 'a'
, right = 'd'
, flip = 'f'
, channel = 'c'
;
if (options && options.keyboard === 'qwerty') { }
else if (options && options.keyboard === 'azerty') {
forward = 'z';
backward = 's';
left = 'q';
right = 'd';
}
// Static keymap used within this module
var Keymap = {
38 : {
ev : 'move',
action : 'up'
},
40 : {
ev : 'move',
action : 'down'
},
37 : {
ev : 'move',
action : 'counterClockwise'
},
39 : {
ev : 'move',
action : 'clockwise'
},
32 : {
ev : 'drone',
action : 'stop'
},
84 : {
ev : 'drone',
action : 'takeoff'
},
76 : {
ev : 'drone',
action : 'land'
},
69 : {
ev : 'drone',
action : 'disableEmergency'
},
70 : {
ev : 'animate',
action : 'flip'
}
};
Keymap[keyCodeMap[forward]] = {
ev : 'move',
action : 'front'
};
Keymap[keyCodeMap[backward]] = {
ev : 'move',
action : 'back'
};
Keymap[keyCodeMap[left]] = {
ev : 'move',
action : 'left'
};
Keymap[keyCodeMap[right]] = {
ev : 'move',
action : 'right'
};
Keymap[keyCodeMap[channel]] = {
ev : 'channel'
};
/*
* Constructuor
*/
var Pilot = function Pilot(cockpit) {
console.log("Loading Pilot plugin.");
this.cockpit = cockpit;
this.speed = 0;
this.moving = false;
this.keys = {};
// Add the buttons to the control area
$('#controls').append('<input type="button" id="ftrim" value="Flat trim">');
$('#controls').append('<input type="button" id="calibratemagneto" value="Calibrate magneto">');
// Start with magneto calibration disabled.
$('#calibratemagneto').prop('disabled', true);
// Register the various event handlers
this.listen();
// Setup a timer to send motion command
var self = this;
setInterval(function(){self.sendCommands()},100);
};
/*
* Register keyboard event listener
*/
Pilot.prototype.listen = function listen() {
var pilot = this;
$(document).keydown(function(ev) {
pilot.keyDown(ev);
});
$(document).keyup(function(ev) {
pilot.keyUp(ev);
});
$('#calibratemagneto').click(function(ev) {
ev.preventDefault();
pilot.calibrate(0);
});
$('#ftrim').click(function(ev) {
ev.preventDefault();
pilot.ftrim();
});
this.cockpit.socket.on('hovering', function() {
$('#calibratemagneto').prop('disabled', false);
$('#ftrim').prop('disabled', true);
});
this.cockpit.socket.on('landed', function() {
$('#calibratemagneto').prop('disabled', true);
$('#ftrim').prop('disabled', false);
});
};
/*
* Process onkeydown. For motion commands, we just update the
* speed for the given key and the actual commands will be sent
* by the sendCommand method, triggered by a timer.
*
*/
Pilot.prototype.keyDown = function keyDown(ev) {
console.log("Keydown: " + ev.keyCode);
if (ev.keyCode == 9) {
PILOT_ACCELERATION = (PILOT_ACCELERATION == 0.04) ? 0.64 : 0.04;
console.log("PILOT_ACCELERATION: " + PILOT_ACCELERATION);
ev.preventDefault();
return;
}
if (Keymap[ev.keyCode] == null) {
return;
}
ev.preventDefault();
var key = ev.keyCode;
var cmd = Keymap[key];
//if flip, determine which direction to flip
var regFlip = /^flip/;
if (regFlip.test(cmd.action)) {
console.log("FLIP!");
//check for which direction to flip
switch (this.moving) {
case 'front':
cmd.action = 'flipAhead';
break;
case 'back':
cmd.action = 'flipBehind';
break;
case 'right':
cmd.action = 'flipRight';
break;
default:
cmd.action = 'flipLeft';
break;
}
}
// If a motion command, we just update the speed
if (cmd.ev == "move") {
this.moving = Keymap[ev.keyCode].action;
if (typeof(this.keys[key])=='undefined' || this.keys[key]===null) {
this.keys[key] = PILOT_ACCELERATION;
}
}
// Else we send the command immediately
else {
this.cockpit.socket.emit("/pilot/" + cmd.ev, {
action : cmd.action
});
}
};
/*
* On keyup we delete active keys from the key array
* and send a stop command for this direction
*/
Pilot.prototype.keyUp = function keyUp(ev) {
console.log("Keyup: " + ev.keyCode);
if (Keymap[ev.keyCode] == null) {
return;
}
ev.preventDefault();
// Delete the key from the tracking array
var key = ev.keyCode;
delete this.keys[key];
// Send a command to set the motion in this direction to zero
if (Object.keys(this.keys).length > 0) {
var cmd = Keymap[key];
this.cockpit.socket.emit("/pilot/" + cmd.ev, {
action : cmd.action,
speed : 0
});
} else { // hovering state if no more active commands
this.cockpit.socket.emit("/pilot/drone", {
action : 'stop'
});
}
}
/*
* Triggered by a timer, check for active keys
* and send the appropriate motion commands
*/
Pilot.prototype.sendCommands = function() {
for (var k in this.keys) {
var cmd = Keymap[k];
// Send the command
this.cockpit.socket.emit("/pilot/" + cmd.ev, {
action : cmd.action,
speed : this.keys[k]
});
// Update the speed
this.keys[k] = this.keys[k] + PILOT_ACCELERATION / (1 - this.keys[k]);
this.keys[k] = Math.min(1, this.keys[k]);
}
}
/*
* Requets a device callibration. Beware that for some device
* such as the compass, the drone will perform some motion.
*/
Pilot.prototype.calibrate = function calibrate(deviceNum) {
this.cockpit.socket.emit("/pilot/calibrate", {
device_num : 0
});
};
/*
* Requests a flat trim. Disabled when flying.
*/
Pilot.prototype.ftrim = function ftrim() {
this.cockpit.socket.emit("/pilot/ftrim");
};
window.Cockpit.plugins.push(Pilot);
}(window, document, jQuery));
-73
Ver Arquivo
@@ -1,73 +0,0 @@
var fs = require('fs');
var df = require('dateformat');
var util = require('util');
var path = require('path');
var timers = require('timers');
var lineReader = require('line-reader');
var reader = require ("buffered-reader");
var config, client,video, navReader, vidReader, rawVideo, lastFrame;
var BinaryReader = reader.BinaryReader;
var NAV_INTERVAL = 1000/15; // Navdata sent 15/s in demo mode
var VIDEO_INTERVAL = 1000/30; // 30 fps
function replay(name, deps) {
config = deps.config;
client = deps.client;
video = client.getVideoStream();
// Open the navdata file for line-by-line read
var self = this;
var navPath = path.join(config.replay.path, 'navdata.txt');
lineReader.open(navPath, function(reader) {
navReader = reader;
});
// Open the video raw stream
var videoPath = path.join(config.replay.path, 'video.h264');
rawVideo = new BinaryReader(videoPath);
// Open the video headers stream
var headerPath = path.join(config.replay.path, 'paveHeaders.txt');
lineReader.open(headerPath, function(reader) {
vidReader = reader;
vidReader.nextLine(function(data) {
// Read the first line and send video immediately the first time
var frame = JSON.parse(data);
lastFrame = frame;
emitVideo();
});
});
// Schedule timer to simulate nav data emit
timers.setInterval(emitNav, NAV_INTERVAL);
}
function emitNav() {
if (navReader && navReader.hasNextLine()) {
navReader.nextLine(function(data) {
client.emit('navdata', JSON.parse(data));
});
}
}
function emitVideo() {
if (vidReader && vidReader.hasNextLine()) {
vidReader.nextLine(function(data) {
var frame = JSON.parse(data);
var next = frame.timestamp - lastFrame.timestamp;
lastFrame = frame;
// Read a block (based on the size in the lastFrame)
rawVideo.read(lastFrame.payload_size, function (error, bytes, bytesRead) {
if (error) throw error;
video.emit('data', bytes);
});
timers.setTimeout(emitVideo, next);
});
}
}
module.exports = replay;
-25
Ver Arquivo
@@ -1,25 +0,0 @@
function video(name, deps) {
var latestImage;
// Add a new route to fetch camera image
deps.app.get('/camera/:id', function(req, res) {
if (!latestImage) {
res.writeHead(301, {"Location": "/plugin/" + name + "/images/nofeed.jpg"});
res.end();
return;
}
res.writeHead(200, {'Content-Type': 'image/png'});
return res.end(latestImage, "binary");
});
// Add a handler on images update
deps.client.getPngStream()
.on('error', console.log)
.on('data', function(frame) {
latestImage = frame;
});
};
module.exports = video;
-8
Ver Arquivo
@@ -1,8 +0,0 @@
#video {
width: 100%;
height: 100%;
position: absolute;
z-index: -1;
top: 0px;
left: 0px;
}
Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 53 KiB

-19
Ver Arquivo
@@ -1,19 +0,0 @@
(function(window, document) {
var Video = function Video(cockpit) {
console.log("Initializing video plugin.");
// Add some UI elements
$('#cockpit').append('<img id="video" src="" />');
// Update image at 20fps
var videoImg = $("#video");
videoImg.attr("src", '/camera/' + new Date().getTime());
setInterval(function() {
videoImg.attr("src", '/camera/' + new Date().getTime());
}, 100);
};
window.Cockpit.plugins.push(Video);
}(window, document));
-16
Ver Arquivo
@@ -1,16 +0,0 @@
var join = require('path').join;
function video(name, deps) {
var path = '/plugin/' + name + '/js/nodecopter-client.js';
// serve nodecopter-client from node_modules:
deps.app.get(path, function (req, res) {
res.sendfile(join(
'node_modules', 'dronestream', 'dist', 'nodecopter-client.js'
));
});
require("dronestream").listen(3001, {tcpVideoStream: deps.client.getVideoStream()});
}
module.exports = video;
-14
Ver Arquivo
@@ -1,14 +0,0 @@
#dronestream {
position: absolute;
z-index: -1;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
overflow: hidden;
}
#dronestream canvas {
width: 100%;
height: 100%;
}
-18
Ver Arquivo
@@ -1,18 +0,0 @@
(function(window, document, $) {
var Video = function Video(cockpit) {
console.log("Initializing video stream plugin.");
var video = this;
// Add some UI elements
$('#cockpit').append('<div id="dronestream"></div>');
// Start the stream
cockpit.videostream = new NodecopterStream(
document.getElementById("dronestream"),
{port: 3001}
);
};
window.Cockpit.plugins.push(Video);
}(window, document, jQuery));
@@ -1,3 +0,0 @@
/* this is a dummy file that is replaced with dist/nodecopter-client.js
* from the dronestream module by express.
*/
-6
Ver Arquivo
@@ -1,6 +0,0 @@
@font-face {
font-family: 'Audiowide';
font-style: normal;
font-weight: 400;
src: url(/fonts/Audiowide/Audiowide-Regular.ttf);
}
-85
Ver Arquivo
@@ -1,85 +0,0 @@
/*
* Notify Bar - jQuery plugin
*
* Copyright (c) 2009-2013 Dmitri Smirnov
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Version: 1.4
*
* Project home:
* http://www.whoop.ee/posts/2013-04-05-the-resurrection-of-jquery-notify-bar/
*/
/* Default bars' style */
.jquery-notify-bar {
width:100%;
position:fixed;
top:0;
left:0;
z-index:32768;
background-color:#efefef;
font-size:18px;
color:#000;
text-align:center;
font-family: Arial, Verdana, sans-serif;
padding:20px 0px;
cursor: pointer;
border-bottom:1px solid #ddd;
-webkit-box-shadow: inset 0 -1px 0 0 #fff;
-moz-box-shadow: inset 0 -1px 0 0 #fff;
box-shadow: inset 0 -1px 0 0 #fff;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(255, 255, 255, 0.5)), to(rgba(255, 255, 255, 0)));
background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background-image: -moz-linear-gradient(rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background-image: -o-linear-gradient(rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background-image: linear-gradient(rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
}
.jquery-notify-bar.bottom {
bottom:0;
top:auto;
border-top:1px solid #ddd;
border-bottom:0;
-webkit-box-shadow: inset 0 1px 0 0 #fff;
-moz-box-shadow: inset 0 1px 0 0 #fff;
box-shadow: inset 0 1px 0 0 #fff;
}
.jquery-notify-bar.top {}
/* Style for errors */
.jquery-notify-bar.error {
color:#f00;
background-color:#fdd;
}
.jquery-notify-bar.error .notify-bar-text-wrapper {
background: transparent url("../images/cross.png") no-repeat center left;
padding-left:20px;
}
/* Style for warning */
.jquery-notify-bar.warning {
color:#000;
background-color:#fffaaa;
}
.jquery-notify-bar.warning .notify-bar-text-wrapper {
background: transparent url("../images/error.png") no-repeat center left;
padding-left:20px;
}
/* Style for success (notice) */
.jquery-notify-bar.success {
color:#060;
background-color:#BBFFB6;
}
.jquery-notify-bar.success .notify-bar-text-wrapper {
background: transparent url("../images/tick.png") no-repeat center left;
padding-left:20px;
}
/* Style for close button */
.notify-bar-close {
position:absolute;
left:95%;
font-size:11px;
}
-50
Ver Arquivo
@@ -1,50 +0,0 @@
/*! normalize.css v1.0.1 | MIT License | git.io/normalize */
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary{display:block}
audio,canvas,video{display:inline-block;*display:inline;*zoom:1}
audio:not([controls]){display:none;height:0}
[hidden]{display:none}
html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}
html,button,input,select,textarea{font-family:sans-serif}
body{margin:0}
a:focus{outline:thin dotted}
a:active,a:hover{outline:0}
h1{font-size:2em;margin:.67em 0}
h2{font-size:1.5em;margin:.83em 0}
h3{font-size:1.17em;margin:1em 0}
h4{font-size:1em;margin:1.33em 0}
h5{font-size:.83em;margin:1.67em 0}
h6{font-size:.75em;margin:2.33em 0}
abbr[title]{border-bottom:1px dotted}
b,strong{font-weight:bold}
blockquote{margin:1em 40px}
dfn{font-style:italic}
mark{background:#ff0;color:#000}
p,pre{margin:1em 0}
code,kbd,pre,samp{font-family:monospace,serif;_font-family:'courier new',monospace;font-size:1em}
pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}
q{quotes:none}
q:before,q:after{content:'';content:none}
small{font-size:80%}
sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
sup{top:-0.5em}
sub{bottom:-0.25em}
dl,menu,ol,ul{margin:1em 0}
dd{margin:0 0 0 40px}
menu,ol,ul{padding:0 0 0 40px}
nav ul,nav ol{list-style:none;list-style-image:none}
img{border:0;-ms-interpolation-mode:bicubic}
svg:not(:root){overflow:hidden}
figure{margin:0}
form{margin:0}
fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em}
legend{border:0;padding:0;white-space:normal;*margin-left:-7px}
button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}
button,input{line-height:normal}
button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;*overflow:visible}
button[disabled],input[disabled]{cursor:default}
input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;*height:13px;*width:13px}
input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}
input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}
button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
textarea{overflow:auto;vertical-align:top}
table{border-collapse:collapse;border-spacing:0}
-44
Ver Arquivo
@@ -1,44 +0,0 @@
.header-container {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 20px;
background: black;
color: white;
padding: 5px 10px;
}
.header-container .brand {
font-family: Audiowide, Arial
}
.main-container {
position: absolute;
top: 30px;
left: 0px;
right: 0px;
bottom: 0px;
}
#controls {
float: right;
}
#glasspane {
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
z-index: 100;
-webkit-user-select: none; // webkit (safari, chrome) browsers
-moz-user-select: none; // mozilla browsers
-khtml-user-select: none; // webkit (konqueror) browsers
}
#cockpit {
height: 100%;
width: 100%;
}
Arquivo binário não exibido.
-92
Ver Arquivo
@@ -1,92 +0,0 @@
Copyright (c) 2012, Brian J. Bonislawsky DBA Astigmatic (AOETI) (astigma@astigmatic.com), with Reserved Font Names "Audiowide"
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
-202
Ver Arquivo
@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 655 B

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 666 B

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 537 B

-54
Ver Arquivo
@@ -1,54 +0,0 @@
(function(window, document, $, undefined) {
var hostname = document.location.hostname ? document.location.hostname : "localhost";
var Cockpit = function Cockpit() {
this.socket = io.connect('http://' + hostname);
this.loadPlugins();
// Fullscreen on doubleclick
$("#glasspane").dblclick(function(ev) {
ev.preventDefault();
$(document).toggleFullScreen();
return false;
});
// Basic socket messages
this.socket.on('/message', function(data) {
$.notifyBar({
html : JSON.stringify(data)
});
});
this.socket.on('/success', function(data) {
$.notifyBar({
cssClass : "success",
html : 'Success : ' + JSON.stringify(data)
});
});
this.socket.on('/warning', function(data) {
$.notifyBar({
cssClass : "warning",
html : JSON.stringify(data)
});
});
this.socket.on('/error', function(e) {
$.notifyBar({
cssClass : "error",
html : 'Error : ' + JSON.stringify(e)
});
});
};
Cockpit.prototype.loadPlugins = function loadPlugins() {
var cockpit = this;
Cockpit.plugins.forEach(function(plugin) {
new plugin(cockpit);
});
};
// Static array containing all plugins to load
Cockpit.plugins = [];
window.Cockpit = Cockpit;
}(window, document, jQuery));
-10
Ver Arquivo
@@ -1,10 +0,0 @@
/*
jquery.fullscreen 1.1.4
https://github.com/kayahr/jquery-fullscreen-plugin
Copyright (C) 2012 Klaus Reimer <k@ailis.de>
Licensed under the MIT license
(See http://www.opensource.org/licenses/mit-license)
*/
function d(b){var c,a;if(!this.length)return this;c=this[0];c.ownerDocument?a=c.ownerDocument:(a=c,c=a.documentElement);if(null==b){if(!a.cancelFullScreen&&!a.webkitCancelFullScreen&&!a.mozCancelFullScreen)return null;b=!!a.fullScreen||!!a.webkitIsFullScreen||!!a.mozFullScreen;return!b?b:a.fullScreenElement||a.webkitCurrentFullScreenElement||a.mozFullScreenElement||b}b?(b=c.requestFullScreen||c.webkitRequestFullScreen||c.mozRequestFullScreen)&&b.call(c,Element.ALLOW_KEYBOARD_INPUT):(b=a.cancelFullScreen||
a.webkitCancelFullScreen||a.mozCancelFullScreen)&&b.call(a);return this}jQuery.fn.fullScreen=d;jQuery.fn.toggleFullScreen=function(){return d.call(this,!d.call(this))};var e,f,g;e=document;e.webkitCancelFullScreen?(f="webkitfullscreenchange",g="webkitfullscreenerror"):e.mozCancelFullScreen?(f="mozfullscreenchange",g="mozfullscreenerror"):(f="fullscreenchange",g="fullscreenerror");jQuery(document).bind(f,function(){jQuery(document).trigger(new jQuery.Event("fullscreenchange"))});
jQuery(document).bind(g,function(){jQuery(document).trigger(new jQuery.Event("fullscreenerror"))});
-153
Ver Arquivo
@@ -1,153 +0,0 @@
/*
* Notify Bar - $ plugin
*
* Copyright (c) 2009-2013 Dmitri Smirnov
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Version: 1.4
*
* Project home:
* http://www.whoop.ee/posts/2013-04-05-the-resurrection-of-jquery-notify-bar/
*/
(function ($) {
$.notifyBar = function (options) {
var rand = parseInt(Math.random() * 100000000, 0),
text_wrapper,
bar = {},
settings = {};
settings = $.extend({
html : 'Your message here',
delay : 2000,
animationSpeed : 200,
cssClass : '',
jqObject : '',
close : false,
closeText : 'Close [X]',
closeOnClick : true,
closeOnOver : false,
onBeforeShow : null,
onShow : null,
onBeforeHide : null,
onHide : null,
position : 'top'
}, options);
// Use these methods as private.
this.fn.showNB = function () {
if (typeof settings.onBeforeShow === 'function') {
settings.onBeforeShow.call();
}
$(this).stop().slideDown(asTime, function () {
if (typeof settings.onShow === 'function') {
settings.onShow.call();
}
});
};
this.fn.hideNB = function (delayed) {
if (typeof settings.onBeforeHide === 'function') {
settings.onBeforeHide.call();
}
$(this).stop().slideUp(asTime, function () {
if (bar.attr("id") === "__notifyBar" + rand) {
$(this).slideUp(asTime, function () {
$(this).remove();
if (typeof settings.onHide === 'function') {
settings.onHide.call();
}
});
} else {
$(this).slideUp(asTime, function () {
if (typeof settings.onHide === 'function') {
settings.onHide.call();
}
});
}
});
};
if (settings.jqObject) {
bar = settings.jqObject;
settings.html = bar.html();
} else {
bar = $("<div></div>")
.addClass("jquery-notify-bar")
.addClass(settings.cssClass)
.attr("id", "__notifyBar" + rand);
}
text_wrapper = $("<span></span>")
.addClass("notify-bar-text-wrapper")
.html(settings.html);
bar.html(text_wrapper).hide();
var id = bar.attr("id");
switch (settings.animationSpeed) {
case "slow":
asTime = 600;
break;
case "default":
case "normal":
asTime = 400;
break;
case "fast":
asTime = 200;
break;
default:
asTime = settings.animationSpeed;
}
if (bar !== 'object') {
$("body").prepend(bar);
}
// Style close button in CSS file
if (settings.close) {
// If close settings is true. Set delay to one billion seconds.
// It'a about 31 years - mre than enough for cases when notify bar is used.
settings.delay = Math.pow(10, 9);
bar.append($("<a href='#' class='notify-bar-close'>" + settings.closeText + "</a>"));
$(".notify-bar-close").click(function (event) {
event.preventDefault();
bar.hideNB();
});
}
// Check if we've got any visible bars and if we have,
// slide them up before showing the new one
if ($('.jquery-notify-bar:visible').length > 0) {
$('.jquery-notify-bar:visible').stop().slideUp(asTime, function () {
bar.showNB();
});
} else {
bar.showNB();
}
// Allow the user to click on the bar to close it
if (settings.closeOnClick) {
bar.click(function () {
bar.hideNB();
});
}
// Allow the user to move mouse on the bar to close it
if (settings.closeOnOver) {
bar.mouseover(function () {
bar.hideNB();
});
}
setTimeout(function () {
bar.hideNB(settings.delay);
}, settings.delay + asTime);
if (settings.position === 'bottom') {
bar.addClass('bottom');
} else if (settings.position === 'top') {
bar.addClass('top');
}
};
})(jQuery);
-36
Ver Arquivo
@@ -1,36 +0,0 @@
(function (window) {
'use strict';
var lastTime = 0,
vendors = ['ms', 'moz', 'webkit', 'o'],
x,
length,
currTime,
timeToCall;
for (x = 0, length = vendors.length; x < length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[
vendors[x] + 'RequestAnimationFrame'
];
window.cancelAnimationFrame = window[
vendors[x] + 'CancelAnimationFrame'
] || window[vendors[x] + 'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame) {
window.requestAnimationFrame = function (callback, element) {
currTime = new Date().getTime();
timeToCall = Math.max(0, 16 - (currTime - lastTime));
lastTime = currTime + timeToCall;
return window.setTimeout(function () {
callback(currTime + timeToCall);
}, timeToCall);
};
}
if (!window.cancelAnimationFrame) {
window.cancelAnimationFrame = function (id) {
clearTimeout(id);
};
}
}(window));
+68
Ver Arquivo
@@ -0,0 +1,68 @@
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { font-weight: bold } /* Keyword.Constant */
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
.highlight .kn { font-weight: bold } /* Keyword.Namespace */
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d14 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #CBDFFF } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */
.highlight .sx { color: #d14 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d14 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
.type-csharp .highlight .k { color: #0000FF }
.type-csharp .highlight .kt { color: #0000FF }
.type-csharp .highlight .nf { color: #000000; font-weight: normal }
.type-csharp .highlight .nc { color: #2B91AF }
.type-csharp .highlight .nn { color: #000000 }
.type-csharp .highlight .s { color: #A31515 }
.type-csharp .highlight .sc { color: #A31515 }
+246
Ver Arquivo
@@ -0,0 +1,246 @@
body {
margin: 0;
padding: 0;
background: #151515 url("../images/bkg.png") 0 0;
color: #eaeaea;
font: 16px;
line-height: 1.5;
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
}
/* General & 'Reset' Stuff */
.container {
width: 90%;
max-width: 600px;
margin: 0 auto;
}
section {
display: block;
margin: 0 0 20px 0;
}
h1, h2, h3, h4, h5, h6 {
margin: 0 0 20px;
}
li {
line-height: 1.4 ;
}
/* Header, <header>
header - container
h1 - project name
h2 - project description
*/
header {
background: rgba(0, 0, 0, 0.1);
width: 100%;
border-bottom: 1px dashed #b5e853;
padding: 20px 0;
margin: 0 0 40px 0;
}
header h1 {
font-size: 30px;
line-height: 1.5;
margin: 0 0 0 -30px;
font-family: Audiowide, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
color: #b5e853;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1),
0 0 5px rgba(181, 232, 83, 0.1),
0 0 10px rgba(181, 232, 83, 0.1);
letter-spacing: -1px;
-webkit-font-smoothing: antialiased;
}
header h1:before {
content: "./ ";
font-size: 24px;
}
header h2 {
font-size: 18px;
font-weight: 300;
color: #666;
}
#downloads .btn {
display: inline-block;
text-align: center;
margin: 0;
}
/* Main Content
*/
#main_content {
width: 100%;
-webkit-font-smoothing: antialiased;
}
section img {
max-width: 100%
}
h1, h2, h3, h4, h5, h6 {
font-weight: normal;
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
color: #b5e853;
letter-spacing: -0.03em;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1),
0 0 5px rgba(181, 232, 83, 0.1),
0 0 10px rgba(181, 232, 83, 0.1);
}
#main_content h1 {
font-size: 30px;
}
#main_content h2 {
font-size: 24px;
}
#main_content h3 {
font-size: 18px;
}
#main_content h4 {
font-size: 14px;
}
#main_content h5 {
font-size: 12px;
text-transform: uppercase;
margin: 0 0 5px 0;
}
#main_content h6 {
font-size: 12px;
text-transform: uppercase;
color: #999;
margin: 0 0 5px 0;
}
dt {
font-style: italic;
font-weight: bold;
}
ul li {
list-style: none;
}
ul li:before {
content: ">>";
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
font-size: 13px;
color: #b5e853;
margin-left: -37px;
margin-right: 21px;
line-height: 16px;
}
blockquote {
color: #aaa;
padding-left: 10px;
border-left: 1px dotted #666;
}
pre {
background: rgba(0, 0, 0, 0.9);
border: 1px solid rgba(255, 255, 255, 0.15);
padding: 10px;
font-size: 14px;
color: #b5e853;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
text-wrap: normal;
overflow: auto;
overflow-y: hidden;
}
table {
width: 100%;
margin: 0 0 20px 0;
}
th {
text-align: left;
border-bottom: 1px dashed #b5e853;
padding: 5px 10px;
}
td {
padding: 5px 10px;
}
hr {
height: 0;
border: 0;
border-bottom: 1px dashed #b5e853;
color: #b5e853;
}
/* Buttons
*/
.btn {
display: inline-block;
background: -webkit-linear-gradient(top, rgba(40, 40, 40, 0.3), rgba(35, 35, 35, 0.3) 50%, rgba(10, 10, 10, 0.3) 50%, rgba(0, 0, 0, 0.3));
padding: 8px 18px;
border-radius: 50px;
border: 2px solid rgba(0, 0, 0, 0.7);
border-bottom: 2px solid rgba(0, 0, 0, 0.7);
border-top: 2px solid rgba(0, 0, 0, 1);
color: rgba(255, 255, 255, 0.8);
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
text-decoration: none;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.75);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.btn:hover {
background: -webkit-linear-gradient(top, rgba(40, 40, 40, 0.6), rgba(35, 35, 35, 0.6) 50%, rgba(10, 10, 10, 0.8) 50%, rgba(0, 0, 0, 0.8));
}
.btn .icon {
display: inline-block;
width: 16px;
height: 16px;
margin: 1px 8px 0 0;
float: left;
}
.btn-github .icon {
opacity: 0.6;
background: url("../images/blacktocat.png") 0 0 no-repeat;
}
/* Links
a, a:hover, a:visited
*/
a {
color: #63c0f5;
text-shadow: 0 0 5px rgba(104, 182, 255, 0.5);
}
/* Clearfix */
.cf:before, .cf:after {
content:"";
display:table;
}
.cf:after {
clear:both;
}
.cf {
zoom:1;
}
-49
Ver Arquivo
@@ -1,49 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title><%= title %></title>
<link rel="stylesheet" href="/css/fonts.css">
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/css/jquery.notifyBar.css">
<% for(var i=0; i<styles.length; i++) {%>
<link rel="stylesheet" href="<%= styles[i] %>"><% } %>
</head>
<script>
var options = <%- JSON.stringify(options) %>;
</script>
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="/components/jquery/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.fullscreen-min.js"></script>
<script type="text/javascript" src="/js/polyfills.js"></script>
<script type="text/javascript" src="/js/cockpit.js"></script>
<script type="text/javascript" src="/js/jquery.notifyBar.js"></script>
<% for(var i=0; i<scripts.length; i++) {%>
<script type="text/javascript" src="<%= scripts[i] %>"></script><% } %>
<body>
<div class="header-container">
<span id="controls">
</span>
<header class="wrapper clearfix">
<span class="brand">WebFlight</span>
</header>
</div>
<div class="main-container">
<div class="main wrapper clearfix">
<div id="glasspane">
<div id="cockpit">
</div>
</div>
</div>
</div>
<div class="footer-container">
<footer class="wrapper">
</footer>
</div>
<script>
var cockpit = new Cockpit();
</script>
</body>
</html>