-
Notifications
You must be signed in to change notification settings - Fork 385
/
roslib.min.js
1 lines (1 loc) · 19.4 KB
/
roslib.min.js
1
var ROSLIB=ROSLIB||{REVISION:"0.10.0-SNAPSHOT"};ROSLIB.URDF_SPHERE=0,ROSLIB.URDF_BOX=1,ROSLIB.URDF_CYLINDER=2,ROSLIB.URDF_MESH=3,ROSLIB.ActionClient=function(a){var b=this;a=a||{},this.ros=a.ros,this.serverName=a.serverName,this.actionName=a.actionName,this.timeout=a.timeout,this.goals={};var c=!1,d=new ROSLIB.Topic({ros:this.ros,name:this.serverName+"/feedback",messageType:this.actionName+"Feedback"}),e=new ROSLIB.Topic({ros:this.ros,name:this.serverName+"/status",messageType:"actionlib_msgs/GoalStatusArray"}),f=new ROSLIB.Topic({ros:this.ros,name:this.serverName+"/result",messageType:this.actionName+"Result"});this.goalTopic=new ROSLIB.Topic({ros:this.ros,name:this.serverName+"/goal",messageType:this.actionName+"Goal"}),this.cancelTopic=new ROSLIB.Topic({ros:this.ros,name:this.serverName+"/cancel",messageType:"actionlib_msgs/GoalID"}),this.goalTopic.advertise(),this.cancelTopic.advertise(),e.subscribe(function(a){c=!0,a.status_list.forEach(function(a){var c=b.goals[a.goal_id.id];c&&c.emit("status",a)})}),d.subscribe(function(a){var c=b.goals[a.status.goal_id.id];c&&(c.emit("status",a.status),c.emit("feedback",a.feedback))}),f.subscribe(function(a){var c=b.goals[a.status.goal_id.id];c&&(c.emit("status",a.status),c.emit("result",a.result))}),this.timeout&&setTimeout(function(){c||b.emit("timeout")},this.timeout)},ROSLIB.ActionClient.prototype.__proto__=EventEmitter2.prototype,ROSLIB.ActionClient.prototype.cancel=function(){var a=new ROSLIB.Message;this.cancelTopic.publish(a)},ROSLIB.Goal=function(a){var b=this;this.actionClient=a.actionClient,this.goalMessage=a.goalMessage,this.isFinished=!1;var c=new Date;this.goalID="goal_"+Math.random()+"_"+c.getTime(),this.goalMessage=new ROSLIB.Message({goal_id:{stamp:{secs:0,nsecs:0},id:this.goalID},goal:this.goalMessage}),this.on("status",function(a){b.status=a}),this.on("result",function(a){b.isFinished=!0,b.result=a}),this.on("feedback",function(a){b.feedback=a}),this.actionClient.goals[this.goalID]=this},ROSLIB.Goal.prototype.__proto__=EventEmitter2.prototype,ROSLIB.Goal.prototype.send=function(a){var b=this;b.actionClient.goalTopic.publish(b.goalMessage),a&&setTimeout(function(){b.isFinished||b.emit("timeout")},a)},ROSLIB.Goal.prototype.cancel=function(){var a=new ROSLIB.Message({id:this.goalID});this.actionClient.cancelTopic.publish(a)},ROSLIB.SimpleActionServer=function(a){var b=this;a=a||{},this.ros=a.ros,this.serverName=a.serverName,this.actionName=a.actionName,this.feedbackPublisher=new ROSLIB.Topic({ros:this.ros,name:this.serverName+"/feedback",messageType:this.actionName+"Feedback"}),this.feedbackPublisher.advertise();var c=new ROSLIB.Topic({ros:this.ros,name:this.serverName+"/status",messageType:"actionlib_msgs/GoalStatusArray"});c.advertise(),this.resultPublisher=new ROSLIB.Topic({ros:this.ros,name:this.serverName+"/result",messageType:this.actionName+"Result"}),this.resultPublisher.advertise();var d=new ROSLIB.Topic({ros:this.ros,name:this.serverName+"/goal",messageType:this.actionName+"Goal"}),e=new ROSLIB.Topic({ros:this.ros,name:this.serverName+"/cancel",messageType:"actionlib_msgs/GoalID"});this.statusMessage=new ROSLIB.Message({header:{stamp:{secs:0,nsecs:100},frame_id:""},status_list:[]}),this.currentGoal=null,this.nextGoal=null,d.subscribe(function(a){b.currentGoal?(b.nextGoal=a,b.emit("cancel")):(b.statusMessage.status_list=[{goal_id:a.goal_id,status:1}],b.currentGoal=a,b.emit("goal",a.goal))});var f=function(a,b){return a.secs>b.secs?!1:a.secs<b.secs?!0:a.nsecs<b.nsecs?!0:!1};e.subscribe(function(a){0===a.stamp.secs&&0===a.stamp.secs&&""===a.id?(b.nextGoal=null,b.currentGoal&&b.emit("cancel")):(b.currentGoal&&a.id===b.currentGoal.goal_id.id?b.emit("cancel"):b.nextGoal&&a.id===b.nextGoal.goal_id.id&&(b.nextGoal=null),b.nextGoal&&f(b.nextGoal.goal_id.stamp,a.stamp)&&(b.nextGoal=null),b.currentGoal&&f(b.currentGoal.goal_id.stamp,a.stamp)&&b.emit("cancel"))});setInterval(function(){var a=new Date,d=Math.floor(a.getTime()/1e3),e=Math.round(1e9*(a.getTime()/1e3-d));b.statusMessage.header.stamp.secs=d,b.statusMessage.header.stamp.nsecs=e,c.publish(b.statusMessage)},500)},ROSLIB.SimpleActionServer.prototype.__proto__=EventEmitter2.prototype,ROSLIB.SimpleActionServer.prototype.setSucceeded=function(a){var b=new ROSLIB.Message({status:{goal_id:this.currentGoal.goal_id,status:3},result:a});this.resultPublisher.publish(b),this.statusMessage.status_list=[],this.nextGoal?(this.currentGoal=this.nextGoal,this.nextGoal=null,this.emit("goal",this.currentGoal.goal)):this.currentGoal=null},ROSLIB.SimpleActionServer.prototype.sendFeedback=function(a){var b=new ROSLIB.Message({status:{goal_id:this.currentGoal.goal_id,status:1},feedback:a});this.feedbackPublisher.publish(b)},ROSLIB.SimpleActionServer.prototype.setPreempted=function(){this.statusMessage.status_list=[];var a=new ROSLIB.Message({status:{goal_id:this.currentGoal.goal_id,status:2}});this.resultPublisher.publish(a),this.nextGoal?(this.currentGoal=this.nextGoal,this.nextGoal=null,this.emit("goal",this.currentGoal.goal)):this.currentGoal=null},ROSLIB.Message=function(a){var b=this;a=a||{},Object.keys(a).forEach(function(c){b[c]=a[c]})},ROSLIB.Param=function(a){a=a||{},this.ros=a.ros,this.name=a.name},ROSLIB.Param.prototype.get=function(a){var b=new ROSLIB.Service({ros:this.ros,name:"/rosapi/get_param",serviceType:"rosapi/GetParam"}),c=new ROSLIB.ServiceRequest({name:this.name});b.callService(c,function(b){var c=JSON.parse(b.value);a(c)})},ROSLIB.Param.prototype.set=function(a){var b=new ROSLIB.Service({ros:this.ros,name:"/rosapi/set_param",serviceType:"rosapi/SetParam"}),c=new ROSLIB.ServiceRequest({name:this.name,value:JSON.stringify(a)});b.callService(c,function(){})},ROSLIB.Param.prototype.delete=function(){var a=new ROSLIB.Service({ros:this.ros,name:"/rosapi/delete_param",serviceType:"rosapi/DeleteParam"}),b=new ROSLIB.ServiceRequest({name:this.name});a.callService(b,function(){})},ROSLIB.Ros=function(a){a=a||{};var b=a.url;this.socket=null,this.idCounter=0,this.setMaxListeners(0),b&&this.connect(b)},ROSLIB.Ros.prototype.__proto__=EventEmitter2.prototype,ROSLIB.Ros.prototype.connect=function(a){function b(a){g.emit("connection",a)}function c(a){g.emit("close",a)}function d(a){g.emit("error",a)}function e(a,b){var c=new Image;c.onload=function(){var a=document.createElement("canvas"),d=a.getContext("2d");a.width=c.width,a.height=c.height,d.drawImage(c,0,0);for(var e=d.getImageData(0,0,c.width,c.height).data,f="",g=0;g<e.length;g+=4)f+=String.fromCharCode(e[g],e[g+1],e[g+2]);var h=JSON.parse(f);b(h)},c.src="data:image/png;base64,"+a.data}function f(a){function b(a){"publish"===a.op?g.emit(a.topic,a.msg):"service_response"===a.op&&g.emit(a.id,a)}var c=JSON.parse(a.data);"png"===c.op?e(c,function(a){b(a)}):b(c)}var g=this;this.socket=new WebSocket(a),this.socket.onopen=b,this.socket.onclose=c,this.socket.onerror=d,this.socket.onmessage=f},ROSLIB.Ros.prototype.close=function(){this.socket&&this.socket.close()},ROSLIB.Ros.prototype.authenticate=function(a,b,c,d,e,f,g){var h={op:"auth",mac:a,client:b,dest:c,rand:d,t:e,level:f,end:g};this.callOnConnection(h)},ROSLIB.Ros.prototype.callOnConnection=function(a){var b=this,c=JSON.stringify(a);this.socket&&this.socket.readyState===WebSocket.OPEN?b.socket.send(c):b.once("connection",function(){b.socket.send(c)})},ROSLIB.Ros.prototype.getTopics=function(a){var b=new ROSLIB.Service({ros:this,name:"/rosapi/topics",serviceType:"rosapi/Topics"}),c=new ROSLIB.ServiceRequest;b.callService(c,function(b){a(b.topics)})},ROSLIB.Ros.prototype.getServices=function(a){var b=new ROSLIB.Service({ros:this,name:"/rosapi/services",serviceType:"rosapi/Services"}),c=new ROSLIB.ServiceRequest;b.callService(c,function(b){a(b.services)})},ROSLIB.Ros.prototype.getNodes=function(a){var b=new ROSLIB.Service({ros:this,name:"/rosapi/nodes",serviceType:"rosapi/Nodes"}),c=new ROSLIB.ServiceRequest;b.callService(c,function(b){a(b.nodes)})},ROSLIB.Ros.prototype.getParams=function(a){var b=new ROSLIB.Service({ros:this,name:"/rosapi/get_param_names",serviceType:"rosapi/GetParamNames"}),c=new ROSLIB.ServiceRequest;b.callService(c,function(b){a(b.names)})},ROSLIB.Ros.prototype.getTopicType=function(a,b){var c=new ROSLIB.Service({ros:this,name:"/rosapi/topic_type",serviceType:"rosapi/TopicType"}),d=new ROSLIB.ServiceRequest({topic:a});c.callService(d,function(a){b(a.type)})},ROSLIB.Ros.prototype.getMessageDetails=function(a,b){var c=new ROSLIB.Service({ros:this,name:"/rosapi/message_details",serviceType:"rosapi/MessageDetails"}),d=new ROSLIB.ServiceRequest({type:a});c.callService(d,function(a){b(a.typedefs)})},ROSLIB.Ros.prototype.decodeTypeDefs=function(a){var b=this,c=function(a,d){for(var e={},f=0;f<a.fieldnames.length;f++){var g=a.fieldarraylen[f],h=a.fieldnames[f],i=a.fieldtypes[f];if(-1===i.indexOf("/"))e[h]=-1===g?i:[i];else{for(var j=!1,k=0;k<d.length;k++)if(d[k].type.toString()===i.toString()){j=d[k];break}if(j){var l=c(j,d);e[h]=-1===g?l:[l]}else b.emit("error","Cannot find "+i+" in decodeTypeDefs")}}return e};return c(a[0],a)},ROSLIB.Service=function(a){a=a||{},this.ros=a.ros,this.name=a.name,this.serviceType=a.serviceType},ROSLIB.Service.prototype.callService=function(a,b,c){this.ros.idCounter++;var d="call_service:"+this.name+":"+this.ros.idCounter;this.ros.once(d,function(a){if(void 0!==a.result&&a.result===!1)"function"==typeof c&&c(a.values);else{var d=new ROSLIB.ServiceResponse(a.values);b(d)}});var e={op:"call_service",id:d,service:this.name,args:a};this.ros.callOnConnection(e)},ROSLIB.ServiceRequest=function(a){var b=this;a=a||{},Object.keys(a).forEach(function(c){b[c]=a[c]})},ROSLIB.ServiceResponse=function(a){var b=this;a=a||{},Object.keys(a).forEach(function(c){b[c]=a[c]})},ROSLIB.Topic=function(a){a=a||{},this.ros=a.ros,this.name=a.name,this.messageType=a.messageType,this.isAdvertised=!1,this.compression=a.compression||"none",this.throttle_rate=a.throttle_rate||0,this.latch=a.latch||!1,this.queue_size=a.queue_size||100,this.compression&&"png"!==this.compression&&"none"!==this.compression&&this.emit("warning",this.compression+" compression is not supported. No compression will be used."),this.throttle_rate<0&&(this.emit("warning",this.throttle_rate+" is not allowed. Set to 0"),this.throttle_rate=0)},ROSLIB.Topic.prototype.__proto__=EventEmitter2.prototype,ROSLIB.Topic.prototype.subscribe=function(a){var b=this;this.on("message",function(b){a(b)}),this.ros.on(this.name,function(a){var c=new ROSLIB.Message(a);b.emit("message",c)}),this.ros.idCounter++;var c="subscribe:"+this.name+":"+this.ros.idCounter,d={op:"subscribe",id:c,type:this.messageType,topic:this.name,compression:this.compression,throttle_rate:this.throttle_rate};this.ros.callOnConnection(d)},ROSLIB.Topic.prototype.unsubscribe=function(){this.ros.removeAllListeners([this.name]),this.ros.idCounter++;var a="unsubscribe:"+this.name+":"+this.ros.idCounter,b={op:"unsubscribe",id:a,topic:this.name};this.ros.callOnConnection(b)},ROSLIB.Topic.prototype.advertise=function(){if(!this.isAdvertised){this.ros.idCounter++,this.advertiseId="advertise:"+this.name+":"+this.ros.idCounter;var a={op:"advertise",id:this.advertiseId,type:this.messageType,topic:this.name,latch:this.latch,queue_size:this.queue_size};this.ros.callOnConnection(a),this.isAdvertised=!0}},ROSLIB.Topic.prototype.unadvertise=function(){if(this.isAdvertised){var a=this.advertiseId,b={op:"unadvertise",id:a,topic:this.name};this.ros.callOnConnection(b),this.isAdvertised=!1}},ROSLIB.Topic.prototype.publish=function(a){this.isAdvertised||this.advertise(),this.ros.idCounter++;var b="publish:"+this.name+":"+this.ros.idCounter,c={op:"publish",id:b,topic:this.name,msg:a,latch:this.latch};this.ros.callOnConnection(c)},ROSLIB.Pose=function(a){a=a||{},this.position=new ROSLIB.Vector3(a.position),this.orientation=new ROSLIB.Quaternion(a.orientation)},ROSLIB.Pose.prototype.applyTransform=function(a){this.position.multiplyQuaternion(a.rotation),this.position.add(a.translation);var b=a.rotation.clone();b.multiply(this.orientation),this.orientation=b},ROSLIB.Pose.prototype.clone=function(){return new ROSLIB.Pose(this)},ROSLIB.Quaternion=function(a){a=a||{},this.x=a.x||0,this.y=a.y||0,this.z=a.z||0,this.w=a.w||1},ROSLIB.Quaternion.prototype.conjugate=function(){this.x*=-1,this.y*=-1,this.z*=-1},ROSLIB.Quaternion.prototype.normalize=function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?(this.x=0,this.y=0,this.z=0,this.w=1):(a=1/a,this.x=this.x*a,this.y=this.y*a,this.z=this.z*a,this.w=this.w*a)},ROSLIB.Quaternion.prototype.invert=function(){this.conjugate(),this.normalize()},ROSLIB.Quaternion.prototype.multiply=function(a){var b=this.x*a.w+this.y*a.z-this.z*a.y+this.w*a.x,c=-this.x*a.z+this.y*a.w+this.z*a.x+this.w*a.y,d=this.x*a.y-this.y*a.x+this.z*a.w+this.w*a.z,e=-this.x*a.x-this.y*a.y-this.z*a.z+this.w*a.w;this.x=b,this.y=c,this.z=d,this.w=e},ROSLIB.Quaternion.prototype.clone=function(){return new ROSLIB.Quaternion(this)},ROSLIB.Transform=function(a){a=a||{},this.translation=new ROSLIB.Vector3(a.translation),this.rotation=new ROSLIB.Quaternion(a.rotation)},ROSLIB.Transform.prototype.clone=function(){return new ROSLIB.Transform(this)},ROSLIB.Vector3=function(a){a=a||{},this.x=a.x||0,this.y=a.y||0,this.z=a.z||0},ROSLIB.Vector3.prototype.add=function(a){this.x+=a.x,this.y+=a.y,this.z+=a.z},ROSLIB.Vector3.prototype.subtract=function(a){this.x-=a.x,this.y-=a.y,this.z-=a.z},ROSLIB.Vector3.prototype.multiplyQuaternion=function(a){var b=a.w*this.x+a.y*this.z-a.z*this.y,c=a.w*this.y+a.z*this.x-a.x*this.z,d=a.w*this.z+a.x*this.y-a.y*this.x,e=-a.x*this.x-a.y*this.y-a.z*this.z;this.x=b*a.w+e*-a.x+c*-a.z-d*-a.y,this.y=c*a.w+e*-a.y+d*-a.x-b*-a.z,this.z=d*a.w+e*-a.z+b*-a.y-c*-a.x},ROSLIB.Vector3.prototype.clone=function(){return new ROSLIB.Vector3(this)},ROSLIB.TFClient=function(a){a=a||{},this.ros=a.ros,this.fixedFrame=a.fixedFrame||"/base_link",this.angularThres=a.angularThres||2,this.transThres=a.transThres||.01,this.rate=a.rate||10,this.goalUpdateDelay=a.goalUpdateDelay||50,this.currentGoal=!1,this.frameInfos={},this.goalUpdateRequested=!1,this.actionClient=new ROSLIB.ActionClient({ros:this.ros,serverName:"/tf2_web_republisher",actionName:"tf2_web_republisher/TFSubscriptionAction"})},ROSLIB.TFClient.prototype.processFeedback=function(a){var b=this;a.transforms.forEach(function(a){var c=a.child_frame_id;"/"===c[0]&&(c=c.substring(1));var d=b.frameInfos[c];void 0!==d&&(d.transform=new ROSLIB.Transform({translation:a.transform.translation,rotation:a.transform.rotation}),d.cbs.forEach(function(a){a(d.transform)}))})},ROSLIB.TFClient.prototype.updateGoal=function(){this.currentGoal&&this.currentGoal.cancel();var a={source_frames:[],target_frame:this.fixedFrame,angular_thres:this.angularThres,trans_thres:this.transThres,rate:this.rate};for(var b in this.frameInfos)a.source_frames.push(b);this.currentGoal=new ROSLIB.Goal({actionClient:this.actionClient,goalMessage:a}),this.currentGoal.on("feedback",this.processFeedback.bind(this)),this.currentGoal.send(),this.goalUpdateRequested=!1},ROSLIB.TFClient.prototype.subscribe=function(a,b){"/"===a[0]&&(a=a.substring(1)),void 0===this.frameInfos[a]?(this.frameInfos[a]={cbs:[]},this.goalUpdateRequested||(setTimeout(this.updateGoal.bind(this),this.goalUpdateDelay),this.goalUpdateRequested=!0)):void 0!==this.frameInfos[a].transform&&b(this.frameInfos[a].transform),this.frameInfos[a].cbs.push(b)},ROSLIB.TFClient.prototype.unsubscribe=function(a,b){"/"===a[0]&&(a=a.substring(1));var c=this.frameInfos[a];if(void 0!==c){var d=c.cbs.indexOf(b);d>=0&&(c.cbs.splice(d,1),0===c.cbs.length&&delete this.frameInfos[a],this.needUpdate=!0)}},ROSLIB.UrdfBox=function(a){a=a||{};var b=this,c=a.xml;this.dimension=null,this.type=null;var d=function(a){b.type=ROSLIB.URDF_BOX;var c=a.getAttribute("size").split(" ");b.dimension=new ROSLIB.Vector3({x:parseFloat(c[0]),y:parseFloat(c[1]),z:parseFloat(c[2])})};d(c)},ROSLIB.UrdfColor=function(a){a=a||{};var b=this,c=a.xml;this.r=null,this.g=null,this.b=null,this.a=null;var d=function(a){var c=a.getAttribute("rgba").split(" ");return b.r=parseFloat(c[0]),b.g=parseFloat(c[1]),b.b=parseFloat(c[2]),b.a=parseFloat(c[3]),!0};d(c)},ROSLIB.UrdfCylinder=function(a){a=a||{};var b=this,c=a.xml;this.type=null,this.length=null,this.radius=null;var d=function(a){b.type=ROSLIB.URDF_CYLINDER,b.length=parseFloat(a.getAttribute("length")),b.radius=parseFloat(a.getAttribute("radius"))};d(c)},ROSLIB.UrdfLink=function(a){a=a||{};var b=this,c=a.xml;this.name=null,this.visual=null;var d=function(a){b.name=a.getAttribute("name");var c=a.getElementsByTagName("visual");c.length>0&&(b.visual=new ROSLIB.UrdfVisual({xml:c[0]}))};d(c)},ROSLIB.UrdfMaterial=function(a){a=a||{};var b=this,c=a.xml;this.name=null,this.textureFilename=null,this.color=null;var d=function(a){b.name=a.getAttribute("name");var c=a.getElementsByTagName("texture");c.length>0&&(b.textureFilename=c[0].getAttribute("filename"));var d=a.getElementsByTagName("color");d.length>0&&(b.color=new ROSLIB.UrdfColor({xml:d[0]}))};d(c)},ROSLIB.UrdfMesh=function(a){a=a||{};var b=this,c=a.xml;this.filename=null,this.scale=null,this.type=null;var d=function(a){b.type=ROSLIB.URDF_MESH,b.filename=a.getAttribute("filename");var c=a.getAttribute("scale");if(c){var d=c.split(" ");b.scale=new ROSLIB.Vector3({x:parseFloat(d[0]),y:parseFloat(d[1]),z:parseFloat(d[2])})}};d(c)},ROSLIB.UrdfModel=function(a){a=a||{};var b=this,c=a.xml,d=a.string;this.materials=[],this.links=[];var e=function(a){var c=a.evaluate("//robot",a,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;b.name=c.getAttribute("name");for(var d in c.childNodes){var e=c.childNodes[d];if("material"===e.tagName){var f=new ROSLIB.UrdfMaterial({xml:e});b.materials[f.name]?console.warn("Material "+f.name+"is not unique."):b.materials[f.name]=f}else if("link"===e.tagName){var g=new ROSLIB.UrdfLink({xml:e});b.links[g.name]?console.warn("Link "+g.name+" is not unique."):(g.visual&&g.visual.material&&(b.materials[g.visual.material.name]?g.visual.material=b.materials[g.visual.material.name]:g.visual.material&&(b.materials[g.visual.material.name]=g.visual.material)),b.links[g.name]=g)}}};if(d){var f=new DOMParser;c=f.parseFromString(d,"text/xml")}e(c)},ROSLIB.UrdfSphere=function(a){a=a||{};var b=this,c=a.xml;this.radius=null,this.type=null;var d=function(a){b.type=ROSLIB.URDF_SPHERE,b.radius=parseFloat(a.getAttribute("radius"))};d(c)},ROSLIB.UrdfVisual=function(a){a=a||{};var b=this,c=a.xml;this.origin=null,this.geometry=null,this.material=null;var d=function(a){var c=a.getElementsByTagName("origin");if(0===c.length)b.origin=new ROSLIB.Pose;else{var d=c[0].getAttribute("xyz"),e=new ROSLIB.Vector3;d&&(d=d.split(" "),e=new ROSLIB.Vector3({x:parseFloat(d[0]),y:parseFloat(d[1]),z:parseFloat(d[2])}));var f=c[0].getAttribute("rpy"),g=new ROSLIB.Quaternion;if(f){f=f.split(" ");var h=parseFloat(f[0]),i=parseFloat(f[1]),j=parseFloat(f[2]),k=h/2,l=i/2,m=j/2,n=Math.sin(k)*Math.cos(l)*Math.cos(m)-Math.cos(k)*Math.sin(l)*Math.sin(m),o=Math.cos(k)*Math.sin(l)*Math.cos(m)+Math.sin(k)*Math.cos(l)*Math.sin(m),p=Math.cos(k)*Math.cos(l)*Math.sin(m)-Math.sin(k)*Math.sin(l)*Math.cos(m),q=Math.cos(k)*Math.cos(l)*Math.cos(m)+Math.sin(k)*Math.sin(l)*Math.sin(m);g=new ROSLIB.Quaternion({x:n,y:o,z:p,w:q}),g.normalize()}b.origin=new ROSLIB.Pose({position:e,orientation:g})}var r=a.getElementsByTagName("geometry");if(r.length>0){var s=null;for(var t in r[0].childNodes){var u=r[0].childNodes[t];if(1===u.nodeType){s=u;break}}var v=s.nodeName;"sphere"===v?b.geometry=new ROSLIB.UrdfSphere({xml:s}):"box"===v?b.geometry=new ROSLIB.UrdfBox({xml:s}):"cylinder"===v?b.geometry=new ROSLIB.UrdfCylinder({xml:s}):"mesh"===v?b.geometry=new ROSLIB.UrdfMesh({xml:s}):console.warn("Unknown geometry type "+v)}var w=a.getElementsByTagName("material");w.length>0&&(b.material=new ROSLIB.UrdfMaterial({xml:w[0]}))};d(c)};