From c3972143985287dfa2a315a84388dc45052e1cd5 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Wed, 11 Feb 2015 11:12:16 +0100 Subject: [PATCH 1/2] core: support queue_length for subscribing. The previous patch of using the queue_size was wrong, since the defaults are quite different (100 vs 0). Signed-off-by: Peter Soetens --- src/core/Topic.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/Topic.js b/src/core/Topic.js index ff3a1d67b..e7b4fdd6c 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 }); }; From 9d695aebd31fdde63be27a4ed6986f5d3db00c07 Mon Sep 17 00:00:00 2001 From: Bert Willaert Date: Thu, 19 Feb 2015 15:22:34 +0100 Subject: [PATCH 2/2] im_web_interface: Quaternion.js has now a norm() function --- src/math/Quaternion.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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;