Final commit of the hack day

Esse commit está contido em:
Craig Rowe
2013-08-10 18:59:58 +01:00
commit a996605a6e
3 arquivos alterados com 74 adições e 52 exclusões
+8
Ver Arquivo
@@ -0,0 +1,8 @@
<component name="libraryTable">
<library name="sass-stdlib">
<CLASSES />
<SOURCES>
<root url="file://$APPLICATION_HOME_DIR$/plugins/sass/lib/stubs/sass_functions.scss" />
</SOURCES>
</library>
</component>
+30 -43
Ver Arquivo
@@ -2,13 +2,16 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" name="Default" comment=""> <list default="true" id="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" name="Default" comment="">
<change type="DELETED" beforePath="$PROJECT_DIR$/stop.png" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/test.png" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/go.js" afterPath="$PROJECT_DIR$/go.js" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/go.js" afterPath="$PROJECT_DIR$/go.js" />
</list> </list>
<ignored path="NodeCopterHack.iws" /> <ignored path="NodeCopterHack.iws" />
<ignored path=".idea/workspace.xml" /> <ignored path=".idea/workspace.xml" />
<file path="/Dummy.txt" changelist="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" time="1376145571388" ignored="false" />
<file path="/go.js" changelist="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" time="1376145996690" ignored="false" />
<file path="/nearest.js" changelist="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" time="1376142921730" ignored="false" /> <file path="/nearest.js" changelist="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" time="1376142921730" ignored="false" />
<file path="/go.js" changelist="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" time="1376145996690" ignored="false" />
<file path="/Dummy.txt" changelist="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" time="1376145571388" ignored="false" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -31,7 +34,7 @@
<file leaf-file-name="go.js" pinned="false" current="true" current-in-tab="true"> <file leaf-file-name="go.js" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/go.js"> <entry file="file://$PROJECT_DIR$/go.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="92" column="67" selection-start="2542" selection-end="2542" vertical-scroll-proportion="0.34051725"> <state line="56" column="4" selection-start="1383" selection-end="1383" vertical-scroll-proportion="-2.3131618">
<folding /> <folding />
</state> </state>
</provider> </provider>
@@ -56,11 +59,6 @@
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="GitLogSettings">
<option name="myDateState">
<MyDateState />
</option>
</component>
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="changedFiles"> <option name="changedFiles">
<list> <list>
@@ -70,10 +68,10 @@
</option> </option>
</component> </component>
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="64" /> <option name="x" value="1" />
<option name="y" value="-4" /> <option name="y" value="22" />
<option name="width" value="1857" /> <option name="width" value="1440" />
<option name="height" value="1085" /> <option name="height" value="809" />
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false"> <component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" /> <OptionsSetting value="true" id="Add" />
@@ -109,16 +107,6 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="NodeCopterHack" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="NodeCopterHack" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane> </subPane>
</pane> </pane>
<pane id="Scope" /> <pane id="Scope" />
@@ -128,18 +116,10 @@
<property name="options.splitter.main.proportions" value="0.3" /> <property name="options.splitter.main.proportions" value="0.3" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="options.lastSelected" value="Template Data Languages" /> <property name="options.lastSelected" value="Template Data Languages" />
<property name="options.splitter.details.proportions" value="0.2" />
<property name="options.searchVisible" value="true" /> <property name="options.searchVisible" value="true" />
<property name="options.splitter.details.proportions" value="0.2" />
</component> </component>
<component name="RunManager"> <component name="RunManager">
<configuration default="true" type="DartUnitRunConfigurationType" factoryName="DartUnit">
<option name="VMOptions" />
<option name="arguments" />
<option name="filePath" />
<option name="scope" value="ALL" />
<option name="testName" />
<method />
</configuration>
<list size="0" /> <list size="0" />
</component> </component>
<component name="ShelveChangesManager" show_recycled="false" /> <component name="ShelveChangesManager" show_recycled="false" />
@@ -152,13 +132,14 @@
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="64" y="-4" width="1857" height="1085" extended-state="6" /> <frame x="1" y="22" width="1440" height="809" extended-state="0" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24959569" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25322813" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
@@ -199,20 +180,13 @@
<option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" /> <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
<option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" /> <option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
<option name="DEFAULT_PATCH_EXTENSION" value="patch" /> <option name="DEFAULT_PATCH_EXTENSION" value="patch" />
<option name="SHORT_DIFF_HORIZONTALLY" value="true" /> <option name="SHORT_DIFF_HORISONTALLY" value="true" />
<option name="SHORT_DIFF_EXTRA_LINES" value="2" /> <option name="SHORT_DIFF_EXTRA_LINES" value="2" />
<option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" /> <option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
<option name="INCLUDE_TEXT_INTO_PATCH" value="false" /> <option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" /> <option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
<option name="SHOW_FILE_HISTORY_DETAILS" value="true" /> <option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
<option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" /> <option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
<option name="SHOW_DIRTY_RECURSIVELY" value="false" />
<option name="LIMIT_HISTORY" value="true" />
<option name="MAXIMUM_HISTORY_ROWS" value="1000" />
<option name="UPDATE_FILTER_SCOPE_NAME" />
<option name="USE_COMMIT_MESSAGE_MARGIN" value="false" />
<option name="COMMIT_MESSAGE_MARGIN_SIZE" value="72" />
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="false" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" /> <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" /> <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
<option name="LAST_COMMIT_MESSAGE" /> <option name="LAST_COMMIT_MESSAGE" />
@@ -226,7 +200,6 @@
<option name="ACTIVE_VCS_NAME" /> <option name="ACTIVE_VCS_NAME" />
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" /> <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" /> <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
<option name="UPDATE_FILTER_BY_SCOPE" value="false" />
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" /> <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" /> <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
</component> </component>
@@ -234,6 +207,20 @@
<breakpoint-manager /> <breakpoint-manager />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/go.js">
<provider selected="true" editor-type-id="text-editor">
<state line="92" column="67" selection-start="2542" selection-end="2542" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/nearest.js">
<provider selected="true" editor-type-id="text-editor">
<state line="11" column="0" selection-start="0" selection-end="465" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/go.js"> <entry file="file://$PROJECT_DIR$/go.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0"> <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
@@ -278,7 +265,7 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/go.js"> <entry file="file://$PROJECT_DIR$/go.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="92" column="67" selection-start="2542" selection-end="2542" vertical-scroll-proportion="0.34051725"> <state line="56" column="4" selection-start="1383" selection-end="1383" vertical-scroll-proportion="-2.3131618">
<folding /> <folding />
</state> </state>
</provider> </provider>
+36 -9
Ver Arquivo
@@ -21,18 +21,24 @@ app.get('/image', function (req, res) {
res.end(lastPng); res.end(lastPng);
} }
}); });
var lastCommand = "";
app.get('/land', function (req, res) { app.get('/land', function (req, res) {
client.land(); client.land();
res.render('index'); res.render('index');
lastCommand = "LAND";
});
app.get('/takeoff', function (req, res) {
takeoff();
res.render('index');
lastCommand = "TAKEOFF";
}); });
var arDrone = require('ar-drone'); var arDrone = require('ar-drone');
var client = arDrone.createClient(); var client = arDrone.createClient();
var pngStream; var pngStream;
client.disableEmergency();
//client.takeoff();
client.after(2000, function () {
pngStream = client.getPngStream(); pngStream = client.getPngStream();
pngStream.on('error', console.log).on('data', function (pngBuffer) { pngStream.on('error', console.log).on('data', function (pngBuffer) {
lastPng = pngBuffer; lastPng = pngBuffer;
@@ -47,7 +53,6 @@ client.after(2000, function () {
}); });
}); });
});
var takeoff = function () { var takeoff = function () {
client.takeoff(); client.takeoff();
@@ -73,6 +78,7 @@ var scan = function (filename) {
app.listen(8076); app.listen(8076);
var lastRun = new Date() - 5000;
var doAction = function (command) { var doAction = function (command) {
findCommand(command, function (res) { findCommand(command, function (res) {
if(res) { if(res) {
@@ -80,17 +86,22 @@ var doAction = function (command) {
var commands = { var commands = {
'LAND': function () { 'LAND': function () {
client.land(); client.land();
isFlying = false;
}, },
'TAKEOFF': function () { 'TAKEOFF': function () {
client.takeoff();
lastRun = new Date() + 10000;
takeoff();
}, },
'TAKE OFF': function () { 'TAKE OFF': function () {
client.takeoff(); lastRun = new Date() + 10000;
takeoff();
}, },
'PARTY': function () { 'PARTY': function () {
client.animateLeds('redSnake', 5, 5); client.animateLeds('redSnake', 5, 5);
client.clockwise(2); //client.clockwise(2);
client.animate('doublePhiThetaMixed', 5000); client.animate('doublePhiThetaMixed', 5);
}, },
'FLIP': function () { 'FLIP': function () {
client.animate('flipBehind', 2000); client.animate('flipBehind', 2000);
@@ -124,7 +135,23 @@ var doAction = function (command) {
var upper = command.toUpperCase(); var upper = command.toUpperCase();
if(typeof commands[upper] == 'function') { if(typeof commands[upper] == 'function') {
commands[upper](); var delta = new Date() - lastRun;
if(!lastRun || delta > 5000){
console.log(lastCommand);
if(lastCommand != upper.replace(" ", ""))
{
console.log('Running: ' + upper + 'Delta:'+ delta);
commands[upper]();
lastRun = new Date();
lastCommand = upper;
}else
{
console.log('dup command');
}
}else{
console.log('Too Soon: ' + delta);
}
} else { } else {
// console.log("BAD Command: " + command); // console.log("BAD Command: " + command);
} }