ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Size of topic in command line

asked 2014-08-06 12:00:53 -0600

anamcarvalho gravatar image

Hi,

is it possible to know the size of a topic in the command line?

The topic I am dealing with should return 1920 values and I want to confirm that, without doing a cout in the code!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-08-06 12:21:34 -0600

ahendrix gravatar image

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-08-06 12:00:53 -0600

Seen: 2,249 times

Last updated: Aug 06 '14