7 from jsk_recognition_msgs.msg
import PlotData
17 file_i = osp.expanduser(filename % counter)
19 file_i = osp.expanduser(filename)
20 rospy.loginfo(
"Output file %s will be overwritten." % file_i)
22 rospy.loginfo(
"writing to %s" % file_i)
24 dst_dir = osp.dirname(file_i)
25 if not osp.isdir(dst_dir):
28 with open(file_i,
"w")
as f:
29 writer = csv.writer(f, delimiter=
',')
30 writer.writerow([
"x",
"y"])
31 for x, y
in zip(msg.xs, msg.ys):
32 writer.writerow([x, y])
37 if __name__ ==
"__main__":
38 rospy.init_node(
"plot_data_to_csv")
39 filename = rospy.get_param(
"~filename",
"output_%04d.csv")
40 sub = rospy.Subscriber(
"~input", PlotData, callback, queue_size=1)