Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Rostopic doesn't support this directly. You might be able to hack it by doing something like:

rostopic echo -n1 /topic/array | wc -l # echo the array part of one message (-n1) into the word count program (wc) and count lines (-l)

This might be off by one or two depending on how rostopic formats the output; you might want to look at one or two examples before piping it into wc.

Or just add a check for the correct array size in your code, and a warning if the array is not the correct size.

The ROS message definition also allows for fixed-size arrays in messages.