def __init__(self): # Set up node & topics rospy.init_node(NODENAME, anonymous=True) rospy.loginfo(rospy.get_name()+" node initialized") self.display = DotDisplay(BACKGROUND, textpos=DOT_POS) rospy.Subscriber('/takktile/calibrated', Touch, self.callback) rospy.spin()
class DotVizNode: def __init__(self): # Set up node & topics rospy.init_node(NODENAME, anonymous=True) rospy.loginfo(rospy.get_name()+" node initialized") self.display = DotDisplay(BACKGROUND, textpos=DOT_POS) rospy.Subscriber('/takktile/calibrated', Touch, self.callback) rospy.spin() def callback(self, data): color = np.minimum(np.ones(len(data.pressure)), np.abs(np.array(data.pressure) / DATA_SCALE)) self.display.update(color, DOT_POS, dotradius=DOT_RADIUS)