-
Notifications
You must be signed in to change notification settings - Fork 75
The md5sums for service client and server were swapped #22
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
The md5sums for service client and server were swapped #22
Conversation
When trying to call services from turtlesim, I got this error: ``` [ERROR] [1465782638.813189334]: client wants service /turtle1/teleport_relative to have md5sum d41d8cd98f00b204e9800998ecf8427e, but it has 9d5c2dcd348ac8f76ce2a4307bd63a13. Dropping connection. ``` The wrong md5sum being sent was the one from the response handler. I double checked that the handler classes themselves were correct (and they were), but then found that the serviceClient itself sends the md5sum and picked the respectively wrong one (response md5 on request, and vice versa). This commit fixes that.
Here is the code I used: rosnodejs.initNode('/my_node', {
messages: ['std_msgs/String', 'turtlesim/Pose'],
services: ['std_srvs/SetBool', "turtlesim/TeleportRelative"]
}).then((rosNode) => {
const TeleportRelative = rosnodejs.require('turtlesim').srv.TeleportRelative;
const teleport_request = new TeleportRelative.Request({
linear: 1.0,
angular: 0.0
});
let serviceClient2 = rosNode.serviceClient("/turtle1/teleport_relative",
"turtlesim/TeleportRelative");
rosNode.waitForService(serviceClient2.getService(), 2000)
.then((available) => {
if (available) {
serviceClient2.call(teleport_request, (resp) => {
console.log('Service response ' + JSON.stringify(resp));
});
} else {
console.log('Service not available');
}
});
}); |
Are you interacting with a C++ or python server? My memory of when I set this up is that this is what worked for me against a python server/client, though that could be inaccurate... I looked into the We won't be able to fix this in |
I've tested this against turtlesim. Not sure whether that is c++ or python. But just from reading http://wiki.ros.org/ROS/Connection%20Header, I feel confident that ROS expects the md5sum of the request type in the request header and the md5sum of the response type in the response header -- i.e., the way it is now in the PR (client sends request md5sum, server responds with response md5sum). That seems to make more sense than the opposite anyways and is consistent with messages on topics: you always send the md5sum of the message type itself, not the md5sum of what you expect in return. I don't think there is anything you need to change in gennodejs, assuming it is already generating the correct md5sums in the type classes, which I assume it does. |
ps: you should be able to test this with gennodejs-generated message types as well. My example code is just what I used. |
I get the error whether I use the response md5sum or the request md5sum when talking to a rospy service. Testing against
|
oh I see. Thanks! Yes, I'll try to fix the on-the-fly code. |
- Fixes RethinkRobotics-opensource#24. - Replaces PR RethinkRobotics-opensource#22. - Refactored the file parsing code a bit in the process; a little cleaner now.
OK, I've fixed that now and created a new PR: #25. |
- Fixes RethinkRobotics-opensource#24. - Replaces PR RethinkRobotics-opensource#22. - Refactored the file parsing code a bit in the process; a little cleaner now.
- Fixes RethinkRobotics-opensource#24. - Replaces PR RethinkRobotics-opensource#22. - Refactored the file parsing code a bit in the process; a little cleaner now. 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. Simplified construction of complex messages - can now provide all data, incl. for sub-messages, directly in message constructor. E.g.: ```js let now = Date.now(); let secs = parseInt(now/1000); let nsecs = (now % 1000) * 1000; let shapeMsg = new shapeActionGoal({ header: { seq: 0, stamp: { secs: secs, nsecs: nsecs }, frame_id: '' }, goal_id: { stamp: { secs: secs, nsecs: nsecs }, id: "/my_node-1-"+secs+"."+nsecs+"000" }, goal: { edges: 5, radius: 1 } }); ``` Example of working with turtlesim
- Fixes RethinkRobotics-opensource#24. - Replaces PR RethinkRobotics-opensource#22. - Refactored the file parsing code a bit in the process; a little cleaner now. 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. Simplified construction of complex messages - can now provide all data, incl. for sub-messages, directly in message constructor. E.g.: ```js let now = Date.now(); let secs = parseInt(now/1000); let nsecs = (now % 1000) * 1000; let shapeMsg = new shapeActionGoal({ header: { seq: 0, stamp: { secs: secs, nsecs: nsecs }, frame_id: '' }, goal_id: { stamp: { secs: secs, nsecs: nsecs }, id: "/my_node-1-"+secs+"."+nsecs+"000" }, goal: { edges: 5, radius: 1 } }); ``` Example of working with turtlesim - explicitly requested on-the-fly message and service definitions now trump definitions from gennodejs. This puts the choice closer to runtime and also is required right now until the md5sum for services is fixed in gennodejs. - Some fixes in action client - Some fixes to on-the-fly message definitions to resemble gennodejs-generated classes - Broke some long lines
When trying to call services from turtlesim, I got this error:
The wrong md5sum being sent was the one from the response handler. I
double checked that the handler classes themselves were correct (and
they were), but then found that the serviceClient itself sends the
md5sum and picked the respectively wrong one (response md5 on request,
and vice versa).
This commit fixes that.