7 from sensor_msgs.msg
import JointState
9 from std_msgs.msg
import String
19 Callback function when a joint_states message is published. 20 Adds positions to global list to be processed right afterwards. 28 if list(val.position) == [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]:
32 if PREV != list(val.position):
33 POSITIONS_LIST.append(list(val.position) + [LABEL])
34 PREV = list(val.position)
36 if PREV != list(val.position):
37 POSITIONS_LIST.append(list(val.position))
38 PREV = list(val.position)
42 Helper for writing positions to csv 47 out.writerow(POSITIONS_LIST[0])
51 if __name__ ==
'__main__':
53 print 'collect - ', sys.argv
55 rospy.init_node(
'data_collector', anonymous=
True)
56 rospy.Subscriber(sys.argv[1],
69 with open(cwd,
"w+")
as out_file:
72 out = csv.writer(out_file, delimiter=
',')
73 print 'Writing to', cwd
74 while not rospy.is_shutdown():