diff --git a/src/core/Topic.js b/src/core/Topic.js index 3497a1623..481ac7bca 100644 --- a/src/core/Topic.js +++ b/src/core/Topic.js @@ -18,7 +18,10 @@ var Message = require('./Message'); * * name - the topic name, like /cmd_vel * * messageType - the message type, like 'std_msgs/String' * * compression - the type of compression to use, like 'png' - * * throttle_rate - the rate at which to throttle the topics + * * 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 + * * queue_length - the queue length at bridge side used when subscribing (defaults to 0, no queueing). */ function Topic(options) { options = options || {}; @@ -30,6 +33,7 @@ function Topic(options) { this.throttle_rate = options.throttle_rate || 0; this.latch = options.latch || false; this.queue_size = options.queue_size || 100; + this.queue_length = options.queue_length || 0; // Check for valid compression types if (this.compression && this.compression !== 'png' && @@ -73,7 +77,7 @@ Topic.prototype.subscribe = function(callback) { topic: this.name, compression: this.compression, throttle_rate: this.throttle_rate, - queue_length: this.queue_size + queue_length: this.queue_length }); }; diff --git a/src/math/Quaternion.js b/src/math/Quaternion.js index c988c7665..7de8aed0a 100644 --- a/src/math/Quaternion.js +++ b/src/math/Quaternion.js @@ -29,6 +29,13 @@ Quaternion.prototype.conjugate = function() { this.z *= -1; }; +/** + * Return the norm of this quaternion. + */ +Quaternion.prototype.norm = function() { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); +}; + /** * Perform a normalization on this quaternion. */ @@ -81,4 +88,4 @@ Quaternion.prototype.clone = function() { return new Quaternion(this); }; -module.exports = Quaternion; \ No newline at end of file +module.exports = Quaternion;