ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Live Graph on Kinetic

asked 2019-07-03 11:00:09 -0500

MG993 gravatar image

Hi, I'm using ROS Kinteic on Ubuntu 16.04. I need to plot the data from 2 topics. In this topics there are 2 array of 70 elements each, one represents x coordinates of 70 different points and the other one the y coordinates. I need to plot the 70 points (x coordinate from one topic and y coordinate from the other one) and I need to do it live. This points represents the position of objects from a camera in body frame and they are updated at about 10 Hz. Every time a new message is published in the topics I need to erase the previous points and draw the new ones. Do you have an suggestion? Any library, tool or something that can help me? Thanks in advance, I will appreciate any help.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2019-07-04 01:11:55 -0500

mgruhler gravatar image

There is no tool to do this out-of-the-box. As your message seems to be pretty specific with specific content, how could be?

There are plotting tools, like PlotJuggler, where you could probably write a plugin. But I doubt it will suit your needs.

The best way is probably to write a node subscribing to those topics and publishing a MarkerArray of the Marker Type you prefer. Then you can use rviz to visualize this.

As a side note: If you plan to use two topics, one containing x-Coordinates and the other y-Coordinates, you need to make sure to sync the topics properly using message_filters. Otherwise this could lead to strange behavior, as the topics will not arrive at the same time. If there is no very, very specific reason to publish the coordinates as separate topics, I'd highly recommend to publish them in one topic. You could use a custom message containing both arrays or e.g. a PoseArray which does already have a display type (though I'd recommend going for custom).

edit flag offensive delete link more


First of all thank you very much for your help. I'm going to follow your advice and pubblic both coordinates in the same topics. I knew that there are no tool to do it out of the box, I just needed a way to start and I will try with the MakerArray, as you suggested. Thank you again.

MG993 gravatar image MG993  ( 2019-07-04 02:27:47 -0500 )edit

answered 2019-11-29 03:02:29 -0500

Davide Faconti gravatar image

It can actually be done in PlotJuggler, but in a VERY cumbersome way (drag and dropping 70 XY curves.

I agree that MarkerArray could be a better solution. Alternatively, you may write a visualized yourself with a little it of matplotlib ;)

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2019-07-03 11:00:09 -0500

Seen: 276 times

Last updated: Nov 29 '19