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()
piechart_sample.PieChartSample._timer_cb
def _timer_cb(self, event)
Definition: piechart_sample.py:18
piechart_sample.PieChartSample.__init__
def __init__(self)
Definition: piechart_sample.py:11
piechart_sample.PieChartSample.timer
timer
Definition: piechart_sample.py:14
piechart_sample.PieChartSample
Definition: piechart_sample.py:9
piechart_sample.PieChartSample.pub
pub
Definition: piechart_sample.py:12
piechart_sample.PieChartSample.count
count
Definition: piechart_sample.py:16


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Fri Aug 2 2024 08:50:14