piechart_sample.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import math
4 import rospy
5 
6 from std_msgs.msg import Float32
7 
8 
9 class PieChartSample():
10 
11  def __init__(self):
12  self.pub = rospy.Publisher(
13  '/sample_piechart', Float32, queue_size=1)
14  self.timer = rospy.Timer(
15  rospy.Duration(0.1), self._timer_cb)
16  self.count = 0
17 
18  def _timer_cb(self, event):
19  msg = Float32()
20  msg.data = abs(math.sin(3.14 * self.count / 100.0))
21  self.count = self.count + 1
22  self.pub.publish(msg)
23 
24 
25 if __name__ == '__main__':
26  rospy.init_node('piechart_sample')
28  rospy.spin()


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Thu Jun 1 2023 02:45:58