Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the same ID to unadvertise a topic as was used to advertise it #84

Merged
merged 2 commits into from
Jun 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions build/roslib.js
Original file line number Diff line number Diff line change
Expand Up @@ -867,10 +867,10 @@ ROSLIB.Topic.prototype.unsubscribe = function() {
*/
ROSLIB.Topic.prototype.advertise = function() {
this.ros.idCounter++;
var advertiseId = 'advertise:' + this.name + ':' + this.ros.idCounter;
this.advertiseId = 'advertise:' + this.name + ':' + this.ros.idCounter;
var call = {
op : 'advertise',
id : advertiseId,
id : this.advertiseId,
type : this.messageType,
topic : this.name,
latch : this.latch
Expand All @@ -883,8 +883,7 @@ ROSLIB.Topic.prototype.advertise = function() {
* Unregisters as a publisher for the topic.
*/
ROSLIB.Topic.prototype.unadvertise = function() {
this.ros.idCounter++;
var unadvertiseId = 'unadvertise:' + this.name + ':' + this.ros.idCounter;
var unadvertiseId = this.advertiseId;
var call = {
op : 'unadvertise',
id : unadvertiseId,
Expand All @@ -901,7 +900,7 @@ ROSLIB.Topic.prototype.unadvertise = function() {
*/
ROSLIB.Topic.prototype.publish = function(message) {
if (!this.isAdvertised) {
this.advertise();
this.advertise();
}

this.ros.idCounter++;
Expand Down Expand Up @@ -1182,8 +1181,8 @@ ROSLIB.TFClient.prototype.processFeedback = function(tf) {
var that = this;
tf.transforms.forEach(function(transform) {
var frameID = transform.child_frame_id;
if (frameID[0] !== '/') {
frameID = '/' + frameID;
if (frameID[0] === '/') {
frameID = frameID.substring(1);
}
var info = that.frameInfos[frameID];
if (info !== undefined) {
Expand Down
2 changes: 1 addition & 1 deletion build/roslib.min.js

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions src/core/Topic.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ ROSLIB.Topic.prototype.unsubscribe = function() {
*/
ROSLIB.Topic.prototype.advertise = function() {
this.ros.idCounter++;
var advertiseId = 'advertise:' + this.name + ':' + this.ros.idCounter;
this.advertiseId = 'advertise:' + this.name + ':' + this.ros.idCounter;
var call = {
op : 'advertise',
id : advertiseId,
id : this.advertiseId,
type : this.messageType,
topic : this.name,
latch : this.latch
Expand All @@ -111,8 +111,7 @@ ROSLIB.Topic.prototype.advertise = function() {
* Unregisters as a publisher for the topic.
*/
ROSLIB.Topic.prototype.unadvertise = function() {
this.ros.idCounter++;
var unadvertiseId = 'unadvertise:' + this.name + ':' + this.ros.idCounter;
var unadvertiseId = this.advertiseId;
var call = {
op : 'unadvertise',
id : unadvertiseId,
Expand All @@ -129,7 +128,7 @@ ROSLIB.Topic.prototype.unadvertise = function() {
*/
ROSLIB.Topic.prototype.publish = function(message) {
if (!this.isAdvertised) {
this.advertise();
this.advertise();
}

this.ros.idCounter++;
Expand Down
7 changes: 7 additions & 0 deletions utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ roslibjs Build Setup
2. Install Grunt and the test runner [Karma](http://karma-runner.github.io/)
* `sudo npm install -g grunt-cli`
* `sudo rm -rf ~/.npm ~/tmp`

If using an older version of Ubuntu, you may need to install a newer version of Node.js for this step to work:
* `sudo apt-get update`
* `sudo apt-get install -y python-software-properties python g++ make`
* `sudo add-apt-repository ppa:chris-lea/node.js`
* `sudo apt-get update`
* `sudo apt-get install nodejs`
3. Install the Grunt tasks specific to this project
* `cd /path/to/roslibjs/utils/`
* `npm install .`
Expand Down