From 84d707d5398b7a80f55bd0df9c6d14d4cc7495b5 Mon Sep 17 00:00:00 2001 From: Matt Vollrath Date: Thu, 24 Jan 2019 17:58:11 -0800 Subject: [PATCH] Update builds for 1.0.0 (#316) --- build/roslib.js | 750 ++++++++++++++++++++++++++++++++++++++++---- build/roslib.min.js | 4 +- 2 files changed, 688 insertions(+), 66 deletions(-) diff --git a/build/roslib.js b/build/roslib.js index 2193da849..ba67ba393 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -1,4 +1,412 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +(function(global, undefined) { "use strict"; +var POW_2_24 = Math.pow(2, -24), + POW_2_32 = Math.pow(2, 32), + POW_2_53 = Math.pow(2, 53); + +function encode(value) { + var data = new ArrayBuffer(256); + var dataView = new DataView(data); + var lastLength; + var offset = 0; + + function ensureSpace(length) { + var newByteLength = data.byteLength; + var requiredLength = offset + length; + while (newByteLength < requiredLength) + newByteLength *= 2; + if (newByteLength !== data.byteLength) { + var oldDataView = dataView; + data = new ArrayBuffer(newByteLength); + dataView = new DataView(data); + var uint32count = (offset + 3) >> 2; + for (var i = 0; i < uint32count; ++i) + dataView.setUint32(i * 4, oldDataView.getUint32(i * 4)); + } + + lastLength = length; + return dataView; + } + function write() { + offset += lastLength; + } + function writeFloat64(value) { + write(ensureSpace(8).setFloat64(offset, value)); + } + function writeUint8(value) { + write(ensureSpace(1).setUint8(offset, value)); + } + function writeUint8Array(value) { + var dataView = ensureSpace(value.length); + for (var i = 0; i < value.length; ++i) + dataView.setUint8(offset + i, value[i]); + write(); + } + function writeUint16(value) { + write(ensureSpace(2).setUint16(offset, value)); + } + function writeUint32(value) { + write(ensureSpace(4).setUint32(offset, value)); + } + function writeUint64(value) { + var low = value % POW_2_32; + var high = (value - low) / POW_2_32; + var dataView = ensureSpace(8); + dataView.setUint32(offset, high); + dataView.setUint32(offset + 4, low); + write(); + } + function writeTypeAndLength(type, length) { + if (length < 24) { + writeUint8(type << 5 | length); + } else if (length < 0x100) { + writeUint8(type << 5 | 24); + writeUint8(length); + } else if (length < 0x10000) { + writeUint8(type << 5 | 25); + writeUint16(length); + } else if (length < 0x100000000) { + writeUint8(type << 5 | 26); + writeUint32(length); + } else { + writeUint8(type << 5 | 27); + writeUint64(length); + } + } + + function encodeItem(value) { + var i; + + if (value === false) + return writeUint8(0xf4); + if (value === true) + return writeUint8(0xf5); + if (value === null) + return writeUint8(0xf6); + if (value === undefined) + return writeUint8(0xf7); + + switch (typeof value) { + case "number": + if (Math.floor(value) === value) { + if (0 <= value && value <= POW_2_53) + return writeTypeAndLength(0, value); + if (-POW_2_53 <= value && value < 0) + return writeTypeAndLength(1, -(value + 1)); + } + writeUint8(0xfb); + return writeFloat64(value); + + case "string": + var utf8data = []; + for (i = 0; i < value.length; ++i) { + var charCode = value.charCodeAt(i); + if (charCode < 0x80) { + utf8data.push(charCode); + } else if (charCode < 0x800) { + utf8data.push(0xc0 | charCode >> 6); + utf8data.push(0x80 | charCode & 0x3f); + } else if (charCode < 0xd800) { + utf8data.push(0xe0 | charCode >> 12); + utf8data.push(0x80 | (charCode >> 6) & 0x3f); + utf8data.push(0x80 | charCode & 0x3f); + } else { + charCode = (charCode & 0x3ff) << 10; + charCode |= value.charCodeAt(++i) & 0x3ff; + charCode += 0x10000; + + utf8data.push(0xf0 | charCode >> 18); + utf8data.push(0x80 | (charCode >> 12) & 0x3f); + utf8data.push(0x80 | (charCode >> 6) & 0x3f); + utf8data.push(0x80 | charCode & 0x3f); + } + } + + writeTypeAndLength(3, utf8data.length); + return writeUint8Array(utf8data); + + default: + var length; + if (Array.isArray(value)) { + length = value.length; + writeTypeAndLength(4, length); + for (i = 0; i < length; ++i) + encodeItem(value[i]); + } else if (value instanceof Uint8Array) { + writeTypeAndLength(2, value.length); + writeUint8Array(value); + } else { + var keys = Object.keys(value); + length = keys.length; + writeTypeAndLength(5, length); + for (i = 0; i < length; ++i) { + var key = keys[i]; + encodeItem(key); + encodeItem(value[key]); + } + } + } + } + + encodeItem(value); + + if ("slice" in data) + return data.slice(0, offset); + + var ret = new ArrayBuffer(offset); + var retView = new DataView(ret); + for (var i = 0; i < offset; ++i) + retView.setUint8(i, dataView.getUint8(i)); + return ret; +} + +function decode(data, tagger, simpleValue) { + var dataView = new DataView(data); + var offset = 0; + + if (typeof tagger !== "function") + tagger = function(value) { return value; }; + if (typeof simpleValue !== "function") + simpleValue = function() { return undefined; }; + + function read(value, length) { + offset += length; + return value; + } + function readArrayBuffer(length) { + return read(new Uint8Array(data, offset, length), length); + } + function readFloat16() { + var tempArrayBuffer = new ArrayBuffer(4); + var tempDataView = new DataView(tempArrayBuffer); + var value = readUint16(); + + var sign = value & 0x8000; + var exponent = value & 0x7c00; + var fraction = value & 0x03ff; + + if (exponent === 0x7c00) + exponent = 0xff << 10; + else if (exponent !== 0) + exponent += (127 - 15) << 10; + else if (fraction !== 0) + return fraction * POW_2_24; + + tempDataView.setUint32(0, sign << 16 | exponent << 13 | fraction << 13); + return tempDataView.getFloat32(0); + } + function readFloat32() { + return read(dataView.getFloat32(offset), 4); + } + function readFloat64() { + return read(dataView.getFloat64(offset), 8); + } + function readUint8() { + return read(dataView.getUint8(offset), 1); + } + function readUint16() { + return read(dataView.getUint16(offset), 2); + } + function readUint32() { + return read(dataView.getUint32(offset), 4); + } + function readUint64() { + return readUint32() * POW_2_32 + readUint32(); + } + function readBreak() { + if (dataView.getUint8(offset) !== 0xff) + return false; + offset += 1; + return true; + } + function readLength(additionalInformation) { + if (additionalInformation < 24) + return additionalInformation; + if (additionalInformation === 24) + return readUint8(); + if (additionalInformation === 25) + return readUint16(); + if (additionalInformation === 26) + return readUint32(); + if (additionalInformation === 27) + return readUint64(); + if (additionalInformation === 31) + return -1; + throw "Invalid length encoding"; + } + function readIndefiniteStringLength(majorType) { + var initialByte = readUint8(); + if (initialByte === 0xff) + return -1; + var length = readLength(initialByte & 0x1f); + if (length < 0 || (initialByte >> 5) !== majorType) + throw "Invalid indefinite length element"; + return length; + } + + function appendUtf16data(utf16data, length) { + for (var i = 0; i < length; ++i) { + var value = readUint8(); + if (value & 0x80) { + if (value < 0xe0) { + value = (value & 0x1f) << 6 + | (readUint8() & 0x3f); + length -= 1; + } else if (value < 0xf0) { + value = (value & 0x0f) << 12 + | (readUint8() & 0x3f) << 6 + | (readUint8() & 0x3f); + length -= 2; + } else { + value = (value & 0x0f) << 18 + | (readUint8() & 0x3f) << 12 + | (readUint8() & 0x3f) << 6 + | (readUint8() & 0x3f); + length -= 3; + } + } + + if (value < 0x10000) { + utf16data.push(value); + } else { + value -= 0x10000; + utf16data.push(0xd800 | (value >> 10)); + utf16data.push(0xdc00 | (value & 0x3ff)); + } + } + } + + function decodeItem() { + var initialByte = readUint8(); + var majorType = initialByte >> 5; + var additionalInformation = initialByte & 0x1f; + var i; + var length; + + if (majorType === 7) { + switch (additionalInformation) { + case 25: + return readFloat16(); + case 26: + return readFloat32(); + case 27: + return readFloat64(); + } + } + + length = readLength(additionalInformation); + if (length < 0 && (majorType < 2 || 6 < majorType)) + throw "Invalid length"; + + switch (majorType) { + case 0: + return length; + case 1: + return -1 - length; + case 2: + if (length < 0) { + var elements = []; + var fullArrayLength = 0; + while ((length = readIndefiniteStringLength(majorType)) >= 0) { + fullArrayLength += length; + elements.push(readArrayBuffer(length)); + } + var fullArray = new Uint8Array(fullArrayLength); + var fullArrayOffset = 0; + for (i = 0; i < elements.length; ++i) { + fullArray.set(elements[i], fullArrayOffset); + fullArrayOffset += elements[i].length; + } + return fullArray; + } + return readArrayBuffer(length); + case 3: + var utf16data = []; + if (length < 0) { + while ((length = readIndefiniteStringLength(majorType)) >= 0) + appendUtf16data(utf16data, length); + } else + appendUtf16data(utf16data, length); + return String.fromCharCode.apply(null, utf16data); + case 4: + var retArray; + if (length < 0) { + retArray = []; + while (!readBreak()) + retArray.push(decodeItem()); + } else { + retArray = new Array(length); + for (i = 0; i < length; ++i) + retArray[i] = decodeItem(); + } + return retArray; + case 5: + var retObject = {}; + for (i = 0; i < length || length < 0 && !readBreak(); ++i) { + var key = decodeItem(); + retObject[key] = decodeItem(); + } + return retObject; + case 6: + return tagger(decodeItem(), length); + case 7: + switch (length) { + case 20: + return false; + case 21: + return true; + case 22: + return null; + case 23: + return undefined; + default: + return simpleValue(length); + } + } + } + + var ret = decodeItem(); + if (offset !== data.byteLength) + throw "Remaining bytes"; + return ret; +} + +var obj = { encode: encode, decode: decode }; + +if (typeof define === "function" && define.amd) + define("cbor/cbor", obj); +else if (typeof module !== 'undefined' && module.exports) + module.exports = obj; +else if (!global.CBOR) + global.CBOR = obj; + +})(this); + +},{}],2:[function(require,module,exports){ /*! * EventEmitter2 * https://github.com/hij1nx/EventEmitter2 @@ -722,7 +1130,7 @@ } }(); -},{}],2:[function(require,module,exports){ +},{}],3:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @@ -814,7 +1222,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],3:[function(require,module,exports){ +},{}],4:[function(require,module,exports){ /** * @fileOverview * @author Russell Toris - rctoris@wpi.edu @@ -826,7 +1234,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { * If you use nodejs, this is the variable you get when you require('roslib') */ var ROSLIB = this.ROSLIB || { - REVISION : '0.20.0' + REVISION : '1.0.0' }; var assign = require('object-assign'); @@ -844,11 +1252,11 @@ assign(ROSLIB, require('./urdf')); module.exports = ROSLIB; -},{"./actionlib":9,"./core":18,"./math":23,"./tf":26,"./urdf":38,"object-assign":2}],4:[function(require,module,exports){ +},{"./actionlib":10,"./core":19,"./math":24,"./tf":27,"./urdf":39,"object-assign":3}],5:[function(require,module,exports){ (function (global){ global.ROSLIB = require('./RosLib'); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./RosLib":3}],5:[function(require,module,exports){ +},{"./RosLib":4}],6:[function(require,module,exports){ /** * @fileOverview * @author Russell Toris - rctoris@wpi.edu @@ -993,7 +1401,7 @@ ActionClient.prototype.dispose = function() { module.exports = ActionClient; -},{"../core/Message":10,"../core/Topic":17,"eventemitter2":1}],6:[function(require,module,exports){ +},{"../core/Message":11,"../core/Topic":18,"eventemitter2":2}],7:[function(require,module,exports){ /** * @fileOverview * @author Justin Young - justin@oodar.com.au @@ -1082,7 +1490,7 @@ ActionListener.prototype.__proto__ = EventEmitter2.prototype; module.exports = ActionListener; -},{"../core/Message":10,"../core/Topic":17,"eventemitter2":1}],7:[function(require,module,exports){ +},{"../core/Message":11,"../core/Topic":18,"eventemitter2":2}],8:[function(require,module,exports){ /** * @fileOverview * @author Russell Toris - rctoris@wpi.edu @@ -1172,7 +1580,7 @@ Goal.prototype.cancel = function() { }; module.exports = Goal; -},{"../core/Message":10,"eventemitter2":1}],8:[function(require,module,exports){ +},{"../core/Message":11,"eventemitter2":2}],9:[function(require,module,exports){ /** * @fileOverview * @author Laura Lindzey - lindzey@gmail.com @@ -1381,7 +1789,7 @@ SimpleActionServer.prototype.setPreempted = function() { }; module.exports = SimpleActionServer; -},{"../core/Message":10,"../core/Topic":17,"eventemitter2":1}],9:[function(require,module,exports){ +},{"../core/Message":11,"../core/Topic":18,"eventemitter2":2}],10:[function(require,module,exports){ var Ros = require('../core/Ros'); var mixin = require('../mixin'); @@ -1394,7 +1802,7 @@ var action = module.exports = { mixin(Ros, ['ActionClient', 'SimpleActionServer'], action); -},{"../core/Ros":12,"../mixin":24,"./ActionClient":5,"./ActionListener":6,"./Goal":7,"./SimpleActionServer":8}],10:[function(require,module,exports){ +},{"../core/Ros":13,"../mixin":25,"./ActionClient":6,"./ActionListener":7,"./Goal":8,"./SimpleActionServer":9}],11:[function(require,module,exports){ /** * @fileoverview * @author Brandon Alexander - baalexander@gmail.com @@ -1413,7 +1821,7 @@ function Message(values) { } module.exports = Message; -},{"object-assign":2}],11:[function(require,module,exports){ +},{"object-assign":3}],12:[function(require,module,exports){ /** * @fileoverview * @author Brandon Alexander - baalexander@gmail.com @@ -1497,7 +1905,7 @@ Param.prototype.delete = function(callback) { }; module.exports = Param; -},{"./Service":13,"./ServiceRequest":14}],12:[function(require,module,exports){ +},{"./Service":14,"./ServiceRequest":15}],13:[function(require,module,exports){ /** * @fileoverview * @author Brandon Alexander - baalexander@gmail.com @@ -1569,8 +1977,12 @@ Ros.prototype.connect = function(url) { this.socket.on('error', this.socket.onerror); } else if (this.transportLibrary.constructor.name === 'RTCPeerConnection') { this.socket = assign(this.transportLibrary.createDataChannel(url, this.transportOptions), socketAdapter(this)); - }else { - this.socket = assign(new WebSocket(url), socketAdapter(this)); + } else { + if (!this.socket || this.socket.readyState === WebSocket.CLOSED) { + var sock = new WebSocket(url); + sock.binaryType = 'arraybuffer'; + this.socket = assign(sock, socketAdapter(this)); + } } }; @@ -2118,7 +2530,7 @@ Ros.prototype.decodeTypeDefs = function(defs) { module.exports = Ros; -},{"./Service":13,"./ServiceRequest":14,"./SocketAdapter.js":16,"eventemitter2":1,"object-assign":2,"ws":39}],13:[function(require,module,exports){ +},{"./Service":14,"./ServiceRequest":15,"./SocketAdapter.js":17,"eventemitter2":2,"object-assign":3,"ws":41}],14:[function(require,module,exports){ /** * @fileoverview * @author Brandon Alexander - baalexander@gmail.com @@ -2148,7 +2560,8 @@ function Service(options) { } Service.prototype.__proto__ = EventEmitter2.prototype; /** - * Calls the service. Returns the service response in the callback. + * Calls the service. Returns the service response in the + * callback. Does nothing if this service is currently advertised. * * @param request - the ROSLIB.ServiceRequest to send * @param callback - function with params: @@ -2179,17 +2592,22 @@ Service.prototype.callService = function(request, callback, failedCallback) { op : 'call_service', id : serviceCallId, service : this.name, + type: this.serviceType, args : request }; this.ros.callOnConnection(call); }; /** - * Every time a message is published for the given topic, the callback - * will be called with the message object. + * Advertise the service. This turns the Service object from a client + * into a server. The callback will be called with every request + * that's made on this service. * - * @param callback - function with the following params: - * * message - the published message + * @param callback - This works similarly to the callback for a C++ service and should take the following params: + * * request - the service request + * * response - an empty dictionary. Take care not to overwrite this. Instead, only modify the values within. + * It should return true if the service has finished successfully, + * i.e. without any fatal errors. */ Service.prototype.advertise = function(callback) { if (this.isAdvertised || typeof callback !== 'function') { @@ -2236,7 +2654,8 @@ Service.prototype._serviceResponse = function(rosbridgeRequest) { }; module.exports = Service; -},{"./ServiceRequest":14,"./ServiceResponse":15,"eventemitter2":1}],14:[function(require,module,exports){ + +},{"./ServiceRequest":15,"./ServiceResponse":16,"eventemitter2":2}],15:[function(require,module,exports){ /** * @fileoverview * @author Brandon Alexander - balexander@willowgarage.com @@ -2255,7 +2674,7 @@ function ServiceRequest(values) { } module.exports = ServiceRequest; -},{"object-assign":2}],15:[function(require,module,exports){ +},{"object-assign":3}],16:[function(require,module,exports){ /** * @fileoverview * @author Brandon Alexander - balexander@willowgarage.com @@ -2274,7 +2693,7 @@ function ServiceResponse(values) { } module.exports = ServiceResponse; -},{"object-assign":2}],16:[function(require,module,exports){ +},{"object-assign":3}],17:[function(require,module,exports){ /** * Socket event handling utilities for handling events on either * WebSocket and TCP sockets @@ -2286,6 +2705,8 @@ module.exports = ServiceResponse; 'use strict'; var decompressPng = require('../util/decompressPng'); +var CBOR = require('cbor-js'); +var typedArrayTagger = require('../util/cborTypedArrayTags'); var WebSocket = require('ws'); var BSON = null; if(typeof bson !== 'undefined'){ @@ -2383,6 +2804,9 @@ function SocketAdapter(client) { decodeBSON(data.data, function (message) { handlePng(message, handleMessage); }); + } else if (data.data instanceof ArrayBuffer) { + var decoded = CBOR.decode(data.data, typedArrayTagger); + handleMessage(decoded); } else { var message = JSON.parse(typeof data === 'string' ? data : data.data); handlePng(message, handleMessage); @@ -2393,7 +2817,7 @@ function SocketAdapter(client) { module.exports = SocketAdapter; -},{"../util/decompressPng":41,"ws":39}],17:[function(require,module,exports){ +},{"../util/cborTypedArrayTags":40,"../util/decompressPng":43,"cbor-js":1,"ws":41}],18:[function(require,module,exports){ /** * @fileoverview * @author Brandon Alexander - baalexander@gmail.com @@ -2414,7 +2838,7 @@ var Message = require('./Message'); * * ros - the ROSLIB.Ros connection handle * * name - the topic name, like /cmd_vel * * messageType - the message type, like 'std_msgs/String' - * * compression - the type of compression to use, like 'png' + * * compression - the type of compression to use, like 'png' or 'cbor' * * throttle_rate - the rate (in ms in between messages) at which to throttle the topics * * queue_size - the queue created at bridge side for re-publishing webtopics (defaults to 100) * * latch - latch the topic when publishing @@ -2436,9 +2860,10 @@ function Topic(options) { // Check for valid compression types if (this.compression && this.compression !== 'png' && - this.compression !== 'none') { + this.compression !== 'cbor' && this.compression !== 'none') { this.emit('warning', this.compression + ' compression is not supported. No compression will be used.'); + this.compression = 'none'; } // Check if throttle rate is negative @@ -2601,7 +3026,7 @@ Topic.prototype.publish = function(message) { module.exports = Topic; -},{"./Message":10,"eventemitter2":1}],18:[function(require,module,exports){ +},{"./Message":11,"eventemitter2":2}],19:[function(require,module,exports){ var mixin = require('../mixin'); var core = module.exports = { @@ -2616,7 +3041,7 @@ var core = module.exports = { mixin(core.Ros, ['Param', 'Service', 'Topic'], core); -},{"../mixin":24,"./Message":10,"./Param":11,"./Ros":12,"./Service":13,"./ServiceRequest":14,"./ServiceResponse":15,"./Topic":17}],19:[function(require,module,exports){ +},{"../mixin":25,"./Message":11,"./Param":12,"./Ros":13,"./Service":14,"./ServiceRequest":15,"./ServiceResponse":16,"./Topic":18}],20:[function(require,module,exports){ /** * @fileoverview * @author David Gossow - dgossow@willowgarage.com @@ -2662,8 +3087,34 @@ Pose.prototype.clone = function() { return new Pose(this); }; +/** + * Multiplies this pose with another pose without altering this pose. + * + * @returns Result of multiplication. + */ +Pose.prototype.multiply = function(pose) { + var p = pose.clone(); + p.applyTransform({ rotation: this.orientation, translation: this.position }); + return p; +}; + +/** + * Computes the inverse of this pose. + * + * @returns Inverse of pose. + */ +Pose.prototype.getInverse = function() { + var inverse = this.clone(); + inverse.orientation.invert(); + inverse.position.multiplyQuaternion(inverse.orientation); + inverse.position.x *= -1; + inverse.position.y *= -1; + inverse.position.z *= -1; + return inverse; +}; + module.exports = Pose; -},{"./Quaternion":20,"./Vector3":22}],20:[function(require,module,exports){ +},{"./Quaternion":21,"./Vector3":23}],21:[function(require,module,exports){ /** * @fileoverview * @author David Gossow - dgossow@willowgarage.com @@ -2757,7 +3208,7 @@ Quaternion.prototype.clone = function() { module.exports = Quaternion; -},{}],21:[function(require,module,exports){ +},{}],22:[function(require,module,exports){ /** * @fileoverview * @author David Gossow - dgossow@willowgarage.com @@ -2791,7 +3242,7 @@ Transform.prototype.clone = function() { }; module.exports = Transform; -},{"./Quaternion":20,"./Vector3":22}],22:[function(require,module,exports){ +},{"./Quaternion":21,"./Vector3":23}],23:[function(require,module,exports){ /** * @fileoverview * @author David Gossow - dgossow@willowgarage.com @@ -2860,7 +3311,7 @@ Vector3.prototype.clone = function() { }; module.exports = Vector3; -},{}],23:[function(require,module,exports){ +},{}],24:[function(require,module,exports){ module.exports = { Pose: require('./Pose'), Quaternion: require('./Quaternion'), @@ -2868,7 +3319,7 @@ module.exports = { Vector3: require('./Vector3') }; -},{"./Pose":19,"./Quaternion":20,"./Transform":21,"./Vector3":22}],24:[function(require,module,exports){ +},{"./Pose":20,"./Quaternion":21,"./Transform":22,"./Vector3":23}],25:[function(require,module,exports){ /** * Mixin a feature to the core/Ros prototype. * For example, mixin(Ros, ['Topic'], {Topic: }) @@ -2887,7 +3338,7 @@ module.exports = function(Ros, classes, features) { }); }; -},{}],25:[function(require,module,exports){ +},{}],26:[function(require,module,exports){ /** * @fileoverview * @author David Gossow - dgossow@willowgarage.com @@ -3108,7 +3559,7 @@ TFClient.prototype.dispose = function() { module.exports = TFClient; -},{"../actionlib/ActionClient":5,"../actionlib/Goal":7,"../core/Service.js":13,"../core/ServiceRequest.js":14,"../math/Transform":21}],26:[function(require,module,exports){ +},{"../actionlib/ActionClient":6,"../actionlib/Goal":8,"../core/Service.js":14,"../core/ServiceRequest.js":15,"../math/Transform":22}],27:[function(require,module,exports){ var Ros = require('../core/Ros'); var mixin = require('../mixin'); @@ -3117,7 +3568,7 @@ var tf = module.exports = { }; mixin(Ros, ['TFClient'], tf); -},{"../core/Ros":12,"../mixin":24,"./TFClient":25}],27:[function(require,module,exports){ +},{"../core/Ros":13,"../mixin":25,"./TFClient":26}],28:[function(require,module,exports){ /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -3148,7 +3599,7 @@ function UrdfBox(options) { } module.exports = UrdfBox; -},{"../math/Vector3":22,"./UrdfTypes":36}],28:[function(require,module,exports){ +},{"../math/Vector3":23,"./UrdfTypes":37}],29:[function(require,module,exports){ /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -3172,7 +3623,7 @@ function UrdfColor(options) { } module.exports = UrdfColor; -},{}],29:[function(require,module,exports){ +},{}],30:[function(require,module,exports){ /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -3195,12 +3646,16 @@ function UrdfCylinder(options) { } module.exports = UrdfCylinder; -},{"./UrdfTypes":36}],30:[function(require,module,exports){ +},{"./UrdfTypes":37}],31:[function(require,module,exports){ /** * @fileOverview * @author David V. Lu!! davidvlu@gmail.com */ +var Pose = require('../math/Pose'); +var Vector3 = require('../math/Vector3'); +var Quaternion = require('../math/Quaternion'); + /** * A Joint element in a URDF. * @@ -3227,11 +3682,64 @@ function UrdfJoint(options) { this.minval = parseFloat( limits[0].getAttribute('lower') ); this.maxval = parseFloat( limits[0].getAttribute('upper') ); } + + // Origin + var origins = options.xml.getElementsByTagName('origin'); + if (origins.length === 0) { + // use the identity as the default + this.origin = new Pose(); + } else { + // Check the XYZ + var xyz = origins[0].getAttribute('xyz'); + var position = new Vector3(); + if (xyz) { + xyz = xyz.split(' '); + position = new Vector3({ + x : parseFloat(xyz[0]), + y : parseFloat(xyz[1]), + z : parseFloat(xyz[2]) + }); + } + + // Check the RPY + var rpy = origins[0].getAttribute('rpy'); + var orientation = new Quaternion(); + if (rpy) { + rpy = rpy.split(' '); + // Convert from RPY + var roll = parseFloat(rpy[0]); + var pitch = parseFloat(rpy[1]); + var yaw = parseFloat(rpy[2]); + var phi = roll / 2.0; + var the = pitch / 2.0; + var psi = yaw / 2.0; + var x = Math.sin(phi) * Math.cos(the) * Math.cos(psi) - Math.cos(phi) * Math.sin(the) + * Math.sin(psi); + var y = Math.cos(phi) * Math.sin(the) * Math.cos(psi) + Math.sin(phi) * Math.cos(the) + * Math.sin(psi); + var z = Math.cos(phi) * Math.cos(the) * Math.sin(psi) - Math.sin(phi) * Math.sin(the) + * Math.cos(psi); + var w = Math.cos(phi) * Math.cos(the) * Math.cos(psi) + Math.sin(phi) * Math.sin(the) + * Math.sin(psi); + + orientation = new Quaternion({ + x : x, + y : y, + z : z, + w : w + }); + orientation.normalize(); + } + this.origin = new Pose({ + position : position, + orientation : orientation + }); + } } module.exports = UrdfJoint; -},{}],31:[function(require,module,exports){ +},{"../math/Pose":20,"../math/Quaternion":21,"../math/Vector3":23}],32:[function(require,module,exports){ /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -3260,7 +3768,7 @@ function UrdfLink(options) { } module.exports = UrdfLink; -},{"./UrdfVisual":37}],32:[function(require,module,exports){ +},{"./UrdfVisual":38}],33:[function(require,module,exports){ /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -3310,7 +3818,7 @@ UrdfMaterial.prototype.assign = function(obj) { module.exports = UrdfMaterial; -},{"./UrdfColor":28,"object-assign":2}],33:[function(require,module,exports){ +},{"./UrdfColor":29,"object-assign":3}],34:[function(require,module,exports){ /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -3347,7 +3855,7 @@ function UrdfMesh(options) { } module.exports = UrdfMesh; -},{"../math/Vector3":22,"./UrdfTypes":36}],34:[function(require,module,exports){ +},{"../math/Vector3":23,"./UrdfTypes":37}],35:[function(require,module,exports){ /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -3444,7 +3952,7 @@ function UrdfModel(options) { module.exports = UrdfModel; -},{"./UrdfJoint":30,"./UrdfLink":31,"./UrdfMaterial":32,"xmldom":42}],35:[function(require,module,exports){ +},{"./UrdfJoint":31,"./UrdfLink":32,"./UrdfMaterial":33,"xmldom":44}],36:[function(require,module,exports){ /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -3466,7 +3974,7 @@ function UrdfSphere(options) { } module.exports = UrdfSphere; -},{"./UrdfTypes":36}],36:[function(require,module,exports){ +},{"./UrdfTypes":37}],37:[function(require,module,exports){ module.exports = { URDF_SPHERE : 0, URDF_BOX : 1, @@ -3474,7 +3982,7 @@ module.exports = { URDF_MESH : 3 }; -},{}],37:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -3603,7 +4111,7 @@ function UrdfVisual(options) { } module.exports = UrdfVisual; -},{"../math/Pose":19,"../math/Quaternion":20,"../math/Vector3":22,"./UrdfBox":27,"./UrdfCylinder":29,"./UrdfMaterial":32,"./UrdfMesh":33,"./UrdfSphere":35}],38:[function(require,module,exports){ +},{"../math/Pose":20,"../math/Quaternion":21,"../math/Vector3":23,"./UrdfBox":28,"./UrdfCylinder":30,"./UrdfMaterial":33,"./UrdfMesh":34,"./UrdfSphere":36}],39:[function(require,module,exports){ module.exports = require('object-assign')({ UrdfBox: require('./UrdfBox'), UrdfColor: require('./UrdfColor'), @@ -3616,17 +4124,132 @@ module.exports = require('object-assign')({ UrdfVisual: require('./UrdfVisual') }, require('./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(require,module,exports){ -(function (global){ -module.exports = global.WebSocket; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],40:[function(require,module,exports){ +},{"./UrdfBox":28,"./UrdfColor":29,"./UrdfCylinder":30,"./UrdfLink":32,"./UrdfMaterial":33,"./UrdfMesh":34,"./UrdfModel":35,"./UrdfSphere":36,"./UrdfTypes":37,"./UrdfVisual":38,"object-assign":3}],40:[function(require,module,exports){ +'use strict'; + +var UPPER32 = Math.pow(2, 32); + +var warnedPrecision = false; +function warnPrecision() { + if (!warnedPrecision) { + warnedPrecision = true; + console.warn('CBOR 64-bit integer array values may lose precision. No further warnings.'); + } +} + +/** + * Unpacks 64-bit unsigned integer from byte array. + * @param {Uint8Array} bytes +*/ +function decodeUint64LE(bytes) { + warnPrecision(); + + var byteLen = bytes.byteLength; + var arrLen = byteLen / 8; + + var buffer = bytes.buffer.slice(-byteLen); + var uint32View = new Uint32Array(buffer); + + var arr = new Array(arrLen); + for (var i = 0; i < arrLen; i++) { + var si = i * 2; + var lo = uint32View[si]; + var hi = uint32View[si+1]; + arr[i] = lo + UPPER32 * hi; + } + + return arr; +} + +/** + * Unpacks 64-bit signed integer from byte array. + * @param {Uint8Array} bytes +*/ +function decodeInt64LE(bytes) { + warnPrecision(); + + var byteLen = bytes.byteLength; + var arrLen = byteLen / 8; + + var buffer = bytes.buffer.slice(-byteLen); + var uint32View = new Uint32Array(buffer); + var int32View = new Int32Array(buffer); + + var arr = new Array(arrLen); + for (var i = 0; i < arrLen; i++) { + var si = i * 2; + var lo = uint32View[si]; + var hi = int32View[si+1]; + arr[i] = lo + UPPER32 * hi; + } + + return arr; +} + +/** + * Unpacks typed array from byte array. + * @param {Uint8Array} bytes + * @param {type} ArrayType - desired output array type +*/ +function decodeNativeArray(bytes, ArrayType) { + var byteLen = bytes.byteLength; + var buffer = bytes.buffer.slice(-byteLen); + return new ArrayType(buffer); +} + +/** + * Support a subset of draft CBOR typed array tags: + * + * Only support little-endian tags for now. + */ +var nativeArrayTypes = { + 64: Uint8Array, + 69: Uint16Array, + 70: Uint32Array, + 72: Int8Array, + 77: Int16Array, + 78: Int32Array, + 85: Float32Array, + 86: Float64Array +}; + +/** + * We can also decode 64-bit integer arrays, since ROS has these types. + */ +var conversionArrayTypes = { + 71: decodeUint64LE, + 79: decodeInt64LE +}; + +/** + * Handles CBOR typed array tags during decoding. + * @param {Uint8Array} data + * @param {Number} tag + */ +function cborTypedArrayTagger(data, tag) { + if (tag in nativeArrayTypes) { + var arrayType = nativeArrayTypes[tag]; + return decodeNativeArray(data, arrayType); + } + if (tag in conversionArrayTypes) { + return conversionArrayTypes[tag](data); + } + return data; +} + +if (typeof module !== 'undefined' && module.exports) { + module.exports = cborTypedArrayTagger; +} + +},{}],41:[function(require,module,exports){ +module.exports = window.WebSocket; + +},{}],42:[function(require,module,exports){ /* global document */ module.exports = function Canvas() { return document.createElement('canvas'); }; -},{}],41:[function(require,module,exports){ -(function (global){ +},{}],43:[function(require,module,exports){ /** * @fileOverview * @author Graeme Yeates - github.com/megawac @@ -3635,7 +4258,7 @@ module.exports = function Canvas() { 'use strict'; var Canvas = require('canvas'); -var Image = Canvas.Image || global.Image; +var Image = Canvas.Image || window.Image; /** * If a message was compressed as a PNG image (a compression hack since @@ -3683,11 +4306,10 @@ function decompressPng(data, callback) { } module.exports = decompressPng; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"canvas":40}],42:[function(require,module,exports){ -(function (global){ -exports.DOMImplementation = global.DOMImplementation; -exports.XMLSerializer = global.XMLSerializer; -exports.DOMParser = global.DOMParser; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}]},{},[4]); + +},{"canvas":42}],44:[function(require,module,exports){ +exports.DOMImplementation = window.DOMImplementation; +exports.XMLSerializer = window.XMLSerializer; +exports.DOMParser = window.DOMParser; + +},{}]},{},[5]); diff --git a/build/roslib.min.js b/build/roslib.min.js index 71176ee00..d6efd9f18 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.parent=b[0].getAttribute("link"));var c=a.xml.getElementsByTagName("child");c.length>0&&(this.child=c[0].getAttribute("link"));var d=a.xml.getElementsByTagName("limit");d.length>0&&(this.minval=parseFloat(d[0].getAttribute("lower")),this.maxval=parseFloat(d[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>2,f=0;f>6),d.push(128|63&g)):g<55296?(d.push(224|g>>12),d.push(128|g>>6&63),d.push(128|63&g)):(g=(1023&g)<<10,g|=1023&a.charCodeAt(++b),g+=65536,d.push(240|g>>18),d.push(128|g>>12&63),d.push(128|g>>6&63),d.push(128|63&g))}return m(3,d.length),i(d);default:var j;if(Array.isArray(a))for(j=a.length,m(4,j),b=0;b>5!==a)throw"Invalid indefinite length element";return c}function s(a,b){for(var c=0;c>10),a.push(56320|1023&d))}}function t(){var a,e,f=l(),g=f>>5,m=31&f;if(7===g)switch(m){case 25:return i();case 26:return j();case 27:return k()}if(e=q(m),e<0&&(g<2||6=0;)o+=e,n.push(h(e));var u=new Uint8Array(o),v=0;for(a=0;a=0;)s(w,e);else s(w,e);return String.fromCharCode.apply(null,w);case 4:var x;if(e<0)for(x=[];!p();)x.push(t());else for(x=new Array(e),a=0;a0&&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.parent=b[0].getAttribute("link"));var c=a.xml.getElementsByTagName("child");c.length>0&&(this.child=c[0].getAttribute("link"));var d=a.xml.getElementsByTagName("limit");d.length>0&&(this.minval=parseFloat(d[0].getAttribute("lower")),this.maxval=parseFloat(d[0].getAttribute("upper")));var h=a.xml.getElementsByTagName("origin");if(0===h.length)this.origin=new e;else{var i=h[0].getAttribute("xyz"),j=new f;i&&(i=i.split(" "),j=new f({x:parseFloat(i[0]),y:parseFloat(i[1]),z:parseFloat(i[2])}));var k=h[0].getAttribute("rpy"),l=new g;if(k){k=k.split(" ");var m=parseFloat(k[0]),n=parseFloat(k[1]),o=parseFloat(k[2]),p=m/2,q=n/2,r=o/2,s=Math.sin(p)*Math.cos(q)*Math.cos(r)-Math.cos(p)*Math.sin(q)*Math.sin(r),t=Math.cos(p)*Math.sin(q)*Math.cos(r)+Math.sin(p)*Math.cos(q)*Math.sin(r),u=Math.cos(p)*Math.cos(q)*Math.sin(r)-Math.sin(p)*Math.sin(q)*Math.cos(r),v=Math.cos(p)*Math.cos(q)*Math.cos(r)+Math.sin(p)*Math.sin(q)*Math.sin(r);l=new g({x:s,y:t,z:u,w:v}),l.normalize()}this.origin=new e({position:j,orientation:l})}}var e=a("../math/Pose"),f=a("../math/Vector3"),g=a("../math/Quaternion");b.exports=d},{"../math/Pose":20,"../math/Quaternion":21,"../math/Vector3":23}],32:[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":29,"object-assign":3}],34:[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":23,"./UrdfTypes":37}],35:[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":20,"../math/Quaternion":21,"../math/Vector3":23,"./UrdfBox":28,"./UrdfCylinder":30,"./UrdfMaterial":33,"./UrdfMesh":34,"./UrdfSphere":36}],39:[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":28,"./UrdfColor":29,"./UrdfCylinder":30,"./UrdfLink":32,"./UrdfMaterial":33,"./UrdfMesh":34,"./UrdfModel":35,"./UrdfSphere":36,"./UrdfTypes":37,"./UrdfVisual":38,"object-assign":3}],40:[function(a,b,c){"use strict";function d(){j||(j=!0,console.warn("CBOR 64-bit integer array values may lose precision. No further warnings."))}function e(a){d();for(var b=a.byteLength,c=b/8,e=a.buffer.slice(-b),f=new Uint32Array(e),g=new Array(c),h=0;h