OTL / rosruby

ruby ROS client.
http://otl.github.com/rosruby/
BSD 3-Clause "New" or "Revised" License
25 stars 5 forks source link

Deseralization of array data #34

Closed kulich closed 10 years ago

kulich commented 11 years ago

genmsg_ruby.py script generates a buggy deserialisation code for arrays. For example, when deserialising PositionWithCovariances, the message should contain Covariance array which is float[36]. Instead, the array contains only one number, the rest 35 elements are nils. This behavior is caused by line 716 in genmsg_ruby.py which generates "end_point += 8" (line 116 in PoseWithCovariance.rb). Instead of "8" it should generate the size of float[36] which is 36*8. Therefore, I suggest to write line 716 of genmsg_ruby.py in this way: yield "end_point += ROS::Struct::calc_size('%s')"%convert_to_ruby_pattern(pattern) instead of yield "end_point += %s"%struct.calcsize('%s'%convert_to_ruby_pattern(pattern))

OTL commented 11 years ago

Thanks! Your patch seems to work fine, and i committed it to master branch.