• attachment:my_stats.py of pal_statistics/Tutorials/Aggregate, store and visualise statistics

Attachment 'my_stats.py'

Download

   1 #!/usr/bin/python
   2 
   3 import random
   4 import rospy
   5 from pal_statistics import StatisticsRegistry
   6 
   7 
   8 def get_my_var():
   9     return random.random()
  10 
  11 
  12 def publish_callback(event):
  13     registry.publish()
  14 
  15 
  16 rospy.init_node("my_stats_node")
  17 
  18 registry = StatisticsRegistry("/my_statistics_topic")
  19 
  20 registry.registerFunction("my_var", get_my_var)
  21 
  22 rospy.Timer(rospy.Duration(0.01), publish_callback)
  23 
  24 rospy.spin()

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2019-04-17 09:33:48, 0.6 KB) [[attachment:aggregator.json]]
  • [get | view] (2019-04-17 11:47:05, 81.7 KB) [[attachment:grafana_dashboard_conf.png]]
  • [get | view] (2019-04-17 11:53:57, 75.0 KB) [[attachment:grafana_dashboard_view.png]]
  • [get | view] (2019-04-17 09:31:39, 0.4 KB) [[attachment:my_stats.py]]
  • [get | view] (2019-04-17 09:32:34, 0.1 KB) [[attachment:topics.yaml]]

You are not allowed to attach a file to this page.