initial commit
This commit is contained in:
1
node_modules/jibo-tools/lib/get-electron-path.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/get-electron-path.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(){var e=require("path"),r=require("os"),t=r.platform(),n={darwin:"dist/Electron.app/Contents/MacOS/Electron",freebsd:"dist/electron",linux:"dist/electron",win32:"dist/electron.exe"},i=e.resolve(e.dirname(require.resolve("electron-prebuilt")),n[t]);return i}module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/jibo-tools.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/jibo-tools.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var r=function(r){return r&&r.__esModule?r["default"]:r},e=r(require("./package-generator/package-generator")),o=r(require("./launcher/launcher")),t=r(require("./robots/ssh")),s=r(require("./robots/sync")),u=r(require("./robots/run")),i=r(require("./robots/debug")),a=r(require("./robots/stop")),b=r(require("./robots/robots")),n=r(require("./robots/networks")),l=r(require("./robots/disk-space")),q=r(require("./robots/build-version")),c=r(require("./robots/volume")),p=r(require("./robots/startup")),d=r(require("./robots/reboot")),g=r(require("./robots/poweroff")),h=r(require("./robots/validate-skill-path")),k=r(require("./get-electron-path"));module.exports={packageGenerator:e,launcher:o,ssh:t,sync:s,run:u,debug:i,stop:a,robots:b,networks:n,diskSpace:l,buildVersion:q,volume:c,startup:p,reboot:d,poweroff:g,validateSkillPath:h,getElectronPath:k};
|
||||
1
node_modules/jibo-tools/lib/launcher/launcher.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/launcher/launcher.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var i in t){var r=t[i];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(e,t)}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),i=function h(e,t,i){var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:h(o,t,i)}if("value"in r&&r.writable)return r.value;var n=r.get;if(void 0!==n)return n.call(i)},r=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},o=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=require("child_process").spawn,s=e(require("../get-electron-path")),l=e(require("path")),c=require("events").EventEmitter,u=e(require("lodash")),a=function(e){function c(){o(this,c),i(Object.getPrototypeOf(c.prototype),"constructor",this).call(this),this.child=void 0,this.onChildExitBinded=this.onChildExit.bind(this)}return r(c,e),t(c,{onChildExit:{value:function(){this.child.removeAllListeners(),this.child=void 0,this.emit("exit")}},play:{value:function(e,t){var i=void 0===arguments[2]?"0123456789abcdefg":arguments[2];if(console.log("indexPath",e),console.log("remoteRegistry",t),!this.child){var r=l.resolve(__dirname,"..","..","electron"),o=[l.resolve(r,"main.js"),"--path",e,"--token",i];t&&t.length>0&&o.push("--remote",t);var c={ATOM_SHELL_INTERNAL_RUN_AS_NODE:"0"};process.env.hasOwnProperty("NODE_PATH_SIM")&&(process.env.hasOwnProperty("NODE_PATH")?c.NODE_PATH=process.env.NODE_PATH+":"+process.env.NODE_PATH_SIM:c.NODE_PATH=process.env.NODE_PATH_SIM),this.child=n(s(),o,{cwd:r,env:u.assign({},process.env,c),stdio:"inherit"}),this.emit("start"),this.child.on("exit",this.onChildExit.bind(this))}}},stop:{value:function(){this.child&&(console.log("STOP"),this.child.on("error",function(e){console.log(e)}),this.child.kill())}}}),c}(c);module.exports=new a;
|
||||
1
node_modules/jibo-tools/lib/package-generator/package-generator.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/package-generator/package-generator.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,r){var n;return n=/__(?:(package-name)|([pP]ackageName)|(package_name))__/g,e.replace(n,r)}function r(e,r){var n;return n=/__(?:(display-name))__/g,e.replace(n,r)}function n(e){return e=e.replace(/-+|_+/g," "),e=e.replace(/\s+/g," ").trim(),e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})}function a(e,r){var a;return a=/__(?:(skill-page-title))__/g,e.replace(a,n(r))}var t=function(e){return e&&e.__esModule?e["default"]:e},c=t(require("fs-plus")),i=t(require("path")),l=t(require("wrench")),s=t(require("npm"));module.exports=function(n,t,u,o,p){var m,_,g,d,y,S,f,h,v,k=i.resolve(__dirname,"../../templates",n);try{c.statSync(k)}catch(b){p("Template type "+n+" does not exist")}for(null===u&&(u=i.basename(t)),c.makeTreeSync(t),y=l.readdirSyncRecursive(k),f=[],g=0,d=y.length;d>g;g++)m=y[g],v=i.resolve(k,m),S=v.replace(k,""),S=S.replace(/^\//,""),S=S.replace(/\.template$/,""),h=i.join(t,S),c.existsSync(h)||(c.isDirectorySync(v)?f.push(c.makeTreeSync(h)):c.isFileSync(v)?(c.makeTreeSync(i.dirname(h)),_=c.readFileSync(v),"package.json"===i.basename(v)?(_=e(_.toString(),u),_=r(_.toString(),o)):"index.html"===i.basename(v)&&(_=a(_.toString(),u)),f.push(c.writeFileSync(h,_))):f.push(void 0));s.load(function(){s.commands.install(t,[],function(e){p(e?"Error during npm install: "+e:null)})})};
|
||||
1
node_modules/jibo-tools/lib/robots/build-version.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/build-version.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function o(o,i){e("ssh root@"+o.ip+' "jibo-version"',function(o,e){return o?void i(o):void i(null,e)})}var e=require("child_process").exec;module.exports=o;
|
||||
1
node_modules/jibo-tools/lib/robots/config.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/config.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var r in t){var n=t[r];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),r=function g(e,t,r){var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var o=Object.getPrototypeOf(e);return null===o?void 0:g(o,t,r)}if("value"in n&&n.writable)return n.value;var i=n.get;if(void 0!==i)return i.call(r)},n=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},o=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=e(require("fs")),u=e(require("path")),s=require("events").EventEmitter,a=e(require("ensureDir")),l=e(require("osenv")),f=u.resolve(l.home(),".jibo/cli.json"),c=function(e){function s(){o(this,s),r(Object.getPrototypeOf(s.prototype),"constructor",this).call(this),this.settings={}}return n(s,e),t(s,{load:{value:function(e){var t=this;i.readFile(f,function(r,n){if(r)return t.settings={},void e(null);try{var o=JSON.parse(n);t.settings=o}catch(i){console.log("parse error"),console.log(i),e(i)}e(null)})}},save:{value:function(e){var t=this;a(u.dirname(f),null,function(){i.writeFile(f,JSON.stringify(t.settings,null," "),function(t){e(t)})})}},get:{value:function(){if(0===arguments.length)return this.settings;for(var e=this.settings,t=0;t<arguments.length;t++){if("undefined"==typeof e[arguments[t]])return;e=e[arguments[t]]}return e}},set:{value:function(e){if(0===arguments.length)throw new Error("No value was provided to Config.set()");1===arguments.length&&(this.settings=e);for(var t=this.settings,r=0;r<arguments.length-2;r++)console.log("path "+arguments[r]),("undefined"==typeof t[arguments[r]]||Array.isArray(t[arguments[r]]))&&(t[arguments[r]]={}),t=t[arguments[r]];t[arguments[arguments.length-2]]=arguments[arguments.length-1]}}}),s}(s);module.exports=c;
|
||||
1
node_modules/jibo-tools/lib/robots/debug.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/debug.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function r(r,e,c,l){o(r,e,function(e,o){return e?void c(e):void i("9222:localhost:9222",function(e){if(e)return void c(e);var l=t("sh",["-c","ssh -f -N -L 9222:localhost:9222 root@"+r.ip]);l.stdout.on("data",function(r){process.stdout.write(r)}),l.on("exit",function(){n("http://localhost:9222/json",function(r,e,n){if(r||200!=e.statusCode)return void c(new Error("Couldn't fetch debugger apps list: "+r));try{!function(){var r=JSON.parse(n);i("debugger-app",function(e){if(e)return void c(e);var n=u.resolve(__dirname,"./debugger-app.js"),i=""+s()+" "+n+" http://localhost:9222"+r[0].devtoolsFrontendUrl+" &",l=t("sh",["-c",""+i]);l.unref(),c(null,o)})}()}catch(l){return void c(l)}})})})},l)}var e=function(r){return r&&r.__esModule?r["default"]:r},t=require("child_process").spawn,o=e(require("./run")),n=e(require("request")),u=e(require("path")),i=e(require("./kill-process")),s=e(require("../get-electron-path"));module.exports=r;
|
||||
1
node_modules/jibo-tools/lib/robots/debugger-app.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/debugger-app.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(){var e;try{e=JSON.parse(r.readFileSync(d,"utf8"))}catch(t){}return"undefined"!=typeof e&&"undefined"!=typeof e.bounds?e.bounds:{width:1024,height:768}}function t(){var e={bounds:c.getBounds()};r.writeFileSync(d,JSON.stringify(e))}var o=require("app"),n=require("menu"),a=require("browser-window"),l=require("path"),r=require("fs"),d=l.join(o.getDataPath(),"debugger-config.json"),i=process.argv[2],u=[{label:"Electron",submenu:[{label:"Quit",accelerator:"Command+Q",click:function(){o.quit()}}]},{label:"View",submenu:[{label:"Reload",accelerator:"Command+R",click:function(){c&&c.reloadIgnoringCache()}}]},{label:"Edit",submenu:[{label:"Undo",accelerator:"Command+Z",selector:"undo:"},{label:"Redo",accelerator:"Command+Shift+Z",selector:"redo:"},{type:"separator"},{label:"Cut",accelerator:"Command+X",selector:"cut:"},{label:"Copy",accelerator:"Command+C",selector:"copy:"},{label:"Paste",accelerator:"Command+V",selector:"paste:"},{label:"Select All",accelerator:"Command+A",selector:"selectAll:"}]}],c=null;o.on("window-all-closed",function(){"darwin"!=process.platform&&o.quit()}),o.on("ready",function(){n.setApplicationMenu(n.buildFromTemplate(u));var o=e();c=new a(o),c.loadUrl(i),c.on("closed",function(){t(c),c=null});var l={x:c.getBounds().x,y:c.getBounds().y,width:c.getBounds().width,height:c.getBounds().height};setInterval(function(){(l.x!==c.getBounds().x||l.y!==c.getBounds().y||l.width!==c.getBounds().width||l.height!==c.getBounds().height)&&(t(),l={x:c.getBounds().x,y:c.getBounds().y,width:c.getBounds().width,height:c.getBounds().height})},500)});
|
||||
1
node_modules/jibo-tools/lib/robots/disk-space.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/disk-space.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function s(s,n){i("ssh root@"+s.ip+' "df -h"',function(o,e){return o?void n(o):(e=e.split("\n").slice(0,2).join("\n"),void i("ssh root@"+s.ip+' "cd /jibo/skills; du -hs *|sort -nr"',function(s,i){return s?void n(s):void n(null,"System Diskspace:\n\n"+e+"\n\nSkill Diskspace Usage:\n\n"+i)}))})}var i=require("child_process").exec;module.exports=s;
|
||||
2
node_modules/jibo-tools/lib/robots/index-robot-via-motion-service.js
generated
vendored
Executable file
2
node_modules/jibo-tools/lib/robots/index-robot-via-motion-service.js
generated
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";var o=require("ws"),e=[{position:0,velocity:0,enabled:!0},{position:0,velocity:0,enabled:!0},{position:0,velocity:0,enabled:!0}],n={start:function(n){var t=n+":9191",i=new o("ws://"+t);i.on("open",function(){try{i.send(JSON.stringify(e)),setInterval(function(){process.exit()},1e3)}catch(o){console.log("Error sending to motion service: "+o),process.exit(1)}}),i.on("error",function(){console.log("Couldn't connect to motion service"),process.exit(1)})}};n.start(process.argv[2]);
|
||||
2
node_modules/jibo-tools/lib/robots/index-robot.js
generated
vendored
Executable file
2
node_modules/jibo-tools/lib/robots/index-robot.js
generated
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";var t=require("ws"),s={start:function(t,s){this.state=null,this.indexed=!1,this.holdOffOnLogging=!0,this._start(t,s)},_start:function(t,s){var e=this,o=t+":8282";try{this.indexed=!1,this.state_socket=this._setupStateSocket(o),this.state_socket.on("close",function(){e.state_socket=null}),this.state_socket.on("error",function(){console.log("Couldn't connect to body service's state websocket"),process.exit(1)}),this.command_socket=this._setupCommandSocket(o),this.command_socket.on("close",function(){e.command_socket=null}),this.command_socket.on("error",function(){console.log("Couldn't connect to body service's command websocket"),process.exit(1)})}catch(n){console.log("ERROROROROR: "+n)}setTimeout(function(){e.holdOffOnLogging=!1,e.indexed?(console.log("\nJibo was already indexed."),e._shutdown(s)):(process.stdout.write("Indexing Jibo. Hold onto your bot, he's going to be spinning..."),e._startSpinningJibo(e.command_socket),e.indexCheckInterval=setInterval(function(){e.indexed&&(console.log("Finished."),e._shutdown(s))},100))},500)},_shutdown:function(t){process.exit(),t()},_setupStateSocket:function(s){var e=this,o=new t("ws://"+s+"/axis_state");return o.on("open",function(){}),o.on("message",function(t){var s,o=JSON.parse(t);e.state=o,null===e.state_socket,s="pelvis "+e._statusToStr(o.pelvis.status),s+=" - ",s+="torso "+e._statusToStr(o.torso.status),s+=" - ",s+="neck "+e._statusToStr(o.neck.status),e.holdOffOnLogging===!1&&process.stdout.write("."),1&o.pelvis.status&&1&o.torso.status&&1&o.neck.status&&(e.indexed=!0)}),o},_setupCommandSocket:function(s){var e=new t("ws://"+s+"/axis_command");return e.on("open",function(){}),e.on("message",function(t){console.log("Got command message: "+t.data)}),e},_startSpinningJibo:function(s){var e=this;this.spinInterval=setInterval(function(){s.readyState!=t.OPEN&&console.log("error: socket.readyState",s.readyState);var o=e._buildCmd();o&&s.send(o)},50)},_buildCmd:function(){if(null===this.state)return null;var t={mode:4,value:[-1],vel_limit:this.state.pelvis.vel_limit,acc_limit:50,cur_limit:this.state.pelvis.cur_limit},s={mode:4,value:[-1],vel_limit:this.state.torso.vel_limit,acc_limit:50,cur_limit:this.state.torso.cur_limit},e={mode:4,value:[-1],vel_limit:this.state.neck.vel_limit,acc_limit:50,cur_limit:this.state.neck.cur_limit},o={ts:[this.state.ts[0],this.state.ts[1]],pelvis:t,torso:s,neck:e};return JSON.stringify(o)},_statusToStr:function(t){if(0===t)return"none";var s="";return 1&t&&(s+="INDEXED "),2&t&&(s+="ENABLED "),4&t&&(s+="BRAKED "),8&t&&(s+="MOVING "),16&t&&(s+="STALLED "),32&t&&(s+="TIMEOUT "),64&t&&(s+="FAULT "),128&t&&(s+="ABS_INDEXED "),s}};s.start(process.argv[2]);
|
||||
1
node_modules/jibo-tools/lib/robots/kill-process.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/kill-process.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,r){n("ps -e",function(t,u){if(t)return void r(t);var o=i.filter(u.split("\n"),function(r){return-1!==r.search(e)});o=i.map(o,function(e){return/\d{1,}/.exec(e)[0]});var c="kill "+o.join(" ")+" || :";n(c,function(e){return e?void r(e):void r()})})}var r=function(e){return e&&e.__esModule?e["default"]:e},n=require("child_process").exec,i=r(require("lodash"));module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/led.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/led.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function o(o,n){return i?void process.nextTick(n):(i=new t("ws://"+o.ip+":8282/led_command"),i.onopen=function(){n()},void(i.onerror=function(){n(new Error("Couldn't open websocket to robot for LED manipulation"))}))}function n(o,n,t,e,u,s){var c=JSON.stringify({ts:[0,0],rate_limit:[Math.abs((n-r[0])/u*100),Math.abs((t-r[1])/u*100),Math.abs((e-r[2])/u*100)],color:[n,t,e]});i.send(c),r[0]=n,r[1]=t,r[2]=e,setTimeout(function(){s()},1e3*u)}var t=require("ws"),i=void 0,r=[0,0,0],e={pulse:function(t,i,r,e,u,s){o(t,function(o){return o?void s(o):void n(t,i,r,e,u,function(o){return o?void s(o):void n(t,0,0,0,u,function(o){return o?void s(o):void s()})})})}};module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/networks.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/networks.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=require("child_process").spawn,o=t(require("./led")),n={getNetworkName:function(t){process.nextTick(t,null,"")},isRobotReachable:function(t,n){this.getNetworkName(function(r){if(r)return void n(r);var i=e("ping",["-t 10",t.ip],["pipe"]),s="";i.stderr.on("data",function(t){s+=t.toString(),(-1!==s.search("No route to host")||-1!==s.search("Host is down"))&&(n(null,!1),i.kill("SIGHUP"))});var u="";i.stdout.on("data",function(e){if(u+=e.toString(),-1!==u.search("bytes from")){i.kill("SIGHUP");var r=1/8;o.pulse(t,105/255*r,210/255*r,231/255*r,.125,function(){n(null,!0)})}})})}};module.exports=n;
|
||||
1
node_modules/jibo-tools/lib/robots/poweroff.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/poweroff.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function o(o,r){e("ssh root@"+o.ip+' "poweroff"',function(o){return o?void r(o):void r(null)})}var e=require("child_process").exec;module.exports=o;
|
||||
1
node_modules/jibo-tools/lib/robots/reboot.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/reboot.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function o(o,r){e("ssh root@"+o.ip+' "reboot"',function(o){return o?void r(o):void r(null)})}var e=require("child_process").exec;module.exports=o;
|
||||
1
node_modules/jibo-tools/lib/robots/robots.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/robots.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function t(t){var e=new r;e.load(function(o){return o?void t(o):void t(null,e)})}function e(){return!0}var o=function(t){return t&&t.__esModule?t["default"]:t},r=o(require("./config")),n=o(require("lodash")),i={list:function(e){t(function(t,o){if(t)return void e(t);var r=o.get("robots");return Array.isArray(r)?void e(null,r):void e(null,[])})},add:function(o,r,i,u){t(function(t,a){if(t)return void u(t);if(0===o.length)return void u(new Error("Robot's name must be at least one character long"));if(e(r)===!1)return void u(new Error("IP address is not a valid ("+r+")"));if(0===i.length)return void u(new Error("Network name must be at least one character long"));var s=a.get("robots");return("undefined"==typeof s||Array.isArray(s)===!1)&&(s=[]),-1!==n.findIndex(s,function(t){return t.name===o})?void u(new Error("A robot with the name "+o+" already exists. Delete it first if you want to update it's information ")):(s.push({name:o,ip:r,network:i}),s.sort(function(t,e){return t>e}),a.set("robots",s),1===s.length&&a.set("defaultRobot",o),void a.save(function(t){u(t)}))})},remove:function(e,o){console.log(""),t(function(t,r){if(t)return void o(t);if(0===e.length)return void o(new Error("Robot's name must be at least one character long"));var i=r.get("robots");if("undefined"==typeof i||Array.isArray(i)===!1)return void o(new Error("There are no robots to delete"));var u=n.findIndex(i,function(t){return t.name===e});return-1===u?void o(new Error("No robot with the name "+e+" exists.")):(n.pullAt(i,u),r.set("robots",i),r.get("defaultRobot")===e&&r.set("defaultRobot",void 0),void r.save(function(t){o(t)}))})},setDefault:function(e,o){t(function(t,r){if(t)return void o(t);if(0===e.length)return void o(new Error("Robot's name must be at least one character long"));var i=r.get("robots");return Array.isArray(i)===!1||-1===n.findIndex(i,function(t){return t.name===e})?void o(new Error(""+e+" doesn't exist in the list of robots. Run to 'jibo robot-list' to see the list of robots")):(r.set("defaultRobot",e),void r.save(function(t){o(t)}))})},getDefault:function(e){t(function(t,o){if(t)return void e(t);var r=o.get("defaultRobot");return"undefined"==typeof r?void e(null,null):void e(null,r)})},getInfo:function(t,e){return 0===t.length?void e(new Error("Robot's name must be at least one character long")):void this.list(function(o,r){if(o)return void e(o);var i=n.findIndex(r,function(e){return e.name===t});return-1===i?void e(new Error("No robot by the name "+t+" exists in the robot list")):void e(null,r[i])})}};module.exports=i;
|
||||
1
node_modules/jibo-tools/lib/robots/run.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/run.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function r(r,e,n,i){o(r,function(o){if(o)return void n(o);var s="cd /jibo/skills/"+e+"/;(killall -SIGQUIT /opt/electron/electron;true) >/dev/null 2>&1;LD_LIBRARY_PATH=/usr/lib/tegra:/usr/lib/tegra-egl startx /opt/electron/electron --remote-debugging-port=9222 /jibo/sdk/bin/window-manager.js "+("/jibo/skills/"+e+"/index.html -- -nocursor"),l=t("sh",["-c","ssh root@"+r.ip+' "'+s+'"']);l.stdout.on("data",function(){l.kill("SIGHUP")}),l.stderr.on("data",function(r){return i===!0&&process.stderr.write(r),-1!==r.toString().search("Renderer process started")?void l.kill("SIGHUP"):void 0}),l.on("exit",function(){n(null,e)})})}var e=function(r){return r&&r.__esModule?r["default"]:r},t=require("child_process").spawn,o=e(require("./sync-bin-scripts"));module.exports=r;
|
||||
1
node_modules/jibo-tools/lib/robots/services.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/services.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var r=require("child_process").exec,e={list:function(e){r("/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'",function(r,i){if(r)return void e(r);var t=i.trim();e(null,t)})},debug:function(){}};module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/ssh.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/ssh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},r=require("child_process"),i=r.spawn,o=r.exec,n=e(require("fs")),s=e(require("path")),t=e(require("osenv")),u={run:function(e,r){var o=i("sh",["-c","ssh root@"+e.ip],{stdio:"inherit"});o.on("exit",function(){r(null)})},addKey:function(e,r){var i=s.resolve(t.home(),".ssh/id_rsa.pub");n.readFile(i,"utf8",function(n,s){return n?-2===n.errno?void r(new Error("There isn't a public key at the expected location: '"+i+"'")):void r(n):void o("ssh root@"+e.ip+' "cat .ssh/authorized_keys"',function(i,n){if(i){if(-1===i.toString().indexOf("can't open '.ssh/authorized_keys'"))return void r(i)}else if(-1!==n.indexOf(s))return void r(new Error("Your ssh key was already added"));o("cat ~/.ssh/id_rsa.pub | ssh root@"+e.ip+' "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"',function(e){return e?void r(e):void r(null)})})})},tunnel:function(){}};module.exports=u;
|
||||
1
node_modules/jibo-tools/lib/robots/startup.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/startup.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function r(r,e){t(r,function(t){if(t)return void e(t);var n=i("sh",["-c","ssh root@"+r.ip+' "source /etc/profile; [ ! -e /etc/init.d/S85jibo-motion-service ] || /etc/init.d/S85jibo-motion-service stop || true ;"'],{stdio:"inherit"});n.on("exit",function(t){if(0!==t)return void e(new Error("stop-motion-service script exited with an error code: "+t));var n=o.resolve(__dirname,"./index-robot.js"),s=i(n,[r.ip],{stdio:"inherit"});s.on("exit",function(o){if(0!==o)return void e(new Error("There was an error trying to index the robot"));var t=i("sh",["-c","ssh root@"+r.ip+' "(killall /opt/electron/electron;true) >/dev/null 2>&1; source /etc/profile; /jibo/sdk/bin/xwindows-warmup.sh"'],{stdio:"inherit"});t.on("exit",function(r){return 0!==r?void e(new Error("xwindows-warmup.sh script exited with an error code: "+r)):void e(null)})})})})}var e=function(r){return r&&r.__esModule?r["default"]:r},i=require("child_process").spawn,o=e(require("path")),t=e(require("./sync-bin-scripts"));module.exports=r;
|
||||
1
node_modules/jibo-tools/lib/robots/stop.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/stop.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,r){o("debugger-bootstrap",function(o){if(o)return void r(o);var i=t("sh",["-c","ssh root@"+e.ip+' "(killall -SIGQUIT /opt/electron/electron;true)"'],{stdio:"inherit"});i.on("exit",function(){r(null)})})}var r=function(e){return e&&e.__esModule?e["default"]:e},t=require("child_process").spawn,o=r(require("./kill-process"));module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/sync-bin-scripts.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/sync-bin-scripts.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,r){var n=o.resolve(__dirname,"../../bin"),t="ssh root@"+e.ip+' "mkdir -p /jibo/sdk/bin"; '+("rsync -av --delete "+n+" root@"+e.ip+":/jibo/sdk/");i(t,function(e){return e?void r(e):void r(null)})}var r=function(e){return e&&e.__esModule?e["default"]:e},i=require("child_process").exec,o=r(require("path"));module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/sync.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/sync.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,i,o){r(i,function(i,r,u){return i?void o(i):void s("ssh root@"+e.ip+' "mkdir -p /jibo/skills/'+u+'"',function(i){if(i)return void o(i);var s=t("sh",["-c","rsync -av -L -p --delete --force --exclude='.git/' --exclude='*/node_modules/jibo-gulp/' "+r+"/ root@"+e.ip+":/jibo/skills/"+u+"/"]),n=0;s.stdout.on("data",function(e){process.stdout.write(e),n++}),s.on("exit",function(){o(null,r,"/jibo/skills/"+u,n)})})})}var i=function(e){return e&&e.__esModule?e["default"]:e},o=require("child_process"),t=o.spawn,s=o.exec,r=i(require("./validate-skill-path"));module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/validate-skill-path.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/validate-skill-path.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function r(r){return"string"==typeof r?n.resolve(process.cwd(),r):process.cwd()}function e(e,o){e=r(e),t.lstat(e,function(r,i){return r?-2===r.errno?void o(new Error("No folder exists at "+e)):void o(r):i.isDirectory()===!1?void o(new Error(""+e+" is a file not a directory")):void t.readFile(n.resolve(e,"package.json"),"utf8",function(r,n){if(r)return-2===r.errno?void o(new Error("No 'package.json' exists at "+e+"/package.json")):void o(r);var t=void 0;try{t=JSON.parse(n)}catch(i){return void o(new Error("Error parsing skill's 'package.json' at "+e+"/package.json"))}if("string"!=typeof t.name&&0!==t.name.length)return void o(new Error('Skill hasn\'t properly set the "name" field in '+e+"/package.json"));var a=t.name;o(null,e,a)})})}var o=function(r){return r&&r.__esModule?r["default"]:r},n=o(require("path")),t=o(require("fs"));module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/volume.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/volume.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=require("child_process").exec,r={get:function(r,n){e("ssh root@"+r.ip+' "amixer -c 1 cget numid=2"',function(e,r){if(e)return void n(e);var u=/values=(\d{1,3}),(\d{1,3})/g.exec(r);return 3!==u.length||Number.isNaN(parseInt(u[1]))===!0||Number.isNaN(parseInt(u[2]))===!0?void n(new Error("Could not parse the internal get volume command's output (we use an amixer command). Should have included \"values=<number>,<number>\". It's output was\n\n"+r)):void n(null,u[2])})},set:function(r,n,u){var t=parseInt(n);return Number.isNaN(parseInt(t))?void u(new Error("Volume wasn't a number. Was "+n)):0>t||t>175?void u(new Error("Volume must be in the range [0-175]. Was "+t)):void e("ssh root@"+r.ip+' "amixer -c 1 cset numid=2 '+t+'"',function(e){return e?void u(e):void u(null)})}};module.exports=r;
|
||||
1
node_modules/jibo-tools/lib/simulator/dev-tools.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/dev-tools.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var n=function(n){return n&&n.__esModule?n["default"]:n},e=n(require("./settings")),o={init:function(n){var o=this;this.mainWindow=n,e.get("isSimulatorDevToolsOpened")&&this.mainWindow.webContents.openDevTools(),this.devToolsWindowDimensionChangesInterval=setInterval(function(){o.mainWindow.webContents.devToolsWebContents},200),this.mainWindow.webContents.on("devtools-opened",function(){if(e.update({isSimulatorDevToolsOpened:!0}),o.mainWindow.webContents.devToolsWebContents){var t=n.webContents.devToolsWebContents.getOwnerBrowserWindow();t.setPosition(e.get("devToolsWindowX"),e.get("devToolsWindowY"))}}),this.mainWindow.webContents.on("devtools-closed",function(){e.update({isSimulatorDevToolsOpened:!1})})},shutdown:function(){this.devToolsWindowDimensionChangesInterval&&(clearInterval(this.devToolsWindowDimensionChangesInterval),this.devToolsWindowDimensionChangesInterval=null)}};module.exports=o;
|
||||
1
node_modules/jibo-tools/lib/simulator/elements/custom-elements.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/elements/custom-elements.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(){function t(t,e){for(var n in e){var r=e[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(t,e)}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),e=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)},n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r=require("react/lib/ReactInjection"),o={isCustomAttribute:function(t){return-1!==["mini"].indexOf(t)},Properties:{mini:null},DOMAttributeNames:{},DOMPropertyNames:{}};r.DOMProperty.injectDOMPropertyConfig(o);var i=function(r){function o(){n(this,o),null!=r&&r.apply(this,arguments)}return e(o,r),t(o,{createdCallback:{value:function(){this.classList.add("editor","editor-colors"),this.setAttribute("tabindex",-1),this.addEventListener("focus",this.focused.bind(this)),this.addEventListener("blur",this.blurred.bind(this))}},attachedCallback:{value:function(){console.log("atom-text-editor attached")}},detachedCallback:{value:function(){console.log("atom-text-editor detached")}},focused:{value:function(){}},blurred:{value:function(){}}}),o}(HTMLElement);document.registerElement("atom-workspace"),document.registerElement("atom-panel"),document.registerElement("atom-pane-container"),document.registerElement("atom-text-editor",{prototype:i.prototype});
|
||||
1
node_modules/jibo-tools/lib/simulator/react-components/tab-bar.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/react-components/tab-bar.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=t(require("react"));module.exports=e.createClass({displayName:"tab-bar",getInitialState:function(){return{activeTab:0}},render:function(){var t=this,a=[];return this.props.tabs.forEach(function(i,s){var c="tab";s===t.state.activeTab&&(c+=" active"),a.push(e.createElement("div",{onClick:t.onClick.bind(t,s,i.callback),className:c},e.createElement("div",{className:"title"},i.label)))}),e.createElement("div",null,e.createElement("div",{className:"tab-bar",style:{width:"100%"}},a))},onClick:function(t,e){this.state.activeTab=t,this.setState(this.state),e()}});
|
||||
1
node_modules/jibo-tools/lib/simulator/services/asr-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/asr-service.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/jibo-tools/lib/simulator/services/audio-entity.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/audio-entity.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var i=function(){function i(i,t){for(var n in t){var o=t[n];o.configurable=!0,o.value&&(o.writable=!0)}Object.defineProperties(i,t)}return function(t,n,o){return n&&i(t.prototype,n),o&&i(t,o),t}}(),t=function(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function n(){t(this,n),this.ts=[0,0],this.type=void 0,this.id=void 0,this.position={x:void 0,y:void 0,z:void 0},this.confidence=void 0}return i(n,{updatePosition:{value:function(i){this.position.x=i.x,this.position.y=i.y,this.position.z=i.z}},updateId:{value:function(i){this.id=i}},updateType:{value:function(i){this.type=i}},updateConfidence:{value:function(i){this.confidence=i}},updateTs:{value:function(i){this.ts=i}}}),n}();module.exports=n;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/entity.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/entity.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var i=function(){function i(i,o){for(var d in o){var t=o[d];t.configurable=!0,t.value&&(t.writable=!0)}Object.defineProperties(i,o)}return function(o,d,t){return d&&i(o.prototype,d),t&&i(o,t),o}}(),o=function(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")},d=0,t=function(){function t(){var i=void 0===arguments[0]?void 0:arguments[0];o(this,t),this.id=i||d++,this.confidence=void 0,this.description=void 0,this.position={x:void 0,y:void 0,z:void 0},this.orientation={x:void 0,y:void 0,z:void 0},this.extent={x:void 0,y:void 0,z:void 0},this["static"]=void 0,this.parts=[{key:void 0,value:{id:void 0,confidence:void 0,visible:void 0,tracker:{position:{x:void 0,y:void 0,z:void 0},rotation:{x:void 0,y:void 0,z:void 0},velocity:{x:void 0,y:void 0,z:void 0},angVelocity:{x:void 0,y:void 0,z:void 0}},extent:{x:void 0,y:void 0,z:void 0},rays:[{origin:{x:0,y:0,z:0},dir:{x:void 0,y:void 0,z:void 0},cameraId:void 0,tag:void 0,timestamp:{time_since_epoch:{count:void 0}}}],trackers:[{id:void 0,cameraId:void 0,confidence:void 0,covariance:{n11:void 0,n12:void 0,n21:void 0,n22:void 0},points:[],rectangle:{left:void 0,top:void 0,right:void 0,bottom:void 0},velocity:{x:void 0,y:void 0},inFOV:void 0,visible:void 0,lastUpdate:{time_since_epoch:{count:void 0}},name:void 0,needModelUpdate:void 0}]}}]}return i(t,{updatePosition:{value:function(i){this.parts[0].value.rays[0].dir.x=i.x,this.parts[0].value.rays[0].dir.y=i.y,this.parts[0].value.rays[0].dir.z=i.z}},updateId:{value:function(i){this.id=i}}}),t}();module.exports=t;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/lps-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/lps-service.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=function(){function t(t,e){for(var i in e){var n=e[i];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(t,e)}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),i=function l(t,e,i){var n=Object.getOwnPropertyDescriptor(t,e);if(void 0===n){var o=Object.getPrototypeOf(t);return null===o?void 0:l(o,e,i)}if("value"in n&&n.writable)return n.value;var r=n.get;if(void 0!==r)return r.call(i)},n=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)},o=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r=t(require("http")),s=require("websocket").server,a=t(require("./entity")),u=t(require("./audio-entity")),c=t(require("events")),d=function(t){function c(){o(this,c),i(Object.getPrototypeOf(c.prototype),"constructor",this).call(this),this.port=12476,this.cameras=[],this.entities=[],this.audioEntities=[],this.visualState={cameras:this.cameras,entities:this.entities},this.audioState={entities:this.audioEntities},this.connectionHandlers={"/visual_awareness":this.onVisualAwareness.bind(this),"/audible_awareness":this.onAudibleAwareness.bind(this)},this.httpHandlers={"/photo":this.onPhoto.bind(this),"/barcode":this.onBarcode.bind(this)},setInterval(this.update.bind(this),100)}return n(c,t),e(c,{init:{value:function(t){var e=this;this.httpServer=r.createServer(),this.httpServer.on("listening",function(){e.wsServer=new s({httpServer:e.httpServer,autoAcceptConnections:!1}),e.wsServer.on("request",function(t){var i=t.accept(null,t.origin);e.connectionHandlers[t.resource]?e.connectionHandlers[t.resource](i):console.warn("No simulator handler found for",t.resource)}),t()}),this.httpServer.on("request",function(t,i){"POST"===t.method&&(e.httpHandlers[t.url]?e.httpHandlers[t.url](t,i):(i.writeHead(200,{"Content-Type":"text/plain"}),i.end()))}),this.httpServer.listen(this.port)}},onPhoto:{value:function(t,e){e.writeHead(404,{"Content-Type":"text/plain"}),e.end()}},onBarcode:{value:function(t,e){e.writeHead(200,{"Content-Type":"text/plain"}),e.end()}},onVisualAwareness:{value:function(t){this.visualSocket=t}},onAudibleAwareness:{value:function(t){this.audibleSocket=t}},updateTrackingState:{value:function(t){this.visualState=t}},getAudioEntityFromId:{value:function(t){var e=void 0;return this.audioEntities.forEach(function(i){i.id==t&&(e=i)}),e}},getVisualEntityFromId:{value:function(t){var e=void 0;return this.entities.forEach(function(i){i.id==t&&(e=i)}),e}},onAudio:{value:function(t){var e=this.getVisualEntityFromId(t),i=this.getAudioEntityFromId(t);if(i||(i=new u,i.updateId(t),i.updateConfidence(100),i.updatePosition(0,0,0),this.audioEntities.push(i)),e){var n=e.parts[0].value.rays[0].dir;i.updatePosition(n)}this.audioState.entities=this.audioEntities,this.update()}},setTargetId:{value:function(t,e){this.entities.forEach(function(i){i.id===t&&(i.id=e)})}},getEntities:{value:function(){return this.entities}},updateTarget:{value:function(t){var e=this.getVisualEntityFromId(t.id);e||(e=new a(t.id),this.entities.push(e)),e.updatePosition(t),this.update(),this.emit("update",t)}},addEntity:{value:function(){}},update:{value:function(){this.visualSocket&&this.visualSocket.connected&&this.visualSocket.send(JSON.stringify(this.visualState)),this.audibleSocket&&this.audibleSocket.connected&&this.audibleSocket.send(JSON.stringify(this.audioState))}}}),c}(c);module.exports=new d;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/motor-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/motor-service.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=function(){function t(t,e){for(var i in e){var n=e[i];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(t,e)}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n=t(require("http")),o=require("animation-utilities"),r=o.Clock,s=o.TrajectoryControllerSim,a=o.PosVelControllerSim,c=require("websocket").server,l=t(require("lodash")),u={ts:[0,0],pos:0,inc_pos:0,vel:0,cur:0,pwm:0,status:1,vel_limit:10,acc_limit:10,cur_limit:10,mode:4,ref:0,ticks:0},d={ts:[0,0],pelvis:Object.assign({},u),torso:Object.assign({},u),neck:Object.assign({},u)},m=l.cloneDeep(d),v=[0,0,0],f=performance.now(),h=function(){function t(e,n,o){i(this,t),this.initialPosition=e,this.velocity=n,(null===o||void 0===o)&&(o=r.currentTime()),this.initialTime=o}return e(t,{getPosition:{value:function(t){(null===t||void 0===t)&&(t=r.currentTime());var e=t.subtract(this.initialTime);return this.initialPosition+this.velocity*e}},getVelocity:{value:function(){return this.velocity}}}),t}(),p={pelvis:new h(0,0),torso:new h(0,0),neck:new h(0,0)},S=function(){function t(){i(this,t),this.port=12475,this.stateSocketList=[],this.commandSocketList=[],this.ledSocketList=[];var e=this,o=this.onAxisCommand.bind(this),r=this.onLEDCommand.bind(this),s=n.createServer(function(t,e){e.writeHead(404),e.end()});s.listen(this.port,function(){}),this.server=new c({httpServer:s,autoAcceptConnections:!1}),this.server.on("request",function(t){var i=t.accept(null,t.origin);"/axis_state"===t.resource?(e.stateSocketList.push(i),e.sendState(),i.on("close",function(){e.stateSocketList.indexOf(i)>-1&&e.stateSocketList.splice(e.stateSocketList.indexOf(i),1)})):"/axis_command"===t.resource?(e.commandSocketList.push(i),i.on("message",o),i.on("close",function(){e.commandSocketList.indexOf(i)>-1&&e.commandSocketList.splice(e.commandSocketList.indexOf(i),1),e.reset()})):"/led_command"===t.resource&&(e.ledSocketList.push(i),i.on("message",r),i.on("close",function(){e.ledSocketList.indexOf(i)>-1&&e.ledSocketList.splice(e.ledSocketList.indexOf(i),1)}))})}return e(t,{init:{value:function(t){t()}},sendState:{value:function(){if(this.stateSocketList.length>0){var t=r.currentTime()._timestamp;m.neck.ts=t,m.torso.ts=t,m.pelvis.ts=t,m.ts=t;try{var e=!0,i=!1,n=void 0;try{for(var o,s=this.stateSocketList[Symbol.iterator]();!(e=(o=s.next()).done);e=!0){var a=o.value;a.connected&&a.send(JSON.stringify(m))}}catch(c){i=!0,n=c}finally{try{!e&&s["return"]&&s["return"]()}finally{if(i)throw n}}}catch(l){}}}},updateState:{value:function(){var t=r.currentTime(),e=performance.now()-f<500,i=!0,n=!1,o=void 0;try{for(var s,a=Object.keys(p)[Symbol.iterator]();!(i=(s=a.next()).done);i=!0){var c=s.value;e?m[c].vel=p[c].getVelocity(t):m[c].vel=0,m[c].pos=p[c].getPosition(t)}}catch(l){n=!0,o=l}finally{try{!i&&a["return"]&&a["return"]()}finally{if(n)throw o}}}},onAxisCommand:{value:function(t){f=performance.now(),t=JSON.parse(t.utf8Data);var e=r.currentTime(),i=!0,n=!1,o=void 0;try{for(var c,l=Object.keys(p)[Symbol.iterator]();!(i=(c=l.next()).done);i=!0){var u=c.value;4===t[u].mode?p[u]=new h(p[u].getPosition(e),t[u].value[0],e):5===t[u].mode?(p[u]=new s(p[u].getPosition(e),p[u].getVelocity(e),e),p[u].updateCommand(t[u].value[1],t[u].value[0],t[u].value[2],t[u].acc_limit,t[u].vel_limit,e)):7===t[u].mode?(p[u]=new a(p[u].getPosition(e),p[u].getVelocity(e),e),p[u].updateCommand(t[u].value[1],t[u].value[0],t[u].acc_limit,t[u].vel_limit,e)):p[u]=new h(p[u].getPosition(e),0,e)}}catch(d){n=!0,o=d}finally{try{!i&&l["return"]&&l["return"]()}finally{if(n)throw o}}this.updateState(),this.sendState()}},onLEDCommand:{value:function(t){t=JSON.parse(t.utf8Data),t.color&&Array.isArray(t.color)&&3===t.color.length&&(v=t.color)}},reset:{value:function(){m=l.cloneDeep(d),p={pelvis:new h(0,0),torso:new h(0,0),neck:new h(0,0)}}},render:{value:function(t){this.updateState(),t.display({topSection_r:m.neck.pos,middleSection_r:m.torso.pos,bottomSection_r:m.pelvis.pos,lightring_redChannelBn_r:v[0],lightring_greenChannelBn_r:v[1],lightring_blueChannelBn_r:v[2]})}}}),t}();module.exports=new S;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/nlu-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/nlu-service.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var r in t){var n=t[r];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=e(require("http")),s=void 0;try{s=require("jibo-parser")}catch(i){console.warn("Error importing jibo-parser. Simulator will not support robust parsing.")}var a=0,o=function(){function e(){r(this,e),this.port=11231,this.handles={}}return t(e,{init:{value:function(e){var t=this;this.server=n.createServer(),this.server.on("request",function(e,r){"/nlu_interface"===e.url&&"POST"===e.method&&(e.setEncoding("utf8"),e.on("data",function(e){var n=void 0;try{n=JSON.parse(e)}catch(s){return r.writeHead(200,{"Content-Type":"text/html"}),r.write(JSON.stringify({Status:"ERROR",Message:"Inavlid request. Request body is not valid JSON"})),void r.end()}"COMPILE"===n.REQ_TYPE?t.compile(n.REQ_CONTENT.RULE_STRING,r):"PARSE_FROM_URI"===n.REQ_TYPE?t.parseFromUri(n.REQ_CONTENT.URI,n.REQ_CONTENT.TXT_STRING,r):"PARSE_FROM_TEXT"===n.REQ_TYPE&&t.parseFromText(n.REQ_CONTENT.RULE_STRING,n.REQ_CONTENT.TXT_STRING,r)}))}),this.server.on("listening",function(){e()}),this.server.listen(this.port)}},parseFromUri:{value:function(e,t,r){var n={Status:"OK",URI:""},i=this.handles[e];if(i&&s){var a=s.build_sentence_parser(i),o=a.parse_sentence(t);n.Result=JSON.parse(o)}else n.Status="ERROR",n.Message="No handle named '"+e+"' exists";r.writeHead(200,{"Content-Type":"text/html"}),r.write(JSON.stringify(n)),r.end()}},parseFromText:{value:function(e,t,r){var n={Status:"OK"};try{var i=s.compile_fst_from_text(e,"handle:"+a++),o=s.build_sentence_parser(i),u=o.parse_sentence(t);n.Result=JSON.parse(u)}catch(l){n.Status="ERROR",n.Message=l.message}r.writeHead(200,{"Content-Type":"text/html"}),r.write(JSON.stringify(n)),r.end()}},compile:{value:function(e,t){var r={Status:"OK",URI:""};try{var n="handle:"+a++;this.handles[n]=s.compile_fst_from_text(e,n),r.URI=n}catch(i){r.Status="ERROR",r.Message=i.message}t.writeHead(200,{"Content-Type":"text/html"}),t.write(JSON.stringify(r)),t.end()}}}),e}();module.exports=new o;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/registry-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/registry-service.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},r=function(){function e(e,r){for(var t in r){var n=r[t];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,r)}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),t=function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")},n=e(require("http")),o=e(require("./lps-service")),i=e(require("./nlu-service")),s=e(require("./asr-service")),u=e(require("./tts-service")),a=e(require("./motor-service")),c=8181,p=[{name:"body",host:"127.0.0.1",port:a.port},{name:"lps",host:"127.0.0.1",port:o.port},{name:"nlu",host:"127.0.0.1",port:i.port},{name:"asr",host:"127.0.0.1",port:s.port},{name:"tts",host:"127.0.0.1",port:u.port}],f=function(){function e(){t(this,e)}return r(e,{init:{value:function(e){this.server=n.createServer(),this.server.on("request",function(e,r){"GET"===e.method&&(r.writeHead(200,{"Content-Type":"text/plain"}),r.end(JSON.stringify(p),"utf8"))}),this.server.on("listening",function(){e()}),this.server.listen(c)}}}),e}();module.exports=new f;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/service-initializer.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/service-initializer.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var i=function(i){return i&&i.__esModule?i["default"]:i},e=i(require("./lps-service")),r=i(require("./nlu-service")),n=i(require("./asr-service")),t=i(require("./tts-service")),u=i(require("./motor-service")),c=i(require("./registry-service")),s=i(require("async"));module.exports=function(i){s.parallel([function(i){e.init(i)},function(i){r.init(i)},function(i){n.init(i)},function(i){t.init(i)},function(i){u.init(i)},function(i){c.init(i)}],function(){i()})};
|
||||
1
node_modules/jibo-tools/lib/simulator/services/tts-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/tts-service.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,t,n){var s={token:e,timestamp:t,status:n,moreinfo:[]};return s}function t(e){var t=.2,s=[{name:"/pau/",start:0,end:t}];return e.split(" ").forEach(function(e){e=e.trim(),n(e[e.length-1])&&(e=e.substr(0,e.length-1)),s.push({name:e,start:t,end:t+.3}),t+=.3}),s.push({name:"/pau/",start:t,end:t+.2}),s}function n(e){return"."===e||","===e||"?"===e||"!"===e||";"===e||":"===e}var s=function(e){return e&&e.__esModule?e["default"]:e},r=function(){function e(e,t){for(var n in t){var s=t[n];s.configurable=!0,s.value&&(s.writable=!0)}Object.defineProperties(e,t)}return function(t,n,s){return n&&e(t.prototype,n),s&&e(t,s),t}}(),o=function f(e,t,n){var s=Object.getOwnPropertyDescriptor(e,t);if(void 0===s){var r=Object.getPrototypeOf(e);return null===r?void 0:f(r,t,n)}if("value"in s&&s.writable)return s.value;var o=s.get;if(void 0!==o)return o.call(n)},i=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},u=s(require("http")),c=require("events").EventEmitter,p=require("websocket").server,l=function(n){function s(){a(this,s),o(Object.getPrototypeOf(s.prototype),"constructor",this).call(this),this.port=11275,this.messages=[],this.connectionHandlers={"/tts_token_times":this.onTokenTimes.bind(this),"/tts_speak":this.onSpeak.bind(this),"/tts_stop":this.onStop.bind(this)}}return i(s,n),r(s,{init:{value:function(e){var t=this;this.httpServer=u.createServer(),this.httpServer.on("request",function(e,n){"POST"===e.method&&(e.setEncoding("utf8"),e.on("data",function(s){var r=void 0;try{for(r=JSON.parse(s),t.messages.push({url:e.url,data:r,response:n});t.messages.length;){var o=t.messages.shift();t.connectionHandlers[o.url](o.data,o.response)}}catch(i){return console.error(i),t.messages.push({url:e.url,data:"ERROR Invalid request. Request body is not valid JSON",response:n}),n.writeHead(200,{"Content-Type":"text/html"}),n.write(JSON.stringify({Status:"ERROR",Message:"Inavlid request. Request body is not valid JSON"})),t.socket&&t.socket.send(JSON.stringify({status:"error",message:"ERROR Invalid request. Request body is not valid JSON"})),void n.end()}t.socket&&t.processMessages()}))}),this.httpServer.on("listening",function(){t.wsServer=new p({httpServer:t.httpServer,autoAcceptconnections:!1}),t.wsServer.on("request",function(e){var n=e.accept(null,e.orgin);"/tts_tokens"===e.resource?(t.tokenSocket=n,t.processMessages()):"/tts_phones"===e.resource&&(t.phoneSocket=n,t.processMessages())})}),e(),this.httpServer.listen(this.port)}},processMessages:{value:function(){for(;this.messages.length;){var e=this.messages.shift();this.connectionHandlers[e.url](e.data,e.response)}}},onSpeak:{value:function(n,s){var r=this;s.writeHead(204,{"Content-Type":"text/html"}),s.write(JSON.stringify({Status:"OK",Message:"Speaking TTS"})),s.end();var o=t(n.prompt);setTimeout(function(){r.emit("speech",n.prompt),r.tokenSocket.send(JSON.stringify(e("",0,"STOP")))},1e3*o[o.length-1].end)}},onTokenTimes:{value:function(e,n){var s={tokentimes:{tokens:t(e.prompt)}};n.writeHead(200,{"Content-Type":"text/html"}),n.write(JSON.stringify(s)),n.end()}},onStop:{value:function(e,t){t.writeHead(200,{"Content-Type":"text/html"}),t.write(JSON.stringify({Status:"OK",Message:"Stopping TTS"})),t.end(),this.emit("stop")}}}),s}(c);module.exports=new l;
|
||||
1
node_modules/jibo-tools/lib/simulator/settings.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/settings.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=t(require("path")),i=t(require("fs")),s=t(require("lodash")),n=t(require("app")),o=t(require("ipc")),r=e.join(n.getDataPath(),"simulator-settings.json"),u={contentWidth:1280,contentHeight:720,windowX:50,windowY:50,fullscreen:!1,zoomFactorIndex:4,zoomFactor:1,viewMode:"2d",devToolsWindowX:0,devToolsWindowY:0,devToolsContentWidth:1200,devToolsContentHeight:800,isSimulatorDevToolsOpened:!1,isDevToolsOpened:!1},a={init:function(){var t=this;try{this._settings=JSON.parse(i.readFileSync(r,"utf8")),this._settings=s.extend({},u,this._settings)}catch(e){this._settings=u}this.simulatorReady=!1,o.on("get-simulator-settings",function(e){e.returnValue=JSON.stringify(t._settings),t.simulatorReady=!0;var i=require("./windowing");t.update({zoomFactor:i.getZoom()})})},setWindow:function(t){this.mainWindow=t},update:function(t){this._settings=s.extend({},this._settings,t),i.writeFileSync(r,JSON.stringify(this._settings,null," "),"utf8"),this.simulatorReady===!0&&this.mainWindow.webContents.send("simulator-settings-changed",JSON.stringify(this._settings))},get:function(t){return this._settings[t]},all:function(){return this._settings}};module.exports=a;
|
||||
1
node_modules/jibo-tools/lib/simulator/simulator/dimensions.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/simulator/dimensions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";module.exports={SCREEN_WIDTH:1280,SCREEN_HEIGHT:720,SCREEN_EPSILON:2,CHAT_WIDTH:400};
|
||||
1
node_modules/jibo-tools/lib/simulator/simulator/face-on-body.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/simulator/face-on-body.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/jibo-tools/lib/simulator/simulator/main.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/simulator/main.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,t){var i=new u(e,t.scene._camera,new l.Vector3(.2,0,.2),null,new l.Vector3(0,0,1));return i.setMouseFilters(function(e){return e.altKey&&!e.metaKey&&!e.ctrlKey},function(e){return e.shiftKey},function(e){return!e.shiftKey}),i.installRendererIntoScene(t.scene),i.addPositionChangedCallback(function(e){e.id="testId",o.updateTarget(e)}),o.updateTarget({id:"testId",x:.2,y:0,z:.2}),!0}var t=function(e){return e&&e.__esModule?e["default"]:e},i=t(require("react")),n=t(require("../services/service-initializer")),r=t(require("../services/asr-service")),o=t(require("../services/lps-service")),s=t(require("../views/chat-view")),a=t(require("../views/lps-view")),d=t(require("../react-components/tab-bar")),c=require("animation-utilities"),l=c.THREE,u=c.MouseTargetPositioner;require("../elements/custom-elements");var h=t(require("ipc")),v=t(require("./face-on-body")),m=t(require("../services/motor-service")),f=c.JiboConfig,p=c.RobotInfo,g=t(require("./dimensions")),w=t(require("async")),y="true"===h.sendSync("is-remote-mode");y&&(g.CHAT_WIDTH=0);var b=i.createClass({displayName:"View",getInitialState:function(){return{currentView:"chat"}},render:function(){var e=this,t=[{label:"Chat",callback:function(){e.setState({currentView:"chat"})}},{label:"LPS",callback:function(){e.setState({currentView:"lps"})}}],n="chat"==this.state.currentView;if(y)return i.createElement("div",null);var r=void 0,c=void 0,l=void 0,u=o.getEntities();return r=i.createElement(d,{tabs:t}),c=i.createElement(s,{ref:"chat",onWords:this.onWords,isSelected:n}),l=i.createElement(a,{ref:"lps",isSelected:!n,setTargetId:o.setTargetId.bind(o),targets:u,onAddTarget:this.addMouseTargetPositioner,updateTargets:this.forceUpdate.bind(this)}),i.createElement("atom-workspace",{id:"chat",style:{width:g.CHAT_WIDTH,height:"100%"}},r,c,l)},componentDidMount:function(){var e=this;o.on("update",function(){e.forceUpdate()});var t=this.props.robotInfo,i=void 0,n=function(e,t){i.isDevToolsOpened()&&t.isDevToolsOpened===!1?i.closeDevTools():i.isDevToolsOpened()||t.isDevToolsOpened!==!0||i.openDevTools()},r=document.getElementById("face"),s=document.getElementById("visualizer");this.visualizerContainer=s,v.init(t,r,s,n,function(t,n,o){e.robotRenderer=n;var s=h.sendSync("get-skill-path");r.innerHTML='<div id="loader"></div><webview id="webview" nodeintegration autosize="on" width="1280" height="720" minwidth="10" maxwidth="20000" minheight="10" maxheight="20000" src="'+s+'" style="border: none; display:block; width:1280px; height:720px"></webview>',i=document.getElementById("webview");var a=document.getElementById("loader");a.style.visibility="visible",h.on("reload-skill",function(){a.style.visibility="visible",i.reloadIgnoringCache()}),i.addEventListener("dom-ready",function(){!i.isDevToolsOpened()&&o.isDevToolsOpened&&i.openDevTools(),i.insertCSS("html{min-width: 1280px; min-height: 720px;} body{min-width: 1280px; min-height: 720px; margin: 0px; overflow: hidden;}"),a.style.visibility="hidden",i.style.width="1281px",setTimeout(function(){i.style.width="1280px"},1e3)});var d=function(){m.render(n),requestAnimationFrame(d)};requestAnimationFrame(d)})},onWords:function(e){r.onWordsReceived(e)},addMouseTargetPositioner:function(){this.hasMouseTargetPositioner||(this.hasMouseTargetPositioner=e(this.visualizerContainer,this.robotRenderer))}});w.series([function(e){y?(h.send("registry-init","http://127.0.0.1:8181"),e()):n(function(){h.send("registry-init","http://127.0.0.1:8181"),e()})},function(e){var t=new f;p.createInfo(t,function(t){i.render(i.createElement(b,{robotInfo:t,asrService:r}),document.getElementById("chat")),e()})}],function(e){e&&console.error("Simulator: "+e)});
|
||||
1
node_modules/jibo-tools/lib/simulator/timer.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/timer.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(){function t(t,n){for(var e in n){var r=n[e];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(t,n)}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}(),n=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},e=function(){function e(){var t=this;n(this,e),this.interval=33,this.updaters=[],setInterval(function(){t.updaters.forEach(function(t){t.update()})},this.interval)}return t(e,{add:{value:function(t){this.updaters.push(t)}},remove:{value:function(t){var n=this.updaters.indexOf(t);n>=0&&this.updaters.splice(n,1)}}}),e}();module.exports=new e;
|
||||
1
node_modules/jibo-tools/lib/simulator/views/asr-view.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/asr-view.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react"));module.exports=t.createClass({displayName:"asr-view",getInitialState:function(){return{text:"",speaker:""}},onTextChange:function(e){var t=e.target.value;t=t.trim().replace(/[\|&;\$%@"#<>\(\)\+,?.]/g,"").toLowerCase(),this.setState({text:this.value}),13===e.nativeEvent.keyCode?(this.setState({text:""}),this.props.onWords({words:t,"final":!0,speaker:this.state.speaker}),this.props.messageHandler({words:t,speaker:this.state.speaker})):32===e.nativeEvent.keyCode&&this.props.onWords({words:t,incremental:!0,speaker:this.state.speaker})},onSpeakerChange:function(e){var t=e.target.value;this.setState({speaker:t})},render:function(){return t.createElement("div",{className:"asr-input"},t.createElement("div",{className:"speaker-box"},"Who is speaking?",t.createElement("input",{type:"text",className:"speaker-input",value:this.state.speaker,onChange:this.onSpeakerChange})),t.createElement("input",{type:"text",className:"text-input",placeholder:"Speak to jibo here...",style:{height:30,borderColor:"gray",borderWidth:1,width:"100%"},value:this.state.text,onKeyPress:this.onTextChange}))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/chat-message.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/chat-message.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react"));module.exports=t.createClass({displayName:"chat-message",getInitialState:function(){return{}},render:function(){var e={},a="#2E6575";"jibo"!==this.props.message.author?e={"text-align":"right"}:(e={"text-align":"left"},a="#1EB2E2");var r={"border-radius":"5px",margin:"1%",backgroundColor:a,clear:"both",width:"100%"},s=this.props.message.author?this.props.message.author:"[anybody]";return t.createElement("div",{style:e},t.createElement("div",{style:r},t.createElement("div",{className:"speaker",style:{fontWeight:"bold",padding:"3px"}},s),t.createElement("div",{className:"content",style:{padding:"3px"}},this.props.message.content)))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/chat-view.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/chat-view.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},s=e(require("react")),t=e(require("../services/tts-service")),r=e(require("./messages-list")),a=e(require("./asr-view"));module.exports=s.createClass({displayName:"chat-view",getInitialState:function(){return{isSelected:!1}},componentDidMount:function(){var e=this;this.chatProxy=this.props.chatProxy,t.on("speech",function(s){e.messageHandler({words:s,speaker:"jibo"})}),window.addEventListener("resize",function(){e.forceUpdate()})},messageHandler:function(e){this.addMessage({content:e.words,author:e.speaker}),this.props.onWords(e)},addMessage:function(e){e&&(e.date=new Date,this.refs.messagesList.addMessage(e))},render:function(){var e={};return this.props.isSelected?e.display="":e.display="none",s.createElement("div",{className:"chat-box",ref:"root",style:e},s.createElement("div",{className:"chat-content-wrapper",style:{height:window.innerHeight-132}},s.createElement(r,{ref:"messagesList",height:window.innerHeight})),s.createElement(a,{ref:"AsrView",messageHandler:this.messageHandler,onWords:this.props.onWords}))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/lps-view-orig.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/lps-view-orig.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var n in t){var o=t[n];o.configurable=!0,o.value&&(o.writable=!0)}Object.defineProperties(e,t)}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=e(require("react")),i=require("animation-utilities"),r=i.visualize,s=i.THREE,a=i.MouseCoordinateWrangler,c=e(require("../timer")),h=e(require("../services/lps-service")),l=-.18,u=1,d={},p=function(){function e(t){n(this,e),this.id=u++,d[this.id]=this;var o=new s.SphereGeometry(.1,32,32),i=new s.MeshLambertMaterial({color:12303291});this.sphere=new s.Mesh(o,i),this.sphere.name=this.id,t.add(this.sphere)}return t(e,{setPosition:{value:function(e){this.position=e.clone(),this.sphere.position.x=e.x,this.sphere.position.y=e.y,this.sphere.position.z=e.z}},getData:{value:function(){return{identity:[{id:this.id,confidence:1,classification:"person"}],body:{position:{x:this.position.x,y:this.position.y,z:this.position.z}}}}},remove:{value:function(){delete d[this.id],this.sphere.parent.remove(this.sphere)}}}),e}();module.exports=o.createClass({displayName:"lps-view-orig",getInitialState:function(){return{}},render:function(){var e={border:"1px solid grey",width:550,height:550,margin:"auto"};return o.createElement("div",null,o.createElement("div",{className:"panel-heading",style:{height:40}},o.createElement("h2",{style:{margin:"auto",textAlign:"center"}},"LPS View")),o.createElement("div",{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onDoubleClick:this.onDoubleClick,style:e,ref:"content"}))},getIntersectedPerson:function(e){var t=o.findDOMNode(this.refs.content),n=e.nativeEvent,i=this.renderer.scene.getScene(),r=this.renderer.scene.getCamera(),c=a.getLocalCoordinatesNDCCentered(n,t),h=new s.Raycaster;h.setFromCamera(c,r);for(var l=h.intersectObject(i,!0),u=0;u<l.length;u++){var p=d[l[u].object.name];if(p)return p}},getIntersectionAtHeight:function(e,t,n){var i=o.findDOMNode(this.refs.content),r=new s.Vector3;r.set(e/i.clientWidth*2-1,2*-(t/i.clientHeight)+1,.5);var a=this.renderer.scene.getCamera();r.unproject(a);var c=r.sub(a.position).normalize(),h=-a.position.z/c.z;return h+=n,a.position.clone().add(c.multiplyScalar(h))},onDoubleClick:function(e){console.log("DOUBLE CLICK");var t=this.getIntersectedPerson(e);if(t)t.remove();else{e=e.nativeEvent;var n=this.getIntersectionAtHeight(e.offsetX,e.offsetY,l),o=new p(this.renderer.scene.getScene());o.setPosition(n)}},onMouseUp:function(){if(this.person){this.person=void 0;var e=o.findDOMNode(this.refs.content);e.removeEventListener("mousemove",this.onMouseMoveBind)}},onMouseMove:function(e){var t=this.getIntersectionAtHeight(e.offsetX,e.offsetY,l);this.person.setPosition(t)},onMouseDown:function(e){if(this.person=this.getIntersectedPerson(e),this.person){this.onMouseMoveBind=this.onMouseMove.bind(this);var t=o.findDOMNode(this.refs.content);t.addEventListener("mousemove",this.onMouseMoveBind)}},componentDidMount:function(){var e=this,t=o.findDOMNode(this.refs.content);r.createRobotRenderer(this.props.robotInfo,t,r.DisplayType.BODY,function(t){t.setBackgroundColor(.7,.7,.7,0),e.renderer=t;var n=t.scene.getCamera();n.up=new s.Vector3(-1,0,0),t.setCamera(new s.Vector3(0,0,4),new s.Vector3(0,0,0)),t.scene.removeTrackballControls();var o=t.scene.getScene().getObjectByName("headMesh"),i=new s.MeshLambertMaterial({color:16711680,opacity:.1,transparent:!0}),r=2,a=100*Math.PI/180;e.cone={length:r,fov:a};var h=2*r*Math.cos(.5*a),l=new s.Mesh(new s.CylinderGeometry(0,h,r,50,50,!1),i);l.overdraw=.5,l.rotation.x=.5*Math.PI,l.position.z-=.5*r,l.position.y+=.15,e.cylinder=l,o.add(l),c.add(e)})},createSphere:function(e){var t=void 0===arguments[1]?16711680:arguments[1],n=new s.Mesh(new s.SphereGeometry(.05,32,32),new s.MeshLambertMaterial({color:t}));return n.position.x=e.x,n.position.y=e.y,n.position.z=e.z,this.renderer.scene.getScene().add(n),n},componentWillUnmount:function(){c.remove(this),clearInterval(this.interval)},update:function(){var e=this,t=new s.Vector3(0,.5*this.cone.length,0),n=new s.Vector3(0,-.5*this.cone.length,0);this.cylinder.localToWorld(t),this.cylinder.localToWorld(n);var o=(new Date).getTime(),i=[];Object.keys(d).forEach(function(r){var s=d[r],a=s.sphere.position.clone(),c=n.clone().sub(t).length(),h=-t.clone().sub(a).dot(n.clone().sub(t))/c,l=n.clone().sub(t).cross(t.clone().sub(a)).length()/c,u=h>.1&&l/h<1/Math.cos(.5*e.cone.fov);u?s.sphere.material.color.setHex(47872):s.sphere.material.color.setHex(12303291),r=parseInt(r),i.push({timestamp:o,id:r,classification:"person",data:s.getData(),visible:u})}),h.updateTrackingState({tracks:i})}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/lps-view.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/lps-view.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),r=e(require("./target-view")),a=e(require("../services/lps-service")),n=e(require("marked"));module.exports=t.createClass({displayName:"lps-view",getInitialState:function(){return{isSelected:!1}},onClick:function(){a.addEntity()},render:function(){var e=this,a={};this.props.isSelected?a.display="":a.display="none",a.color="white";var i=[],s=0;this.props.targets.forEach(function(a){i.push(t.createElement(r,{setTargetId:e.props.setTargetId,target:a})),i.push(t.createElement("hr",{key:s++}))});var l="Click the `Add Target` button to add a single target to Jibo's Local Perceptual Space.\n\n* `shift+scroll` to zoom in and out.\n\n* `shift+drag` to move camera.\n\n* `shift+alt+drag` to move the LPS target on the ground.\n\n* `alt+drag` to move the height of the target.";return t.createElement("div",{className:"right-pane",ref:"rightPane",style:a},t.createElement("div",{className:"panel-heading",style:{padding:"0px"}},t.createElement("h2",{style:{textAlign:"center",marginTop:"6px",marginBottom:"6px"}},"Targets")),t.createElement("button",{className:"btn",style:{margin:"10px"},onClick:this.props.onAddTarget},"Add a target"),t.createElement("br",null),t.createElement("div",{style:{padding:20},dangerouslySetInnerHTML:{__html:n(l,{sanitize:!0})}}),t.createElement("hr",{key:s++}),t.createElement("div",{className:"arguments-scroll-container"},i))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/messages-list.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/messages-list.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},s=e(require("react")),t=e(require("./chat-message"));module.exports=s.createClass({displayName:"messages-list",getInitialState:function(){return{messages:[]}},addMessage:function(e){var s=this.state.messages,t=this.refs.messageContainer.getDOMNode();s.push(e),this.setState({messages:s}),t.scrollHeight-(t.scrollTop+t.offsetHeight)>=50?this.scrolled=!0:this.scrolled=!1},componentDidUpdate:function(){if(!this.scrolled){var e=this.refs.messageContainer.getDOMNode();e.scrollTop=e.scrollHeight}},render:function(){var e,a={width:"100%",paddingLeft:"3%",paddingRight:"3%",paddingTop:"2%",paddingBottom:"2%"};return e=this.state.messages.map(function(e){return s.createElement(t,{message:e})}),e.length||(e=s.createElement("div",{className:"chat-no-messages"},"No messages")),s.createElement("div",{ref:"messageContainer",className:"chat-messages col-xs-9",style:a},e)}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/target-view.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/target-view.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react"));module.exports=t.createClass({displayName:"target-view",getInitialState:function(){return{id:this.props.target.id}},onIdChange:function(e){var t=e.target.value;this.props.setTargetId(this.state.id,t),this.setState({id:t})},render:function(){var e={};e.color="white",e.margin="10px",e.textAlign="left";var r=this.props.target.parts[0].value.rays[0].dir,a=void 0;for(a in r)r[a]=Number(r[a]).toFixed(5);return t.createElement("div",{style:e},t.createElement("div",{className:"target-id"},t.createElement("p",null,t.createElement("div",null,"ID"),t.createElement("input",{type:"text",className:"target-id",value:this.state.id,onChange:this.onIdChange,style:{color:"black"}})),t.createElement("p",null,"Current Location: ",t.createElement("br",null),"x: ",r.x,t.createElement("br",null),"y: ",r.y,t.createElement("br",null),"z: ",r.z,t.createElement("br",null))))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/tts-view.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/tts-view.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),r=e(require("../services/tts-service"));module.exports=t.createClass({displayName:"tts-view",getInitialState:function(){return{text:""}},componentWillMount:function(){var e=this;r.on("speech",function(t){e.setState({text:t})})},render:function(){return t.createElement("div",null,t.createElement("input",{type:"text",style:{height:30,borderColor:"gray",borderWidth:1,width:"100%"},value:this.state.text}))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/windowing.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/windowing.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e){var t=require("screen"),r=void 0;if(!(0>e&&e!==o||e>=i.length)){if(c=e,e===o){r=t.getDisplayMatching(l.getBounds());var u=require("lifesized"),d=u.ppi(r),s=294;a=d/s*r.scaleFactor}else a=i[c];r=t.getDisplayMatching(l.getBounds()),n.update({zoomFactor:a/r.scaleFactor,zoomFactorIndex:c})}}var t=function(e){return e&&e.__esModule?e["default"]:e},n=t(require("./settings")),i=[.5,.67,.75,.9,1,1.1,1.25,1.5,1.75,2,2.5,3,4,5],r=4,o=-2,c=n.get("zoomFactorIndex"),a=c===o?1:i[c],l=null,u={setWindow:function(e){var t=this;l=e;var i=require("global-shortcut");i.register("CmdOrCtrl+0",function(){u.reset()}),this.dimensionChangeInterval=setInterval(function(){var e=l.getContentSize(),i=t.getScaleFactor();(n.get("windowX")!==l.getBounds().x||n.get("windowY")!==l.getBounds().y||n.get("contentWidth")!==e[0]*i||n.get("contentHeight")!==e[1]*i||n.get("devicePixelRatio")!==i)&&n.update({windowX:l.getBounds().x,windowY:l.getBounds().y,contentWidth:e[0]*i,contentHeight:e[1]*i,devicePixelRatio:i})},200)},shutdown:function(){this.dimensionChangeInterval&&clearInterval(this.dimensionChangeInterval)},getZoom:function(){return a},getInitialZoomFactor:function(){return this.getZoom()},getDisplay:function(){var e=require("screen");return l?e.getDisplayMatching(l.getBounds()):e.getDisplayMatching({x:n.get("windowX"),y:n.get("windowY"),width:n.get("contentWidth"),height:n.get("contentHeight")})},getScaleFactor:function(){var e=this.getDisplay();return e.scaleFactor},getMenuItems:function(){return[{label:"Toggle Full Screen",accelerator:"Ctrl+Command+F",click:function(){l&&(l.setFullScreen(!l.isFullScreen()),n.update({fullscreen:l.isFullScreen()}))}},{label:"Actual Sized (100%)",accelerator:"CmdOrCtrl+0",click:function(){e(r)}},{label:"Zoom In",accelerator:"CmdOrCtrl+=",click:function(){e(c===o?r:c+1)}},{label:"Zoom Out",accelerator:"CmdOrCtrl+-",click:function(){e(c===o?r:c-1)}},{label:"Physical Sized",accelerator:"CmdOrCtrl+4",click:function(){e(o)}},{type:"separator"},{label:"2D View",accelerator:"CmdOrCtrl+2",click:function(){n.update({viewMode:"2d"})}},{label:"3D View",accelerator:"CmdOrCtrl+3",click:function(){n.update({viewMode:"3d"})}},{type:"separator"}]},reset:function(){e(r,!0)}};module.exports=u;
|
||||
Reference in New Issue
Block a user