示例#1
0
    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()
示例#2
0
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)