diff --git a/build/roslib.js b/build/roslib.js index f4a273600..4ad6aea54 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -1623,6 +1623,22 @@ Ros.prototype.callOnConnection = function(message) { } }; +/** + * Sends a set_level request to the server + * + * @param level - Status level (none, error, warning, info) + * @param id - Optional: Operation ID to change status level on + */ +Ros.prototype.setStatusLevel = function(level, id){ + var levelMsg = { + op: 'set_level', + level: level, + id: id + }; + + this.callOnConnection(levelMsg); +}; + /** * Retrieves Action Servers in ROS as an array of string * @@ -1875,7 +1891,7 @@ Ros.prototype.getNodes = function(callback, failedCallback) { }; /** - * Retrieves list subscribed topics, publishing topics and services of a specific node + * Retrieves list subscribed topics, publishing topics and services of a specific node * * @param node name of the node: * @param callback - function with params: @@ -2269,7 +2285,7 @@ if(typeof bson !== 'undefined'){ * Events listeners for a WebSocket or TCP socket to a JavaScript * ROS Client. Sets up Messages for a given topic to trigger an * event on the ROS client. - * + * * @namespace SocketAdapter * @private */ @@ -2281,6 +2297,12 @@ function SocketAdapter(client) { client.emit(message.id, message); } else if (message.op === 'call_service') { client.emit(message.service, message); + } else if(message.op === 'status'){ + if(message.id){ + client.emit('status:'+message.id, message); + } else { + client.emit('status', message); + } } } diff --git a/build/roslib.min.js b/build/roslib.min.js index 396a0ea5d..0d0baca1a 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1,2 +1,2 @@ -!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0&&g._listeners.length>this._events.maxListeners&&(g._listeners.warned=!0,f.call(this,g._listeners.length,h))):g._listeners=c,!0;h=b.shift()}return!0}var j=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},k=10;g.EventEmitter2=g,g.prototype.delimiter=".",g.prototype.setMaxListeners=function(b){b!==a&&(this._events||d.call(this),this._events.maxListeners=b,this._conf||(this._conf={}),this._conf.maxListeners=b)},g.prototype.event="",g.prototype.once=function(a,b){return this.many(a,1,b),this},g.prototype.many=function(a,b,c){function d(){0===--b&&e.off(a,d),c.apply(this,arguments)}var e=this;if("function"!=typeof c)throw new Error("many only accepts instances of Function");return d._origin=c,this.on(a,d),e},g.prototype.emit=function(){this._events||d.call(this);var a=arguments[0];if("newListener"===a&&!this.newListener&&!this._events.newListener)return!1;var b,c,e,f,g,i=arguments.length;if(this._all&&this._all.length){if(g=this._all.slice(),i>3)for(b=new Array(i),f=0;f3)for(b=new Array(i-1),f=1;f3)for(b=new Array(j),f=1;f3)for(b=new Array(j-1),f=1;f0&&this._events[a].length>this._events.maxListeners&&(this._events[a].warned=!0,f.call(this,this._events[a].length,a))):this._events[a]=b,this)},g.prototype.onAny=function(a){if("function"!=typeof a)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),this._all.push(a),this},g.prototype.addListener=g.prototype.on,g.prototype.off=function(b,c){function d(b){if(b!==a){var c=Object.keys(b);for(var e in c){var f=c[e],g=b[f];g instanceof Function||"object"!=typeof g||null===g||(Object.keys(g).length>0&&d(b[f]),0===Object.keys(g).length&&delete b[f])}}}if("function"!=typeof c)throw new Error("removeListener only takes instances of Function");var e,f=[];if(this.wildcard){var g="string"==typeof b?b.split(this.delimiter):b.slice();f=h.call(this,null,g,this.listenerTree,0)}else{if(!this._events[b])return this;e=this._events[b],f.push({_listeners:e})}for(var i=0;i0){for(b=this._all,c=0,d=b.length;cb.secs)&&(a.secs0&&(this.minval=parseFloat(b[0].getAttribute("lower")),this.maxval=parseFloat(b[0].getAttribute("upper")))}b.exports=d},{}],31:[function(a,b,c){function d(a){this.name=a.xml.getAttribute("name"),this.visuals=[];for(var b=a.xml.getElementsByTagName("visual"),c=0;c0&&(this.textureFilename=b[0].getAttribute("filename"));var c=a.xml.getElementsByTagName("color");c.length>0&&(this.color=new e({xml:c[0]}))}var e=a("./UrdfColor");d.prototype.isLink=function(){return null===this.color&&null===this.textureFilename};var f=a("object-assign");d.prototype.assign=function(a){return f(this,a)},b.exports=d},{"./UrdfColor":28,"object-assign":2}],33:[function(a,b,c){function d(a){this.scale=null,this.type=f.URDF_MESH,this.filename=a.xml.getAttribute("filename");var b=a.xml.getAttribute("scale");if(b){var c=b.split(" ");this.scale=new e({x:parseFloat(c[0]),y:parseFloat(c[1]),z:parseFloat(c[2])})}}var e=a("../math/Vector3"),f=a("./UrdfTypes");b.exports=d},{"../math/Vector3":22,"./UrdfTypes":36}],34:[function(a,b,c){function d(a){a=a||{};var b=a.xml,c=a.string;if(this.materials={},this.links={},this.joints={},c){var d=new h;b=d.parseFromString(c,"text/xml")}var i=b.documentElement;this.name=i.getAttribute("name");for(var j=i.childNodes,k=0;k0){for(var A=z[0],B=null,C=0;C0&&(this.material=new j({xml:F[0]}))}var e=a("../math/Pose"),f=a("../math/Vector3"),g=a("../math/Quaternion"),h=a("./UrdfCylinder"),i=a("./UrdfBox"),j=a("./UrdfMaterial"),k=a("./UrdfMesh"),l=a("./UrdfSphere");b.exports=d},{"../math/Pose":19,"../math/Quaternion":20,"../math/Vector3":22,"./UrdfBox":27,"./UrdfCylinder":29,"./UrdfMaterial":32,"./UrdfMesh":33,"./UrdfSphere":35}],38:[function(a,b,c){b.exports=a("object-assign")({UrdfBox:a("./UrdfBox"),UrdfColor:a("./UrdfColor"),UrdfCylinder:a("./UrdfCylinder"),UrdfLink:a("./UrdfLink"),UrdfMaterial:a("./UrdfMaterial"),UrdfMesh:a("./UrdfMesh"),UrdfModel:a("./UrdfModel"),UrdfSphere:a("./UrdfSphere"),UrdfVisual:a("./UrdfVisual")},a("./UrdfTypes"))},{"./UrdfBox":27,"./UrdfColor":28,"./UrdfCylinder":29,"./UrdfLink":31,"./UrdfMaterial":32,"./UrdfMesh":33,"./UrdfModel":34,"./UrdfSphere":35,"./UrdfTypes":36,"./UrdfVisual":37,"object-assign":2}],39:[function(a,b,c){(function(a){b.exports=a.WebSocket}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],40:[function(a,b,c){b.exports=function(){return document.createElement("canvas")}},{}],41:[function(a,b,c){(function(c){"use strict";function d(a,b){var c=new f;c.onload=function(){var a=new e,d=a.getContext("2d");a.width=c.width,a.height=c.height,d.imageSmoothingEnabled=!1,d.webkitImageSmoothingEnabled=!1,d.mozImageSmoothingEnabled=!1,d.drawImage(c,0,0);for(var f=d.getImageData(0,0,c.width,c.height).data,g="",h=0;h0&&g._listeners.length>this._events.maxListeners&&(g._listeners.warned=!0,f.call(this,g._listeners.length,h))):g._listeners=c,!0;h=b.shift()}return!0}var j=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},k=10;g.EventEmitter2=g,g.prototype.delimiter=".",g.prototype.setMaxListeners=function(b){b!==a&&(this._events||d.call(this),this._events.maxListeners=b,this._conf||(this._conf={}),this._conf.maxListeners=b)},g.prototype.event="",g.prototype.once=function(a,b){return this.many(a,1,b),this},g.prototype.many=function(a,b,c){function d(){0===--b&&e.off(a,d),c.apply(this,arguments)}var e=this;if("function"!=typeof c)throw new Error("many only accepts instances of Function");return d._origin=c,this.on(a,d),e},g.prototype.emit=function(){this._events||d.call(this);var a=arguments[0];if("newListener"===a&&!this.newListener&&!this._events.newListener)return!1;var b,c,e,f,g,i=arguments.length;if(this._all&&this._all.length){if(g=this._all.slice(),i>3)for(b=new Array(i),f=0;f3)for(b=new Array(i-1),f=1;f3)for(b=new Array(j),f=1;f3)for(b=new Array(j-1),f=1;f0&&this._events[a].length>this._events.maxListeners&&(this._events[a].warned=!0,f.call(this,this._events[a].length,a))):this._events[a]=b,this)},g.prototype.onAny=function(a){if("function"!=typeof a)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),this._all.push(a),this},g.prototype.addListener=g.prototype.on,g.prototype.off=function(b,c){function d(b){if(b!==a){var c=Object.keys(b);for(var e in c){var f=c[e],g=b[f];g instanceof Function||"object"!=typeof g||null===g||(Object.keys(g).length>0&&d(b[f]),0===Object.keys(g).length&&delete b[f])}}}if("function"!=typeof c)throw new Error("removeListener only takes instances of Function");var e,f=[];if(this.wildcard){var g="string"==typeof b?b.split(this.delimiter):b.slice();f=h.call(this,null,g,this.listenerTree,0)}else{if(!this._events[b])return this;e=this._events[b],f.push({_listeners:e})}for(var i=0;i0){for(b=this._all,c=0,d=b.length;cb.secs)&&(a.secs0&&(this.minval=parseFloat(b[0].getAttribute("lower")),this.maxval=parseFloat(b[0].getAttribute("upper")))}b.exports=d},{}],31:[function(a,b,c){function d(a){this.name=a.xml.getAttribute("name"),this.visuals=[];for(var b=a.xml.getElementsByTagName("visual"),c=0;c0&&(this.textureFilename=b[0].getAttribute("filename"));var c=a.xml.getElementsByTagName("color");c.length>0&&(this.color=new e({xml:c[0]}))}var e=a("./UrdfColor");d.prototype.isLink=function(){return null===this.color&&null===this.textureFilename};var f=a("object-assign");d.prototype.assign=function(a){return f(this,a)},b.exports=d},{"./UrdfColor":28,"object-assign":2}],33:[function(a,b,c){function d(a){this.scale=null,this.type=f.URDF_MESH,this.filename=a.xml.getAttribute("filename");var b=a.xml.getAttribute("scale");if(b){var c=b.split(" ");this.scale=new e({x:parseFloat(c[0]),y:parseFloat(c[1]),z:parseFloat(c[2])})}}var e=a("../math/Vector3"),f=a("./UrdfTypes");b.exports=d},{"../math/Vector3":22,"./UrdfTypes":36}],34:[function(a,b,c){function d(a){a=a||{};var b=a.xml,c=a.string;if(this.materials={},this.links={},this.joints={},c){var d=new h;b=d.parseFromString(c,"text/xml")}var i=b.documentElement;this.name=i.getAttribute("name");for(var j=i.childNodes,k=0;k0){for(var A=z[0],B=null,C=0;C0&&(this.material=new j({xml:F[0]}))}var e=a("../math/Pose"),f=a("../math/Vector3"),g=a("../math/Quaternion"),h=a("./UrdfCylinder"),i=a("./UrdfBox"),j=a("./UrdfMaterial"),k=a("./UrdfMesh"),l=a("./UrdfSphere");b.exports=d},{"../math/Pose":19,"../math/Quaternion":20,"../math/Vector3":22,"./UrdfBox":27,"./UrdfCylinder":29,"./UrdfMaterial":32,"./UrdfMesh":33,"./UrdfSphere":35}],38:[function(a,b,c){b.exports=a("object-assign")({UrdfBox:a("./UrdfBox"),UrdfColor:a("./UrdfColor"),UrdfCylinder:a("./UrdfCylinder"),UrdfLink:a("./UrdfLink"),UrdfMaterial:a("./UrdfMaterial"),UrdfMesh:a("./UrdfMesh"),UrdfModel:a("./UrdfModel"),UrdfSphere:a("./UrdfSphere"),UrdfVisual:a("./UrdfVisual")},a("./UrdfTypes"))},{"./UrdfBox":27,"./UrdfColor":28,"./UrdfCylinder":29,"./UrdfLink":31,"./UrdfMaterial":32,"./UrdfMesh":33,"./UrdfModel":34,"./UrdfSphere":35,"./UrdfTypes":36,"./UrdfVisual":37,"object-assign":2}],39:[function(a,b,c){(function(a){b.exports=a.WebSocket}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],40:[function(a,b,c){b.exports=function(){return document.createElement("canvas")}},{}],41:[function(a,b,c){(function(c){"use strict";function d(a,b){var c=new f;c.onload=function(){var a=new e,d=a.getContext("2d");a.width=c.width,a.height=c.height,d.imageSmoothingEnabled=!1,d.webkitImageSmoothingEnabled=!1,d.mozImageSmoothingEnabled=!1,d.drawImage(c,0,0);for(var f=d.getImageData(0,0,c.width,c.height).data,g="",h=0;h