Rosanswers logo

I have a topic containing several messages. How can I use 'rostopic echo' to echo only one message.

For example this is my topic containing the following messages:

Header      hdr
int32       runlevel
int32       sublevel
int32       last_seq
int32[2]    type
int32[6]    pos
float32[18]   ori

and I am just interested to see only message pos on my terminal.

Originally posted by Hossein on ROS Answers with karma: 45 on 2016-02-04

Post score: 1

Original comments

Comment by Hossein on 2016-02-04:
Is there anyway to decrease the rate of publishing? It's too fast and I can't see them.

Also is there anyway to plot them?

Comment by MichaelKorn on 2016-02-04:
please update your question, don't post an answer.


1 Answer 1


Rosanswers logo

Regarding to the documentation of rostopic, this should work:

rostopic echo /my_topic/field_name

one complex example for typical tf messages:

rostopic echo /tf/transforms[0]/transform/translation/x

You can change the output rate (e.g. 1sec) with:

watch -n1 rostopic echo /my_topic/field_name

You can plot topics with rqt_plot

Originally posted by MichaelKorn with karma: 1480 on 2016-02-04

This answer was ACCEPTED on the original site

Post score: 11

Original comments

Comment by ahendrix on 2016-02-04:
I can confirm that the first version works. I use it frequently.

Comment by MichaelKorn on 2016-02-04:
@ahendrix: You are right. I tried it with tf and I failed to take into account that the field "transforms" is an array.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.