sample_2d_plot.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 from jsk_recognition_msgs.msg import PlotData
00004 import numpy as np
00005 import rospy
00006 import math
00007 from random import random
00008 
00009 if __name__ == "__main__":
00010     rospy.init_node("sample_2d_plot")
00011     pub = rospy.Publisher("~output", PlotData, queue_size=1)
00012     r = rospy.Rate(10)
00013     offset = 0
00014     while not rospy.is_shutdown():
00015         msg = PlotData()
00016         msg.xs = np.arange(0, 5, 0.1)
00017         msg.ys = [math.sin(x + offset) for x in msg.xs]
00018         msg.label = "sample data"
00019         if random() < 0.5:
00020             msg.type = PlotData.LINE
00021         else:
00022             msg.type = PlotData.SCATTER
00023         msg.fit_line = random() < 0.5
00024         msg.fit_line_ransac = random() < 0.5
00025         pub.publish(msg)
00026         offset = offset + 0.1
00027         r.sleep()


jsk_rqt_plugins
Author(s):
autogenerated on Wed May 1 2019 02:40:16