Python real time plotting ROS data
问题 I am trying to plot real time data coming to the computer using python. Data comes in a ROS topic and I use 'rospy' to subscribe to the topic in order to get data. This is the code I wrote import rospy from sensor_msgs.msg import ChannelFloat32 import matplotlib.pyplot as plt N = 200 i = 0 topic = "chatter" x = range(N) lmotor = [0]*N rmotor = [0]*N plt.ion() fig = plt.figure() ax = fig.add_subplot(111) ax.set_xlim([0,N]) ax.set_ylim([-1,1]) line1, = ax.plot(lmotor, 'r-') line2, = ax.plot