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

Does ros have any messages and/or tools for displaying histograms?

asked 2011-05-19 17:10:18 -0600

updated 2011-05-28 05:25:53 -0600

kwc gravatar image

From what I can tell the answer is no. But I didn't want to reproduce anything if it already existed or if there was a clever combination of tools/msgs that I wasn't sharp enough to think up.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2011-05-19 18:08:18 -0600

I've never come across anything in ROS itself but assuming you've installed the rxtools package (rx stack) then you have matplotlib installed since it's a dependency (used by rxplot) and you can use its pyplot.hist command.

As for how to get the data to plot, there are lots of ways but you're looking for a quick, one-off solution you could use rosh (you probably want to check this page for usage details). It could look something like this though:

# pop up a histogram of the field `bar` from the 
# last 100 messages on the topic `foo`:
import matplotlib.pyplot as plt
import numpy as np
x = np.array([m.bar for m in topics.foo[:100]])
plt.hist(x)
plt.show()
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2011-05-19 17:10:18 -0600

Seen: 1,362 times

Last updated: May 19 '11