You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rostopic echo /footest
rostopic pub /footest "{x: 0.0, y: 0.0, z: 0.0.1}"
[WARN] [WallTime: 1377942406.224566] Inbound TCP/IP connection failed: required argument is not a float
Note the topic listener is required, else no packing happens. (Sidenote: I am not sure whether this should be a warning, seems more like an error to me.)
The problem here is that the message does not contain a hint to what value was not a float. I looked at the code genpy generates for messages / service, which looks like this:
for val1 in ...:
_v1 = ...
_v2 = _v1....
_x = _v2
buff.write(_struct...(_x....)
At least the value of _x should IMO be used in the case of errors, to indicate the writing of what failed. In my case (not using geometry_msgs/Point but a more complex message) that would have reduce me looking for the error a lot.
So a change to genpy would be to change the generated code something like this:
- except struct.error as se: self._check_types(se)
- except TypeError as te: self._check_types(te)
+ except struct.error as se: self._check_types(self._check_types(ValueError("%s: %s when writing %s" % (type(se), str(se), str(_x))))
+ except TypeError as te: self._check_types(self._check_types(ValueError("%s: %s when writing %s" % (type(te), str(te), str(_x)))))
To reproduce, using two shells(e.g.):
Note the topic listener is required, else no packing happens. (Sidenote: I am not sure whether this should be a warning, seems more like an error to me.)
The problem here is that the message does not contain a hint to what value was not a float. I looked at the code genpy generates for messages / service, which looks like this:
At least the value of _x should IMO be used in the case of errors, to indicate the writing of what failed. In my case (not using geometry_msgs/Point but a more complex message) that would have reduce me looking for the error a lot.
So a change to genpy would be to change the generated code something like this:
Also see:
http://stackoverflow.com/questions/696047/re-raising-exceptions-with-a-different-type-and-message-preserving-existing-inf
The text was updated successfully, but these errors were encountered: