Skip to content

Commit 6c61ff3

Browse files
committed
Testing use of actionlib topic with turtlesim
- now using a patched version of xmlrpc that sends content-length headers on method responses. This omission was preventing tutlesim from receiving publications from rosnodejs, and hence also action lib calls.
1 parent f23816d commit 6c61ff3

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

lib/Publisher.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,13 @@ class Publisher extends EventEmitter {
180180
// console.log("_publish", this._messageHandler, msg);
181181
bufferInfo = this._messageHandler.serialize(msg, bufferInfo);
182182
// bufferInfo = msg.serialize();
183-
// console.log("_publish", bufferInfo);
183+
// console.log("_publish", bufferInfo.buffer[0].toString('hex'));
184184

185185
// prepend byte length to message
186186
let serialized = Serialize(
187187
Buffer.concat(bufferInfo.buffer, bufferInfo.length));
188188
Object.keys(this._subClients).forEach((client) => {
189+
console.log("_publish to client", client);
189190
this._subClients[client].write(serialized);
190191
});
191192

@@ -255,6 +256,7 @@ class Publisher extends EventEmitter {
255256

256257
// if handshake good, add to list, we'll start publishing to it
257258
this._subClients[subscriber.name] = subscriber;
259+
// console.log("subscriber", subscriber);
258260

259261
this.emit('connection', header, subscriber.name);
260262
}

lib/RosNode.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class RosNode extends EventEmitter {
8181
}
8282

8383
advertise(options) {
84+
console.log("advertise", options);
8485
let topic = options.topic;
8586
let pub = this._publishers[topic];
8687
if (!pub) {
@@ -292,6 +293,7 @@ class RosNode extends EventEmitter {
292293
+ connection.remotePort;
293294
connection.name = conName;
294295
this._log.debug('Node %s got connection from %s', this.getNodeName(), conName);
296+
console.log('Node %s got connection from %s', this.getNodeName(), conName);
295297

296298
// data from connections will be TCPROS encoded, so use a
297299
// DeserializeStream to handle any chunking
@@ -352,6 +354,7 @@ class RosNode extends EventEmitter {
352354

353355
_handleTopicRequest(err, params, callback) {
354356
this._log.debug('Got topic request ' + JSON.stringify(params));
357+
console.log('Got topic request ' + JSON.stringify(params));
355358
if (!err) {
356359
let topic = params[1];
357360
let pub = this._publishers[topic];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"dependencies": {
2525
"moment": "2.12.0",
2626
"portscanner": "1.0.0",
27-
"xmlrpc": "1.3.1",
27+
"xmlrpc": "chfritz/node-xmlrpc",
2828
"walker" : "1.0.7",
2929
"md5" : "2.1.0",
3030
"async" : "0.1.22",

utils/messages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ function calculateMD5(details, type) {
305305
return null;
306306
}
307307

308-
console.log("calculateMD5:", details.messageType, " text:", text);
308+
// console.log("calculateMD5:", details.messageType, " text:", text);
309309
return md5(text);
310310
}
311311

utils/xmlrpc_utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
module.exports = {
55
call(client, method, data, resolve, reject, log, timeout) {
66
log.debug('Calling method ' + method +': ' + data);
7+
console.log('Calling method ' + method +': ' + data);
8+
79
if (timeout === undefined) {
810
timeout = 0;
911
}

0 commit comments

Comments
 (0)