On Mon, Aug 6, 2012 at 5:39 AM, Anthony Mallet <span dir="ltr"><<a href="mailto:anthony.mallet@laas.fr" target="_blank">anthony.mallet@laas.fr</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi,<br>
<br>
To make a long story short, I have an issue with MD5 digest of messages (and<br>
services, and actions from actionlib).<br>
<br>
Consider the following to messages:<br>
% cat a.msg<br>
string a<br>
% cat b.msg<br>
string b<br>
<br>
They end up having a different MD5 digest because the MD5 computation considers<br>
the field name (here `a' or `b'), so they are not interchangeable.<br>
<br>
I am trying to figure out a way to make them still appear compatible in every<br>
possible context. Is it possible to do this in C++, for :<br>
 - topics?<br>
 - services?<br>
 - actionlib?<br>
<br>
Why I want to this is because I am trying to make a client able to dynamically<br>
talk to different, unrelated servers. The client does not know at compile time<br>
which of the message a or b it will use. Also, the two messages (or services,<br>
or actions) are generated at compile time from another definition, so they<br>
cannot be 'shared' by the different servers (of course, the messages `a' and<br>
`b' are guaranteed to be compatible by other means).<br></blockquote><div><br></div><div>If you have other means of guaranteeing that the messages are compatible, can you also guarantee that fields with the same semantics have the same names? Without that, how would the ROS system know those messages, even though they have different names, are "compatible"?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
What I am trying to achieve could be compared to function pointers. Consider<br>
the two C functions.<br>
  int a(int a);<br>
  int b(int b);<br>
You can define a generic function pointer int (*x)(int x) than can dynamically<br>
be bound to `a' or `b', while still having the compiler check for<br>
compatibility and reject non matching prototypes.<br>
<br>
I am wondering if the MD5 computation isn't too constraining here, since the<br>
two messages `a' and `b' are clearly compatible. The parameter names is, in<br>
general, not relevant for the interface compatibility checks, as you can see<br>
from the C function pointer example. Since there is a serialization between<br>
clients and servers, the parameter names don't have to match on both sides.<br></blockquote><div><br></div><div>MD5 sums are used to identify unique message types. Messages with parameters with the same types but different names are not necessarily "compatible" at anything other than a data-on-the-wire level. For example,</div>
<div><br></div><div>$ cat velocity.msg</div><div>float64 velocity # units: m/s</div><div><br></div><div>$ cat battery_level.msg</div><div>float64 battery_pct # units: percentage, 0-1</div><div><br></div><div>While those two messages contain the same amount of bytes and those bytes are ordered the same way, their meanings are wildly different - all based on the parameter name, not the type. The MD5 sum has to include the parameter names in order to differentiate those two messages (or others like them).</div>
<div><br></div><div>- Eric</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
So, would the MD5 digest not consider parameters names but just parameter<br>
types, then I my issues would go away :)<br>
<br>
Any thoughts on how to solve this issue?<br>
_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org" target="_blank">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
</blockquote></div><br>