Added confidence

Esse commit está contido em:
David Henderson
2013-08-10 15:11:30 +01:00
commit fea4360a98
3 arquivos alterados com 139 adições e 30 exclusões
+59 -10
Ver Arquivo
@@ -2,12 +2,15 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/nearest.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/go.js" afterPath="$PROJECT_DIR$/go.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
</list>
<ignored path="NodeCopterHack.iws" />
<ignored path=".idea/workspace.xml" />
<file path="/Dummy.txt" changelist="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" time="1376139814566" ignored="false" />
<file path="/go.js" changelist="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" time="1376139920469" ignored="false" />
<file path="/Dummy.txt" changelist="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" time="1376143309879" ignored="false" />
<file path="/go.js" changelist="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" time="1376143525720" ignored="false" />
<file path="/nearest.js" changelist="eeacb93f-73aa-46ec-92c7-08d6fb5d2b5c" time="1376142921730" ignored="false" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -30,7 +33,16 @@
<file leaf-file-name="go.js" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/go.js">
<provider selected="true" editor-type-id="text-editor">
<state line="6" column="0" selection-start="185" selection-end="185" vertical-scroll-proportion="0.109913796">
<state line="104" column="2" selection-start="2594" selection-end="2594" vertical-scroll-proportion="0.34051725">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="nearest.js" pinned="false" current="false" current-in-tab="false">
<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>
@@ -54,6 +66,7 @@
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
<option value="$PROJECT_DIR$/nearest.js" />
<option value="$PROJECT_DIR$/go.js" />
</list>
</option>
@@ -121,6 +134,14 @@
<property name="options.splitter.details.proportions" value="0.2" />
</component>
<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" />
</component>
<component name="ShelveChangesManager" show_recycled="false" />
@@ -136,22 +157,22 @@
<frame x="64" y="-4" width="1857" height="1085" extended-state="6" />
<editor active="true" />
<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="-1" 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="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="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="-1" 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="-1" 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="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" 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="Version Control" 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="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" 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="Ant Build" active="false" anchor="right" 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="Find" active="false" anchor="bottom" 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="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
@@ -217,7 +238,35 @@
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/go.js">
<provider selected="true" editor-type-id="text-editor">
<state line="6" column="0" selection-start="185" selection-end="185" vertical-scroll-proportion="0.109913796">
<state line="0" column="0" selection-start="0" selection-end="0" 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="0" column="0" selection-start="0" selection-end="465" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/go.js">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" 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">
<provider selected="true" editor-type-id="text-editor">
<state line="104" column="2" selection-start="2594" selection-end="2594" vertical-scroll-proportion="0.34051725">
<folding />
</state>
</provider>
+57 -20
Ver Arquivo
@@ -22,9 +22,9 @@ app.get('/image', function (req, res) {
}
});
app.get('/land', function(req, res) {
client.land();
res.render('index');
app.get('/land', function (req, res) {
client.land();
res.render('index');
});
var arDrone = require('ar-drone');
@@ -79,25 +79,62 @@ var scan = function (filename) {
app.listen(8076);
var doAction = function (command) {
console.log("COMMAND: " + command);
var commands = {
'LAND': function () {
client.land();
},
'TAKEOFF': function () {
client.takeoff();
},
'DANCE': function()
{
client.animateLeds('redSnake', 5, 5);
findCommand(command, function (res) {
if(res) {
console.log("COMMAND: " + res);
var commands = {
'LAND': function () {
client.land();
},
'TAKEOFF': function () {
client.takeoff();
},
'DANCE': function () {
client.animateLeds('redSnake', 5, 5);
}
}
var upper = command.toUpperCase();
if(typeof commands[upper] == 'function') {
commands[upper]();
} else {
console.log("BAD Command: " + command);
}
} else {
console.log("BAD Command: " + command);
}
}
}
var upper = command.toUpperCase();
if(typeof commands[upper] == 'function') {
commands[upper]();
}
);
};
var findCommand = function (command, callback) {
nn = require('nearest-neighbor');
var items = [
{ name: "LAND"},
{ name: "TAKE OFF"},
{ name: "UP"},
{ name: "DOWN"},
{ name: "LEFT"},
{ name: "RIGHT"},
{ name: "DANCE"}
];
var query = { name: command};
var fields = [
{ name: "name", measure: nn.comparisonMethods.word }
];
nn.findMostSimilar(query, items, fields, function (nearestNeighbor, probability) {
console.log(query);
console.log(nearestNeighbor);
console.log(probability);
if(probability > 0.6) {
callback(nearestNeighbor.name);
} else {
callback('');
}
});
}
//takeoff();
+23
Ver Arquivo
@@ -0,0 +1,23 @@
nn = require('nearest-neighbor');
var items = [
{ name: "LAND"},
{ name: "TAKE OFF"},
{ name: "UP"},
{ name: "DOWN"},
{ name: "LEFT"},
{ name: "RIGHT"},
{ name: "DANCE"},
];
var query = { name: "kuLAND"};
var fields = [
{ name: "name", measure: nn.comparisonMethods.word },
];
nn.findMostSimilar(query, items, fields, function(nearestNeighbor, probability) {
console.log(query);
console.log(nearestNeighbor);
console.log(probability);
});