ros-drivers / rosserial

A ROS client library for small, embedded devices, such as Arduino. See: http://wiki.ros.org/rosserial
517 stars 525 forks source link

limitation on client side getParam() with array of strings ??? #443

Closed mibcat closed 4 years ago

mibcat commented 5 years ago

Hi !

I'm trying to read in an array of strings and observed a strange limitation: as soon as the total amount of characters in this array exceeds 20 the getParam() function fails with:

[WARN] [1570464268.483718]: Failed to get param: timeout expired

for example this definition in a yaml file which is loaded to the parameter server works:

frame_id:
- '123456789012345'
- '1'
- '1'
- '1'
- '1'
- '1'

> rosparam get /ir_sensor_array/frame_id 
['123456789012345', '1', '1', '1', '1', '1']

but adding one character will lead to an error:

frame_id:
- '123456789012345'
- '1'
- '1'
- '12'
- '1'
- '1'

> rosparam get /ir_sensor_array/frame_id 
['123456789012345', '1', '1', '12', '1', '1']

It does not matter how the characters are split across the array. Only if the sum exceeds 20 the timeout occurs.

On the other side I'm able to read in a single string of more than 30 characters without a problem - so it should not be a simple buffer size issue.

Thanks for help, Michael.

mibcat commented 5 years ago

addendum: the observed limitation depends on the number or string array elements (n) and follows the formula: character limit = 40 - (n-1)*4

Tested in the following cases:

array size character limit
1 40 (single string is limited to 40 characters!)
2 36
3 32
4 28
5 24 (not tested explicitly)
6 20 (where the problem started ;-))
mibcat commented 4 years ago

This issue was caused by a firmware bug of the implemented virtual COM port (CDC) if the USB data size exceeds 128 bytes. After fixing everything is working as expected - sorry for blaming rosserial ;-)