Skip to content

Commit

Permalink
Fix TypeError: this.ros.ActionClient is not a function (#340)
Browse files Browse the repository at this point in the history
I'm using the ES6 import statement to load roslib which works fine for
most roslib modules, except `TFClient`. That module doesn't properly
import it's dependencies but relies on the properties on the ros object.

I rewrote it a little bit to make it work for ES6 imports. Should be
backwards compatible.
  • Loading branch information
Rayman authored and mvollrath committed Aug 22, 2019
1 parent f0d6d6a commit c10d9ec
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/tf/TFClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var Goal = require('../actionlib/Goal');

var Service = require('../core/Service.js');
var ServiceRequest = require('../core/ServiceRequest.js');
var Topic = require('../core/Topic.js');

var Transform = require('../math/Transform');

Expand Down Expand Up @@ -52,15 +53,17 @@ function TFClient(options) {
this.republisherUpdateRequested = false;

// Create an Action client
this.actionClient = this.ros.ActionClient({
this.actionClient = new ActionClient({
ros : options.ros,
serverName : this.serverName,
actionName : 'tf2_web_republisher/TFSubscriptionAction',
omitStatus : true,
omitResult : true
});

// Create a Service client
this.serviceClient = this.ros.Service({
this.serviceClient = new Service({
ros: options.ros,
name: this.repubServiceName,
serviceType: 'tf2_web_republisher/RepublishTFs'
});
Expand Down Expand Up @@ -146,7 +149,8 @@ TFClient.prototype.processResponse = function(response) {
this.currentTopic.unsubscribe();
}

this.currentTopic = this.ros.Topic({
this.currentTopic = new Topic({
ros: this.ros,
name: response.topic_name,
messageType: 'tf2_web_republisher/TFArray'
});
Expand Down

0 comments on commit c10d9ec

Please sign in to comment.