Ask Your Question
0

Can't use rqt_plot with some topics

asked 2017-12-03 15:06:46 -0500

Marcus Barnet gravatar image

Hi to all,

I'm not able to use rqt_plot with some topics (I'm using ROS Indigo). I this it's because I can't find the correct field name and so I'm not able to correctly specify the path in rqt_plot.

This is my bag file and, for example, it outputs the following data for /robo/io topic:

data: 1511957429.218142138,0,0,0,0,3416,1441,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,6551
---
data: 1511957429.318112290,0,0,0,0,3442,1169,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,6552
---
data: 1511957429.418157183,0,0,0,0,3345,1283,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,6553
---
data: 1511957429.518295379,0,0,0,0,3294,1374,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,6554
---
data: 1511957429.618295945,0,0,0,0,3294,1306,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,6555
---
data: 1511957429.718757851,0,0,0,0,3258,1366,0,0,0,0,0,1,1,0,0,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,6556
---
data: 1511957429.818196624,0,0,0,0,3307,1473,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,6557

This is the result of rostopic type:

rostopic type /robo/io
std_msgs/String

All the topics included in the bag file come out from a ROS node which I wrote.

I'd like to plot columns 6 and 7 of /robo/io by using rtq_plot or any other tool available under ROS. Can you help me, please?

edit retag flag offensive close merge delete

Comments

Random comment: using std_msgs/String for this seems like a really strange thing to do. And I would be surprised if the answer by @jayess works immediately. I'm not sure if rqt_plot will plot anything but numeric data and / or can index into strings like what is suggested.

gvdhoorn gravatar imagegvdhoorn ( 2017-12-04 01:20:19 -0500 )edit

@gvdhoorn Good point, I somehow missed that std_msgs/String part at the end.

jayess gravatar imagejayess ( 2017-12-04 01:30:57 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-12-03 16:59:21 -0500

jayess gravatar image

updated 2017-12-04 01:34:12 -0500

rqt_plot will only plot one entry in an array so, if you want to use it, you need to specify which entry you want to plot. Therefore, you should try something like:

rqt_plot /robo/io[5]

or

rqt_plot /robo/io[6]

Alternatively, you can start rqt_plot and at the top enter the topic name and index of the array.

[Note that I didn't download your bag file because I don't download random files from random sites on the internet. So, you may have to play around with what you need to type in order to get the plot but this should be a starting point for you.]


Update

As @Dirk Thomas pointed out in the comments you can combine the two commands:

rqt_plot /robo/io[5] /robo/io[6]

Update 2:

As @gvdhoorn noted in the comments, you're trying to plot an std_msgs/String value which will not work. Plotting numbers makes sense. Plotting strings? Not so much.

If you're publishing the data then maybe you want to re-think how you're doing it (i.e., publish numerical data types). If you're not publishing and only subscribing, then you'll want to transform this data from a string into a numerical data type.

edit flag offensive delete link more

Comments

You can also pass multiple topics to plot multiple lines at the same time: e.g. rqt_plot /robo/io[5] /robo/io[6].

Dirk Thomas gravatar imageDirk Thomas ( 2017-12-03 17:07:09 -0500 )edit

@Dirk Thomas: thanks, I'll add that.

jayess gravatar imagejayess ( 2017-12-03 17:08:05 -0500 )edit

You have reason, I cannot plot string data. I need to change the code for my node in order to publish numerical values.

Marcus Barnet gravatar imageMarcus Barnet ( 2017-12-04 02:55:51 -0500 )edit
1

Great. If this solved your problem then please click the checkmark button to accept it.

jayess gravatar imagejayess ( 2017-12-04 02:57:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-12-03 15:06:46 -0500

Seen: 546 times

Last updated: Dec 04 '17